Opened 13 years ago

Closed 12 years ago

#707 closed enhancement (fixed)

Implement Opponent AI

Reported by: Kieran P Owned by: Philip Taylor
Priority: Must Have Milestone: Alpha 9
Component: Core engine Keywords: ai, opponent, player
Cc: Patch:

Description

We need an opponent AI.

Notes:
Try to make it as flexible as possible. Perhaps in JS, so that other AI can be written. Globulation 2 had some good AI's (Numbi was easy, Nicowar was tough, and Warrush was a real test of speed). Each AI in this game should inherit from a base AI, then maybe allow tweaking of values? For example, warrior_to_worker_ratio or warrior_build_rate or min_attack_group_size. I'll leave the details up to you.

Basic Implementation: (women, housing and harvesting)

  • Builds women from town center
  • Builds houses when needed (should always try to keep ahead of the units being built, so it never hits the cap)
  • Assigns women to gather the resource needed the most. This is determined by what building is next in the chain of buildings. The idea is that if something is built (unit or building), women are assigned to replenish the resources spent building it.
  • Replenishes workers if they are killed. The idea being, if I kill 100% of it's workers, and it has resources to build another, it should see that, and act accordingly.

Medium Implementation: (warriors, defense, and groups)

  • Builds warriors in a ratio of 2 women, 1 warrior (for the easiest AI, see notes above about changing the warrior_to_worker_ratio)
  • Builds defensive structures at certain places around the town center (one per house seems adequate, maybe a house_to_tower ratio value that can be adjusted, to turn an agressor into a defender).
  • Units form groups determined by min_attack_group_size and max_attack_group_size (random number in between).
  • One group (see above point) moves to defend a building when it is being attacked. When that group loses 50% of it's force, another idle group is called in. In this way, if the player attacks one building, and then attacks another on the other side of town, the force won't be on one side or the other, but be split (the first group goes attacks the initial attack, and the second group goes and attack the other attack).

Complex Implementation: (attack, slaughter)

  • When idle groups of warriors (see above) are awaiting orders, and more than 2 groups exist, the third group is sent to attack. So to reiterate, two groups will always be at the town/city protecting it. How big those groups are are determined by min_attack_group_size and max_attack_group_size.
  • The attacking group attacks the enemy structure closest to their town center, and ignores other AI players structures, so it only attacks human player buildings.
  • When 2 groups are defending the town, and a third is attacking buildings, a fourth is sent to slaughter the enemies workers. Namely around remove mills and farmsteads.

Change History (7)

comment:1 by Dustin, 13 years ago

Place to load opponent AI

  • Create an empty file referenced by the player manager, and game set-up files, that can be slowly changed into opponent AI so that people can build and test snippets of script.

comment:2 by Erik Johansson, 13 years ago

Hmm, in general it seems like a fine approximation of what the AI will have to do to begin with. One thing I think we need to have it do to some extent already from the beginning: utilize the fact that citizen soldiers are both soldiers and gatherers/workers, something I cannot see in the description above, though it may just be caused by the list above not being exhaustive.

comment:3 by Kieran P, 13 years ago

Milestone: Alpha 4Alpha 5

A basic AI system has been implemented. And it will be expanded upon in the next release.

comment:4 by Kieran P, 13 years ago

Milestone: Alpha 5Alpha 6

comment:5 by Kieran P, 13 years ago

Milestone: Alpha 6Backlog

An AI has been implemented, and slowly developed.

I think I'll backlog this though, instead of mark it as resolved, since we still need a really quick AI that is good at planning and can actually beat a player.

comment:6 by O.Davoodi, 12 years ago

Shall we mark it as resolved now? qBot is not a bad AI.

comment:7 by Kieran P, 12 years ago

Milestone: BacklogAlpha 9
Resolution: fixed
Status: newclosed

Agreed. It still has a while to go (ally recognition and support, ship/sail based commands, etc), but it's an on going process, which won't need a ticket. Alpha 9 made qBot quicker too, so I'll mark this ticket closed off for that milestone.

Note: See TracTickets for help on using tickets.