Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
Automated Testing: Building A Flexible Game Solver
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
February 23, 2012
 
Interview: Silver Dollar uses XBLIG for its mad experiments
 
Last year's Supreme Court case on games cost California $1.8M [6]
 
GDC 2012 details Moriarty, Della Rocca, 'Rant' sessions in Education Summit [1]
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 23, 2012
 
2K Games
Public Relations Manager - 2K Games
 
2K Marin
Level Designer
 
2K Marin
Senior Rendering Programmer
 
Zindagi Games
Presentation/Game Programmer
 
The Workshop
Art Director
 
Blizzard Entertainment
Senior Software Engineer, Tools
spacer
Latest Features
spacer View All spacer
 
February 23, 2012
 
arrow Postmortem: Days of Wonder's Ticket to Ride Pocket [1]
 
arrow Sponsored Feature: Canada - Scoring High as a Game Nation [3]
 
arrow The Vita Interview [19]
 
arrow Gamification Dynamics: Identity and Story [7]
 
arrow What Makes Social Games Social? [3]
 
arrow Will Tablet Game Quality Soon Leapfrog Consoles? [27]
 
arrow Tearing Down Barriers: How to Bring MMO Players Together [10]
 
arrow Withstanding the Collapse of the Middle [4]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 23, 2012
 
Piracy and the four currencies [5]
 
The Secondary Costs of Outsourcing [10]
 
Sixty to Zero [4]
 
The Combinatorial Itch [5]
 
God Games and the Superman Complex [13]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  Automated Testing: Building A Flexible Game Solver
by Cyril Marlin [Programming]
3 comments Share on Twitter Share on Facebook RSS
 
 
October 27, 2011 Article Start Page 1 of 3 Next
 

[Experienced tool developer Cyril Marlin outlines a method used to build an automated testing system for Wizarbox's SoBlonde, a Wii adventure game -- which reduced bugs, increased polish, and is flexible enough to be adapted to other genres.]

A game solver can find a way to play an adventure game to the end, giving help to testers, as you can see in this video, testing SoBlonde for the Wii.


In game development, one task that is time consuming is testing. There are many documents and tools covering unit tests, however here we'll cover higher-level tests and their problems.

Testing is a highly repetitive task, and many use cases should be checked. Each modification has a risk of breaking the game: engine, high level logic, or resources are each a potential source of problems. Furthermore, the diversity of situations adds an additional problem, since each change should be tested in every situation. This can add up to a lot of time.

It is imperative to test as soon as possible, and as completely as possible, because the later a bug is detected, the bigger an effect it will have on the game. Indeed, once checked into the game's source control system, the bug will be start to be mixed with other developers' changes.

If so, when discovered, it will take longer to find and fix, as its resolution may conflict with the work of others. Finally, the larger teams needed for big projects increases the number of concurrent bugs in a project.

This can sometimes be solved by specific testers during the whole project, but the repeatability of the task has serious implications on the team. Bad habits can slip in, such as only running a single path to complete the game, and/or skipping some parts. In these situations, testing may not find bugs that exist, but the cost of testing remains the same. Worse, testers can have a hard time paying attention, thanks to the fact that the task is too simple or repetitive.

However, as I have already said, continuous tests are necessary, because without them, the source control system is likely to become corrupted and impact other developers.

Sometimes we can use a hard-coded test script, which contains all the actions to perform. But this method is far from ideal, as it will often have problems:

  • Linear testing. Actions are always performed in the same order.
  • Cross quests. A test script can hardly take account of variations, or optional side quests.
  • Up to date. If developers "forget" to report modifications of the adventure, the script may fail.
  • Dependent upon development completion. It is difficult to test until the complete adventure is implemented.
  • Logic. A change to a quest in one chapter may have consequences in another part of the game.

As a solution, we automated some aspects of game testing, including:

  • Integration testing on the entire game (load the full data set).
  • Dynamic tests: the test will automatically adapt to changes during game development.

The objective was to save time during development by removing the costs of creating and maintaining test scripts. Additionally, because testing has been performed throughout development, more potential bugs will have been found prior to entering QA.


SoBlonde

The Script Engine

The creation of a solver is closely linked to the data representation and logic operation of the game engine. We will describe below the scripting language that was developed to meet the production needs of the game SoBlonde: Back to the Island. It is a very simple script language, based on a set of C macros: The script associates, for each scene event, a list of actions to perform, with an

  • ID (among Activate, Look, Talk, Use, Touch/Untouch, Combine and SceneInitialisation)
  • The concerned entity.

And for every action in the list:

  • ID (Move, Rotate, Play Animation, Set Visible or not, Add/Drop Item, Set Scene, Set Var...)
  • Parameters.
  • The concerned entity.

The script system listens for events generated by the user or the game, and executes the associated action list. We can conditionally run of a sub-list of actions with conditions based on scripting variables declared globally. The fact that there is a global registry of variables is of importance, as we will see later. Here is an example:

OnActivate(ENTITY_BERNIE)
{
// shell has not been captured and bernie is on left
BeginMatch(VARINT_BG01_PICK_BERNIE, 1)
{
GoToLocator(ACTOR_SUNNY, LOCATOR_FLAG_BERNIE_LEFT);
Sleep(ID_ACTOR_SUNNY, 200);
PlayActorEffect(ID_ACTOR_SUNNY,WSD_CRABE_BOUGE,false);
SetSprite(ENTITY_ID_BERNIE, SPRITE_ID_BERNIE_L);
PlayAnimation(ID_ACTOR_SUNNY, ANIMATION_SUNNY_SHRUG, false, false);
PlayAnimation(ID_ACTOR_SUNNY, ANIMATION_SUNNY_IDLE, true, false);
}
EndMatch
//...
}
EndEvent

Parallel execution (as seen in the game) is out of our scope. We associate the "Activate" event on the entity BERNIE's to actions with condition BG01_PICK_BERNIE equal to 1.

The scripts are integrated in the game as modules: one for each scene (a scrolling screen) for easier editing. Being written in C, they are always available in memory. The entities, however, are not saved; their parameters (position, visible, interactive, etc.) are defined in the scene initialization stage. All variables are globals, so a game state is simply the script variables plus the content of the inventory.

The end result is very simple, and allowed rapid development of the game.

 
Article Start Page 1 of 3 Next
 
Comments

Lior Tal
profile image
Very nice article!

I am more interested in how this scripting engine was incorporated into your game engine - i suppose you were running a custom in-house engine and not some 3rd party middleware?

What implications does it have on the engine? for example, providing all the game entity's actions as simple hooks in the game engine so that the script can bind to them.

I am interested in implementing a similar technique using Unity for automated testing.

Cyril MARLIN
profile image
Yes, script system was done by us to keep scripting simple (no loops, no array, simple execution control, Graymatter uses Lua who allow scripters to do awfull things), and everything was done in C++.
You have to identify available input events for entities (kill it, smash it, ...) then, try them all using save & reload. But it needs to be fast, really fast!
You can try to combine it with a heuristic in the same way A* works: for example kill as much enemies as possible.

Hanson Snitch
profile image
Being a game programmer isn't an easy thing to do, it takes time to work for it to the fullest until you hit the spot with no error


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.