My thoughts on AI in RTS Games

AI is the key to the success and failures of many games. While AI itself takes on many forms (combat, path finding, progression) I wanted to focus for a moment on the combat and strategic AI of real time strategy games. A lot of people I know tend to dislike playing the computer in RTS games. While single player scenarios can be great because of the story (Rise of Legends most likely being the best story I have played) the lack of true skill the computer shows makes battles boring. RTS versus the computer tends to take on the following formula. Start, build up defenses for the expected rush, then mass as much as you can as quickly as you can to overwhelm the enemy. There is no strategy here, and the computer always seems to have an uncanny ability to know exactly what you’re doing, where you are, and until you have enough mass to overwhelm the computer it’s just a waiting game. Some games have tried to change this by limiting resources, scripting events, and adding paper-rock-scissors unit balance, but this is NOT true AI.

Simple Combat AI

AI in its simplest form is of course just a decision based on variables. If you are my enemy, I hit you.

If (player  = enemy){ hit}

This assumes that our little mob only can hit one way (ala Pacman) so we need to make hit into something bigger. ‘Hit’ becomes a function all of its own which dictates how the mob hits player. This involves checks directly on what the player is, but also can involve deeper checks. 

If (player[type] == air




We can also check specifics about the player and act accordingly, if the player is hurt, go to town, if the player is buffed, back off. We can also have mobs check the other mobs in the area to see what they are doing, and act more as a team. Really the choices here are amazing but at the same time, from my very limited C programming experience this is also pretty resource intensive. If we have a hundred mobs constantly checking on their own what they should do we might grind the game to a halt. Mob mind then seems to be the choice. (This explains conga lines of Protoss Zealots all choosing the exact path from A-B). What would be more realistic is finding a middle ground and using squads or groups to simulate a more organic look. I know as a player I live off of using groups.

Strategy AI

Strategy is where most AI falls down. It was quite obvious when RTS games cheated. The uncanny ability for the AI to know exactly where your base was, where assets were being moved reinforced the notion that the only tactic was the rush. Players are faced with a fog of war and AI decisions could just as easily be made based on the same fog of war. Within a random number of mobs, assign a function to report back intelligence. (Again I’m not using every mob because of resourcing issues, if the intel unit dies, just transfer the responsibility to another mob close by). This ‘scout’ reports back only what is in its line of sight based on the grid of the map. It doesn’t have to report back exact information to formulas, but an impression used by a master process to direct resources (and therefore another scout possibly)

“sector A5, 5 infantry, 10 headed north”

This information could be used to fill a grid with information and direct the computer where conflict was happening. Historical information on where bases were, previous tactics used could be referenced and the computer’s ability to respond to this information could guide the difficulty level of AI. The lack of a clear picture would allow players to use strategy to pull defenses, trick the enemy, and make battles feel more like playing against a human opponent.

Obviously I am not a programmer. The extent of my coding experience is C in a text based LPC MUD, but the concept seems sound to me… Thoughts?


~ by losthellhound on April 1, 2011.

One Response to “My thoughts on AI in RTS Games”

  1. A well written post. I’m always looking for stuff like this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: