
I've received a total of zero emails asking me about how I implemented the AI in
Island Commander, but screw you lot, I'm going to talk about it anyway.
This is all probably exceedingly simple to anyone's who written any kind of strategy game AI, but the enemy works in this way: every so often, it scans the map for the players units. It then gives each square a threat point value, based on the unit type (the meaner the unit, the higher the points) and how far away the square is. It then totals up all the points for each square, and then finally takes the square with the highest points
of which the AI owns. This square is where the AI will build its next attacking unit (if there is actually any threat to that square).
Of course, this may not be the case. There may be no threat whatsoever, and in fact there may be some juicy enemy mines to destroy. If this is the case, the AI does the same thing as above, except instead of looking for threats, it looks for targets. If there are within range, it will launch an attack on them.

Incidentally, you can see this in action by pressing T (to see the "threat map") or Y (to see the "target map") when playing the game. There are a few other nuances, like the fact then if the AI is attacking, it will sometimes build 2 or more units since they have more chance of surviving. It will also choose certain units for certain roles, like defending or attacking. But in a nutshell, that's it.
The next step is to implement different "personalities" of AI, one of which is chosen at random at the start - a defensive one, an aggressive one, and maybe a mad one that does random things. I may even get them to shout sarcastic remarks at the player via the console.