The AI is exceptionally simple. Basically for each AI faction, it cycles through a bunch of things it could do and does the next thing in the list that it can do.
I hacked away at it myself (in pre-MegaGlest versions) trying to implement some features I thought would be cool. However, the AI interface is extremely limited (built very much custom for the exact kinds of things in its list of things to do). To do anything more fun, a new generic interface needs to be designed and developed. I worked on that for a bit but ended up spending a lot of time just documenting how to get various info out of the system.
Giving commands is there and is easy. Getting info about what specific unit can see what other specific units and the distances between them, for example, is not. I think the following API would be very nice to have:
Need a way to cycle through your faction's units and then add all these methods to each Unit:
Unit->attackType[int]->attribute(string attribute); | to retrieve attack type attributes (e.g. range, damage) |
Unit->unitsInSight(); | to return a vector of units in visual range of this unit |
Unit->resourcesInSight(); | to return a vector of types and locations of resrouces in visual range of this unit |
Unit->location(); | returns cell location of unit (for use with other methods) |
Unit->straightDistanceTo(Location location); | to determine if in shooting range, for example |
Unit->travelDistanceTo(Location location); | to determine how many cells to travel to the other unit |
Unit->attribute(string attribute); | to get attributes like health, energy points, etc. of a given unit |
Unit->giveCommand(Command command, Param param); | to issue a command to a unit |
Unit->setAttribute(string attribute, int value); | to set custom attributes (create if doesn't exist) to units |
This API really needs to be employable via LUA scripts so the actual AI engines are easily user-programmable.
Other things that would really help would be to allow visual fields of units to be blocked by objects like trees and other units.
I also think the ability to turn on allies would be pretty nice. The following methods could be employed:
(1) if you directly attack your ally 3 times then they become an enemy faction.
(2) if all enemy factions are destroyed then allies turn on each other (could be an option). This would make for some interesting positioning around when you know the enemy is almost destroyed.
I think offers of alliances would be nice, also.. but would involve a bit more work.