Over the last few months on AiGameDev.com, I’ve written numerous in depth reviews of the artificial intelligence in AAA game. There’s certainly a lot to learn from such titles, but looking at things from the opposite side of the games industry is equally helpful.
This article focuses on an independent game called GalCon, a galactic colonization game that takes a few minutes to play. The game is pretty addictive; try the demo! This review starts with a short introduction to the gameplay and how the AI framework is implemented, then describes what the main challenges are.
Screenshot 1: Single player GalCon against the default AI bot.
GalCon Gameplay
The game can be picked up in a few minutes, but as the saying goes, takes a lifetime to master. The rules are as follows:
The planets in your control produce ships depending on how big they are. You start with one big planet..
You can send your ships to attack neutral planets, guarded by a constant number of ships.
In battle, ships are lost one-to-one; you can take over a planet once the number of opposing ships reach zero.
Your enemy also controls ships, takes over neutral planets, and can attack you even.
The goal of the game, obviously, is to destroy the enemy force within the galaxy. It’s not necessary to control all the neutral planets, however.
The Framework
You can see the framework in action in the demo, but you’ll need to register the full version to be able to run your own mods.
The AI is implemented as a Bot class which uses a simple and elegant scripting API written in Python. A new bot can be implemented in one file only, using the following boilerplate code:









Comments
Comment on this article. | Show full forum thread.Can you also pit AI vs. AI? I loved tracking (for a while) Age of Empires 2 AI contests which was very easy to setup AI vs. AI on randomly generated maps (with contests being "best out of...X" ones to remove the element of chance you'd start up in a poor position).
I'd need to get into Python to work with it though, but I should check this out, soounds cool (Although I need to get to bed right this second).
Easier said than done, but good AI is never easy, is it?
I think you're side-stepping a lot of important details by just using linear optimization. Could you give us more details of how you'd approach this?
Jare,
Sounds like a very sensible approach to add scripted behaviors on top of fuzzy estimations. How would you take into account ships in flight, and potential arrival times?
Andrew,
The game seems quite balanced, and there are lots of options that open up in real-time... so not that many biases. :-) But after playing it for a while, I'm inclined to believe the default bot implementation cheats to produce ships faster than you.
You can watch bots play together on random maps with a nice plugin called Symmetry. And, yes, it's a great way to start programming! (Read through and make minor changes to existing bots first.)
Alex
I'd be interested to see how the two would compare in this type of game. For most situations local optimums are also global optimums, and it reduces the processing power needed.
The way I'd program this is to keep track of all the planets, and the longer the enemy has a planet, the more weight it would gain(since, logically, more production)
It also appears that the bots may be able to keep track of enemy movements? If so, that could be factored in as well.
Then, an aggressive approach would be to essentially "zerg rush", a sneaky approach would use planets as bait, and then attack the suddenly weakened planets of the enemy(as an example), and the cautious approach would be to stockpile and move slowly only when victory is certain, or neccessary.
Since it seems quite balanced I'll take a gander when I have a chance, it's bookmarked now.
In the future an AI site (well, this one, since I can't find really any other *active* Game AI sites!) should have a small contest for some game like this to pit AI vs. AI, especially if the game itself is any good and can be programmed easily (I'm not sure this game is any good yet ;) ).
A contest is a good idea. I've run them before but don't have the time right now in the build up to GDC :-)
Phil, Galcon's creator, is interested in having one for his game, but it'd be nice to have one that's generally open for anyone to join in.
If anyone is interested in helping set this up, [URL=http://aigamedev.com/author#contact]email me[/URL]!
Zeroth,
Great ideas. The only thing I'm not sure about is how well minimax would perform in such a real-time problem... It's traditionally turn-based, but it could work I guess.
Alex
When evaluating a move, also estimate how long it would take to be complete, and extrapolate the movements of ships in flight, but only generate moves of the AIs when my move is complete. After that, I would subdivide that period based on the smallest time that AIs would take to complete their current moves. Once that is in place, I'd consider more frequent subdivisions, and probably take ships in flight into account when evaluating the board score.
In essence, try to treat it as a turn-based game where the time of each turn is variable.
Alexjc Basically, I'd use the method that Jare describes, however, you'd likely need to use a partial exploration/analysis algorithm. Because having the AI recalculate the minimax tree every other frame or whatever is still too expensive. What I've found works is working towards local optimums in my solutions, since 99% of the time, they work, when global optimums would take too much time.
It is after all an NP-complete problem here. ;)