As some of you know, I’ve never written tactical battle AI before. Galactic Civilizations and Stardock’s other games didn’t have tactical battles. War of Magic had tactical battles but I wasn’t involved in that portion of the game.
This series of journals will take you through the journey of how to write AI for tactical battles. In my experience, games have tended to have pretty crummy AI when it comes to tactical battles (War of Magic no exception).
So for starters, I’ve got help. Seasoned developer Charles Lentz, who has been at Stardock for some years now, is assisting me on this project. The first thing I asked him to do is make it easy for me to do mock battles. When I was working on War of Magic v1.4, which was the first build I even got to look at how tactical battles were done, I noticed that there was no way for me to conduct mock battles. I’d have to “get lucky” and find an AI player who could cast spells to see if it even worked which was time consuming.
So for Fallen Enchantress, I asked Charles to set up a cheat key that would create opposing armies and that it would read from an XML file that I could mod to decide what powers those units would have. That way, I could test out all kinds of combinations.
Since I come from the modding world, I prefer to have my games let me, the player, mod as much as possible. My AIs have not been very moddable in the past because, frankly, the coding necessary was far outside my area of expertise (i.e. making it read variables and data from external XML files rather than just hard coding it in C++). But with Fallen Enchantress, Charles is going to take care of that for me.
So one of the things I intend to do is stuff as much data as I can in XML files. I want to be able to have the AI gather as much data as it can about who it opposes and then look at the XML data to help it decide what to do.
That means I want to make it so that every spell, ability, weapon, etc. in the game has in its XML AI data that I (or others) can mod with good things to go against it.
Does the enemy side have a spell that rains down a fire storm on me? Then I want that spell to include in its XML what spells are good counters to it. Then, the player comes in with his fire mage and the enemy casts a frost shield on her first turn.
Moreover, this gives me the excuse to request the UI team to let both sides see what spells/abilities each other have easily because a good tactical battle, in my opinion, should be a real battle of wits making use of terrain, spells, counter-spells, and maneuver. And the more data the player gets to see, the more data I can let the AI see without “cheating”.