Author Topic: Overhaul of Infected AI  (Read 2231 times)

0 Members and 1 Guest are viewing this topic.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #15 on: December 21, 2010, 09:38:26 PM »
Quote
How long do you think it'll take until all the coding's done?

For the AI engine, first draft will be done tonight - the only bit left to add now is the code that triggers a gather point to launch an attack.  That's very comfortable territory for me and I don't envisage any great problems.
I will be testing it a lot in the coming days, including on gravity maps.

So I guess the answer is... I don't know :P
It'll be done when it's done.


In the mean time, I have some awesome-tastic news:




The gather point flapping problem has been solved.  You can see now the green boxes indicate the spots where the AI are gathering up, having fully colonised the current partition galaxy.  The fact that it creates these multiple different gather points implies that it will work in seperate partions, although I haven't fully tested that yet of course.  :>

I also squashed a bug that (in very rare cases) was causing the AI to issue commands to the player's seedlings!
« Last Edit: December 21, 2010, 09:41:51 PM by annikk.exe »

Sniped50

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 97
  • Don't ask. About anything.
Re: Overhaul of Infected AI
« Reply #16 on: December 21, 2010, 09:53:24 PM »
Quote
It'll be done when it's done.
That's probably one of the better responses I've heard of. It's almost as if you work for Valve... ;D

Quote
I also squashed a bug that (in very rare cases) was causing the AI to issue commands to the player's seedlings!
Aw, did you have to? It would have been cool to just watch it all play out while simultaneously making you feel insignificant that the computer itself was doing a better job than you.
"Sometimes, the simplest solutions work the best."
- Mythbusters

"But the complex solutions look prettier."
- Me

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #17 on: December 21, 2010, 10:00:55 PM »
Going to do an open beta for the AI.  If you have a map and want Infected AI you can just copy and paste into it, this will be your chance!


I will post 2 pieces of code.
The first must be inserted at the end of function LevelSetup().
The second must be placed inside a While Running loop (such that it will run repeatedly) inside function LevelSetup.

The only requirement is that you give player 2 (or above) ownership of 1 asteroid to begin with, and at least 10 seeds or 1 tree on the asteroid.  The AI should then automatically learn about your level and work immedietely.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #18 on: December 21, 2010, 10:21:09 PM »
Now watching Infected Empire 2 battle against Infected Empire 3 :P


UPDATE

Empire 3 is winning!

UPDATE 2

Damn, there's a bug with single-asteroid partitions.  The metric spirals above 500 endlessly.  There aren't any nearby asteroids for it to be exchanging higher numbers with though.  Hmm...

UPDATE 3

Think I've fixed it...  testing...

UPDATE 4

Not fixed yet, but Empire 3 managed to win.  :>  Tried something else, testing it now.

UPDATE 5

Think I've got it this time.  Everything is showing Expected Behaviour.  :>  I haven't put any bells and whistles in this AI yet, like flower handling...but it seems to have colonising and attacking down really well.
Standby for release of v0.1 for beta..

UPDATE 6

Working - w00t !  Unfortunately, it sends seeds in dribs and drabs.  Slight change to make it only send an attack force once it has enough seeds to have a realistic chance of taking the roid.
Testing...
« Last Edit: December 21, 2010, 11:26:02 PM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #19 on: December 21, 2010, 11:26:49 PM »
First version should be finished in an hour or so. :D

Ah, the optimism of programmers.  :P

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #20 on: December 22, 2010, 12:16:04 AM »
Ok, all the behaviours seem to be correct now.
Trying it in a different map next.  :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #21 on: December 22, 2010, 04:49:56 PM »
In version 1 I kept different metrics for guarding the empire, colonising new asteroids, and building up a force ready to attack.  In this new version, I plan to combine all of these metrics into one.  Therefore, one metric array will be used per empire.

It's funny looking back at this now.  When I was actually coding the metric system, I realised that it would be possible to just use a single array to keep track of the metrics for all asteroids, and all empires.

The trick is that asteroids only take notice of neighbouring asteroids' metrics if they are owned by the same empire.  :>
I guess it makes things a bit more efficient.  Less data structures are needed, the code is less confusing, etc.


Also,

Quote
The asteroid will also make a list (array) of all a) friendly or empty asteroids, b) a list of enemy neighbouring asteroids or empty asteroids with enemy seedlings on them that are within its send distance.

This was one of the concepts listed in the first post in this thread.  But actually, I combined those 2 arrays into one as well.  It's called "neighbours", and it's simply a list which is created on each cycle of which asteroids are within the send distance of the one being checked.

The various seed-sending code in the "Actions" section takes care of whether a particular neighbour is a friend or an enemy.  This is a much simpler system than maintaining 2 different arrays.


The entire engine contains just 2 arrays: metric, and neighbours.
« Last Edit: December 22, 2010, 04:58:21 PM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Overhaul of Infected AI
« Reply #22 on: December 28, 2010, 01:43:20 AM »
Coding stopped for now due a depression. :<

I'll feel better tomorrow, hopefully..