Author Topic: General approach to IAIv3  (Read 4745 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
General approach to IAIv3
« on: November 07, 2013, 02:33:34 AM »
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. :>
« Last Edit: November 07, 2013, 02:39:11 AM by annikk.exe »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: General approach to IAIv3
« Reply #1 on: November 07, 2013, 02:48:12 AM »
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 :)
« Last Edit: November 07, 2013, 03:21:02 PM by Aino »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: General approach to IAIv3
« Reply #2 on: November 08, 2013, 10:37:02 AM »
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

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: General approach to IAIv3
« Reply #3 on: November 09, 2013, 11:08:17 AM »
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!!!