Jump to content

AI Development using Genetic Programming


Recommended Posts

Hey guys,

I'm going to be starting an M.Sc. in AI soon and I am toying with the idea of doing some work on the 0ad AI as my dissertation, using genetic programming. Basically, the idea is to start with a good bot, and serialize all the hard-coded values (delays, priorities, number of units etc...) into a chromosome/genotype. I'll then use genetic algorithms to generate a number of new bots (i.e. with different configurations) and test them out against each other. The best percentile will spawn a new breed of bots, and each generation competes with the previous one so better bots keep emerging (hopefully!)

I've downloaded the source and had a look around, especially the AI scripts. It would be really helpful if someone would kindly answer the following questions.

  1. Is it possible to create a game where two AI bots play each other, without a human player?
  2. Does the game log actions somewhere, or can this be enabled?

For now that's all. I'm sure I'll have more questions - at this point I'm still analysing whether this is feasible. Thanks so much.

Link to comment
Share on other sites

  • Is it possible to create a game where two AI bots play each other, without a human player?
  • Does the game log actions somewhere, or can this be enabled?
I do warn you, the game is still in development, so new features are added from day to day, and statistics are changed. Some statistics changes break the AI in unexpected ways (like a change to disable farm fields until you've build a farmstead, there was no way the AI could foresee this).

EDIT: added some links to documentation

Link to comment
Share on other sites

Hi Jubalbarca,

Well, at this stage I am still working on my proposal - still have to get into the nitty gritty of things (provided the proposal gets accepted - but I'm cautiously optimistic!).

I'm thinking, off-hand, around 100 generations with 52 AIs each generation, which compete against each other and the standard AI in a tournament. Of course, there's still a lot to be discovered.

My idea is as follows:

  1. Generate a random seed of bots - let's go with 52 for now.
  2. Using the command line, get the bots to play each other (four at a time) and get the winners to compete.
  3. Choose the top ten. Have them mutate, cross-over, transpose etc... to get another 40.
  4. Go to 2. Until 100 generations have been generated.

Of course a lot of this depends on how fast I can run the simulation. Is there a setting for game speed beyond insane? Sorry if this sounds like a basic question, but as I said I'm still in proposal stage.

Thanks for the interest!

Link to comment
Share on other sites

Of course a lot of this depends on how fast I can run the simulation. Is there a setting for game speed beyond insane? Sorry if this sounds like a basic question, but as I said I'm still in proposal stage.

See http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/data/game_speeds.json

I do think the maximum speed is limited by practical limits. You'll notice, when the game lags, the game seconds will be slower than actual seconds. So from the moment the game lags, you won't be able to speed it up any more (or lags are mostly CPU lags).

Also, there's a non-graphical replay possible, that runs at full speed (without rendering, just using the CPU to calculate the simulation as fast as possible), but I don't know of an option to allow this for live games (non-replays).

Link to comment
Share on other sites

Also, there's a non-graphical replay possible, that runs at full speed (without rendering, just using the CPU to calculate the simulation as fast as possible), but I don't know of an option to allow this for live games (non-replays).

You can start a game manually to generate a commands.txt, then open it in a text editor and follow the obvious format to extend it by thousands of turns, then run the replay command with that file, if you want to run the game non-visually for an arbitrary game length. You'd need to add some extra code to let you detect the result of the game, though. You could then run multiple instances of the game in parallel, to make use of all your CPU cores.
Link to comment
Share on other sites

Sounds promising, I'm looking forward to your research! After working with Daniel Shiffmans "Nature of Code" where he also describes genetic algorithms, I have been wondering as well wondering how feasible this might be for a 0ad AI system and fantasized about coding a 0ad bot based on genetic algorithms, but lacking time for that.

Edited by nylki
Link to comment
Share on other sites

Triplicarius,

Actually that's something I've been adding to my proposal just today! Besides using a GA approach to actually generate the bots, I'm going to use machine learning/data mining to analyse the list of chromosomes I generate and their associated fitness. Perhaps I can identify patterns as to which genes produce the greatest fitness - which means the community will have a clear insight as to which factors of the AI effect gameplay the most.

Link to comment
Share on other sites

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...