Eufloria > Eufloria HD Mods

General approach to IAIv3

(1/1)

annikk.exe:
Still haven't received my copy, but lets do some planning anyway..

IAI works on a per asteroid basis.  Each asteroid looks around at its neighbouring asteroids and at itself, then takes action based on:
1.  Its current state as defined by its own priorities
2.  The priorities of its neighbours

If an asteroid's current state is more than or equal to that of its neighbours, it will keep seedlings for itself and use them in whatever way is needed, be that planting trees, gathering up in preparation for an attack, or for defence.

The engine is therefore split into 2 passes:
1.  Calculate new priority
2.  Take action based on priority and neighbour priority.  Send seedlings to the priority number that is smallest (ie smaller priorities are more important)

I want to cover what these priorities should be for each possible state.

-15 Under attack by a number of seedlings greater than <threshhold> number of friendly seedlings already here.  We don't want the whole empire to come rushiiing if we're only beiing attacked by ten enemy seedlings, so the threshold takes care of this.

-10 Expecting an imminent attack: this asteroid have less than <threshold> float multiple of enemy seedlings on neighbouring asteroids.  Threshold could be something like 0.8

-5 Unexplored asteroid

0-30  Has been scouted, and is either neutral or belongs to the AI but has a number of trees less than treemax.  Assigned a score between 0 and 30 based on attributes of the asteroid.

100  Enemy asteroid with an attack under way by our Empire

101  Enemy asteroid that is sufficiently weak that our Empire can now launch an attack on it from a neighbouring gather point

105 A gather point - seedlings should congregate here in preparation for launching an attack.  Gather points are created by an election method.

Lowest Neighbour Priority + 1 If nothing interesting is happening on this asteroid, it looks around at its neighbours to see which of them has the lowest priority, then sets iits own prioriity to be the same, plus one.

All this will probably change by the time the engine is completed, but it helps me to start thinking about this stuff now. :>

Aino:
Maybe you should store the neighbors of each asteroids so the engine runs more smoothly this time, then you can create a more dynamic list if the map is moving(with gravity and stuff)? :)

Anyways, nice looking :)

annikk.exe:
Hmm, might be possible.  I'll have to think about that one... IAI's previous design depended quite heavily on recalculating stuff each frame.  It should be possible though I guess. :>

I'd want to make it configurable, so you can choose to recalculate each frame for moving asteroid maps, but also switch it off and use precalculated neighbours on static maps, for efficiency purposes.

Lost Seedling:
Annikk,

Please make the engine easily configurable to assign IAI to specific empires like the Merchant engine. Also, the current engine seems unable to handle asteroids that have no trees owned by empires numbered 2 and above (at least I can't get it to work properly in those circumstances and the code seems to confirm that).

As for the frame rate, I found Infected nearly intolerable to run in larger maps (number of asteroids) or when the number of seedlings rose into the thousands. In the past year, I've run over a thousand hours of AI War simulations in every map and scenario I could think of, and if I had to run two AI's using the same resources as Infected, I couldn't do it. This probably won't be a problem with the new computer I just bought, but as Aino says, please take that into consideration. An ON/OFF "switch" in the code would be great! By the way, in the current engine, is it really necessary to run the "get number of asteroids" loop each iteration? That seems like a terrible waste of clock cycles and would improve the performance drastically if removed.

We don't yet know how Pilchard's OHAI will perform frame-rate-wise, but if it is as resource-demanding as IAI it may not be good from an AI War perspective on older computers if pitted against IAI.

On the other hand, we want the toughest human-opponent, too, so I guess you'll have to come up with a 3-way switch- one optimized for fighting humans, one for AI wars, and one for slow computers!!!