Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had this chat with a friend of mine about whether an AI can be created or not that could beat any human without resource cheating in a real time strategy game. An AI that would play almost perfectly. The AI of today's games have many areas that can be improved, most of them rely on resource cheating, a better early base developement because of that, and attacking in waves.

Still, the question is what would need to be done to improve on this to obtain the ultimate AI. Also, if you have any example of a game where a certain feature was used it would be great.

Edit: There is little clarification i can provide for those who haven't read the title or the few paragraphs describing the problem. This is about real time strategy games and the ultimate AI. That means Strarcraft, Warcraft, Generals, Red Alert, Age of Empires, AI War etc. Games that have more than one difficulty level, but the focus here is on the ultimate challenge.

tenpn has a fantastic post filled with great resources. Thank you, tenpn! I wish more people would contribute in that direction.

share|improve this question
Really this question doesn't make sense without a specific case. All games have differing ways of implementing AI, depending on the game mechanics involved, and 'how to improve them' will vary massively. At the very least this should be Community Wiki, as there's no 'right' answer here. – MrCranky Sep 3 '10 at 9:55
Further to the former: Consider that Chess is a strategy game. – Rushyo Sep 3 '10 at 13:21
Why would you want to? Making a perfect AI for the game of Pong is absolutely trivial, and absolutely no fun to play against. The goal of game AI is not to beat the player, since it is the player (not the computer) who is supposed to be having fun. – Ian Schreiber Sep 3 '10 at 15:16
Ian: The OP is talking about something very different from Pong. It's easy to make an unbeatable Pong AI, or a Tic-Tac-Toe AI. Chess can be taken to an AI that only the very, very, very best can defeat. But RTS is a different ballgame. – The Communist Duck Sep 3 '10 at 15:51
You might be interested in STRIPS algorithm. – user712092 Aug 3 '11 at 17:28
up vote 11 down vote accepted

It's kind of a difficulty question to answer. To state what needs improving, you need to have some known AI to work from. However here are some examples of RTS AI from (registration required):

Unfortunately most of the really good stuff is behind the paywall.

A common AI solution is the Goal-Orientated Action Planner, which uses rules to form plans to satsify goals. It's been around a while now but it's very cool. There's a brief overview (pdf) available on Jeff Orkin's site about how it's applied to an FPS, but exactly the same principle (with different rules and goals) works for RTSs.

Many RTSs will use heirarchies of GOAPs, with different levels recieving goals from the level above, and concerned with different levels of detail of the battlefield. I read a great article on some WWII hex wargame's AI that was structured like this, but for all that is google I can't find the link now. Gold star for anyone who can help me out.

Of course the effectiveness of GOAPs and other planners depend on how well you parse your game world, and how refined your actions and goals are.

Other common tech includes Utility architectures (pdf) for scoring and priorities, and blackboards for parsing the game world.

share|improve this answer

The point is, if you've got an AI

that could beat any human without resource cheating in a real time strategy game

then you have a game no one will play becuase they couldn't get past the first level.

The hardest part of AI programming is making the AI beatable, but beatable by someone with a bit of skill. Make it too easy to beat and players will be put off by a lack of a challenge, make it too hard and again, people will get fed up with being beaten all the time.

So it's not about creating complex AI (which isn't difficult, after all, the AI can process everthing within its playing area simultaneously whereas a player can only process what's on screen), but more about creating a balanced game.

share|improve this answer
To clarify, making an AI that can beat any human is not that hard since the AI can control its units with better granularity than any human could hope for (due to UI constraints). A human takes seconds to react to events, select and command units, whereas the AI can update the orders for every unit individually every 'game turn' in response to any event. But in practice, this isn't done since it would make the game tedious. The really hard part is making the AI dumb enough to beat. – Skizz Sep 6 '10 at 14:52
To clarify the clarification - making unbeatable AI is not that hard; making beatable, challenging and engaging AI is far, far more difficult. – Skizz Sep 6 '10 at 14:56

A lot could be done but my immediate reaction to this question was a counter-question: why would anyone want the ultimate RTS AI? And why doesn't this person just play online, against another human opponent?

The crux is: it's not the problem to make the AI unbeatable, it's the problem of making it think fast enough (eg. it has to take shortcuts) to be able to play against 3 or even 7 AI opponents on the same map with a regular computer. Even today, and tomorrow, and I expect it won't have changed even ten years from now.

The next issue is: as long as the AI follows strict rules, it will be exploitable. Even fuzzy rules will make it vulnerable to exploits. The AI would have to learn, and it would have to make mistakes - intentional and unintentional. It would also need to surprise you. And then you're playing against another human being. Since AI doesn't even come close to copying a human's way of thinking both algorithmic and in terms of processing power, you're much better off not wasting your time on a single player AI that's not nearly as much fun to play against as another human being, if only for the social factors involved.

share|improve this answer

What you define as 'resource cheating' is like 'boost balancing' in racing games. The 'boost' is used to try and keep the pack in relatively close proximity to each other to create the illusion of a tight race. If the player isn't in the lead it may keep the CPU player in sight, and if the player is in the lead it keeps the pressure on by putting opponents directly on your tail, even if the CPU itself is a mediocre driver.

In an RTS you're looking at a collection of values which can be arranged optimally. You know exactly how long it takes to obtain a resource, how much building items costs, map traversal times, etc.

If you're the one who has created the tables and has the info readily available to you it's just a matter of number crunching the data to find the best ratios for output.

But how much fun is it to play against an enemy who always does exactly the same thing based on the context of the playing field?

So you add chaos. You give the AI an efficiency on a sliding scale. You have it harass the player. If the player appears to be doing too well, you have the AI cheat a bit and give it some extra resources or reinforcements to keep the player on their toes.

You want the player to feel the satisfaction of facing a challenging opponent, rather than spanking a weak AI or being slaughtered by Hal9000. The perfection of a CPU opponent lies in its imperfection. :)

share|improve this answer
And different, but related: It's nice if the AI sometimes does things that aren't technically their best option, but add a little fun to the game, such as using unusual units or moves (e.g. airdropping troops in the back of the player's base) – Bart van Heukelom Sep 4 '10 at 21:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.