AI Testing

One of the things I learned while developing MMORPG Tycoon is how important it is to have a repeatable test case, when you’re developing complicated AI behaviour.  A way to run the same situation several times, to help debug why a misbehaving character is doing what he’s doing.

In most games, this isn’t a big problem;  most games have relatively static levels, and will play back in approximately the same way every time you play.  But MMORPG Tycoon is much more complicated, seeing as how the player is creating a game for the AI to play in.  And if I need to spend a minute setting up a region every time I want to test the AI, it slows down development dramatically, and small variations in precisely how I set up the region each time can make the debugging even more complicated.  In MMORPG Tycoon v1.0 and v1.1, I used saved games to build re-usable scenarios that I could run AI through.  When I was done debugging, I’d kill the game so that it wouldn’t autosave over the scenario’s save file.

In v2, I don’t have the new saved game system fully implemented (and that approach was very user-error-prone, anyway.  It was much too easy to accidentally auto-save over my carefully created test scenario), so I’ve instead set the game up to automatically create a very simple starting setup;  a graveyard, an inn, two grinding zones, and two NPC quest givers.  I’ve also set it up to have 30 AI developers (ordinarily, you start with just five), so that monsters get placed into the starting areas more quickly.  The screenshot here is of this new “AI Test Zone” starting area, only a few seconds after the game has started;  you can see the dozens of AI developers returning from having placed the first few monsters, all heading for the graveyard to get some more.