I am working on building a Strategy Game (Animal Colonies fighting each other).

It is going to be simple game targeting Kids, the beta version will only support single player playing against AI opponent.

I am going to hire Algorithm programmers to build the AI algorithms of the opponent, BUT :

  1. I am not sure what information I need to give for the programmers in order to build these algorithms.
  2. I want to have different AI levels difficulties (easy, medium, hard), BUT if the AI opponent is too easy to defeat, the game is boring, while if it is too difficult to defeat, the game is too frustrating, and the player will quit, so I need this issue to be addressed when building AI for different levels.
  3. I am not sure if the AI opponent should behave like a human player? I mean should the specification allow AI opponent to have access to all game resources ? or AI should behave like human player to use scouts to collect information about resources and enemy?

I need to identify these points. I want to write detailed specification so algorithm programmers can do the work as expected. All what I have at the mean time is Colonies design (characters/elements), maps with objects (grass, rocks, hills, tree .. etc).

So, what exactly do I need to give them in order to build opponent AI?

  • \$\begingroup\$ Nice question - I'd love to see some references to existing AI algorithm descriptions in the answers. \$\endgroup\$
    – axel22
    Commented May 8, 2011 at 11:13
  • \$\begingroup\$ You might consider some training in Prolog language :). \$\endgroup\$
    – user712092
    Commented Aug 3, 2011 at 17:31

4 Answers 4


As a short answer, the best thing to do is to develop the AI and use the different difficulty settings as different levels of randomness/thinking ahead. Thus, easy will very often not take the best path whereas hard will more often.

As for trying to get the difficulties right, you cannot judge human perception through code. Your only option really is to get testers to play it and comment.

  • \$\begingroup\$ Does that mean, I need first to have a working game (prototype), then develop the AI and test it by testers? \$\endgroup\$ Commented May 7, 2011 at 12:09
  • \$\begingroup\$ Technically yes..you can't expect to test a game without a game to test. \$\endgroup\$ Commented May 7, 2011 at 14:20
  • \$\begingroup\$ Thank you, I just thought I can give developers a map and colonies information (units, buildings, behaviors), and they can build a set of general AI strategies. Thx again! \$\endgroup\$ Commented May 7, 2011 at 14:24
  • \$\begingroup\$ There's two parts; the testing and the algorithms. The algorithms need some kind of base to work with. You can't just say 'this is what I want' and expect them to know how your objects work. You need some kind of basic skeleton of logic and updating. For the testing, the only way is human testers - thus, you'll need the graphics too. \$\endgroup\$ Commented May 7, 2011 at 14:42
  • 2
    \$\begingroup\$ You can probably just have different parameters to tweak when the AI is done being programmed. Exmples: Aggressiveness, Turtling, Stupidity, Max APM, all knowing, and anything else that would be good and relevant for your game. \$\endgroup\$ Commented May 8, 2011 at 6:10

Thought I'd give a vague overview of an RTS AI so you know what to expect.

There two large and seperate components: the higher-level planner, and the individual unit AI.

The job of the planner will be to win the game by building new units and issuing orders to them, like a general behind friendly lines. It may use a complex planning system like a hierarchical task network, or may take a simpler approach. This is a highly active area of research, so there's lots to read.

Whatever approach you take, you'll probably need a system to record information about the environment and enemies. This will probably be spatial. Possibilities here include blackboards, heat maps, and influence maps.

Each individual unit will have its own AI responsible for following orders from the planner. It will be responsible for picking and attacking targets, pathfinding around the environment, and even choosing when to override the planner's orders to preserve itself.

None of these issues are trivial. For any sufficently interesting RTS I'd expect a team of three or more full-time AI programmers to take more than a year to go from a blank page to a shippable competent opponent.


Lets look at Starcraft 1 AI, which is well known and understood as a source of inspiration.

For point 1 I can't help you much since I don't know enough about your game. Basically you should start your game with no computer opponents and get your developers to play the game. You can then make points about what strategies that they employ - and that you want those built into the AI.

Point 2 is the most interesting. In Starcraft, the AI has sets of build orders to execute based on what the player is doing, but also based on the difficulty. At easier levels, the AI scales back on what it builds, and doesn't retreat from losing battles. The higher the difficulty, the more aggressive the build order and the more it tries to preserve its own units from losing battles. At the "insane" difficulty level, the AI actively cheats, gaining more resources than it should.

Point 3 is just an opinion. The AI should behave like humans. It should know what units it has revealed through scouting and build units to counter.

So moral of the story, the easier the difficulty, the less the AI should "try", and the less it should read player inputs. It should mine resources and use them fairly. The AI should be bound to the rules of the human players, but the difficulty is making them "act" like one.

  • \$\begingroup\$ "Basically you should start your game with no computer opponents and get your developers to play the game." >> To make this happen, I need first to integrate multiplayer feature so developers can play the game, otherwise, I don't see how they supposed to play the game without having an opponent, right? I will really appreciate your clarification on this issue. \$\endgroup\$ Commented May 8, 2011 at 10:47
  • \$\begingroup\$ @AhmadAlkhawaja The sooner the multiplayer feature gets added the easier it will be to add. \$\endgroup\$ Commented Jul 27, 2015 at 3:41

As a player it gets really annoying at times when the AI can see things it shouldn't be able to see. I still one game that was otherwise quite good but the AI was all-seeing and thus could do some very nasty things with artillery at times because of that.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .