Resource icon

Genetic AI Project 2016-10-05

TGA's Genetic AI v0.31
Link to mod thread

Current best AI: Little Bugger by Gunner (Fitness: 4870)

I've been beavering away for the past few weeks getting this project on the road, and now I think it's just about time to ask for some help off the community.

NOTE: This mod is currently only for vanilla Civ 4. I will add Warlords support after a few patches.

What it is:
A genetic AI is basically an AI which will learn and grow over time. The idea is that the AIs will play games, with their results logged, and the best AIs of the batch will then go on to be the base for the next set of AIs. I have written a script that will pit AIs against each other, recording the results, which I have another script which can analyse and build new AIs with. Unfortunetly this process is very time consuming and this is (hopefully) where you come in.

What I need:
I need time. On my AMD Sempron 2200+ a normal game between 6 AIs takes roughly one hour. Given the random elements in a Civ game, one game isn't nearly enough to judge a particular AI with, so each AI must be played many times to judge it's fitness. The more games the better data, but the more time consuming. At the moment I'm running 10 games per AI. A quick bit of maths will tell you that doing 6 AIs for 10 games each will take about 10 hours on my computer. This is far to slow to get meaningful results any time soon.

How to help:
You can help in quite a few ways.

The first is to download the mod at the bottom of this post, install it, and just play as normal. You'll get a slightly more unpredictable AI, and it'll take ages, but it'll show the AI's performances much more effectively. The AI will not reload after a save-game, so this option isn't really very plausable.

The second is to download the mod at the bottom of this post, install it, and run it autominously in the background while you are either away from your computer, or doing things which aren't performance intensive. I have included a setting which will cause the AI to play indefinately against itself until you tell it to stop. This will provide much much more results then the first method.

The third is to help me program new algorithms for the AI to test. These algorithms will be either enabled or disbaled based on the AI, and hopefully will generate significant improvements. To help with this I suggest you apply to join the CCP forum where I plan to hold discussions on this. To do this go to this page.

The bad news:
Either way you run it there are a few requests/limitations. I've disabled almost all of the python events, as well as the python callbacks for performance reasons. This will mean that a rather large amount of mods won't work with this.

I'd also rather people not play with too obscure rules. While I would suggest you have it going on your standard settings (which, incidently, will push the AI to become better at your standard settings), I think some results would be counter-productive (only diplomatic victory enabled... or something).

Installation and Running:
An important thing here: This mod will only work correctly if installed in the My Documents mod folder (My Documents/My Games/SMC4/Mods). Why? I think it's probably because I can't understand how SimCutie's event manager works... either that or it doesn't work :p. I will work on getting it to work in the install directory for the next version. Simply unpack the contents of the .zip there. Please don't change the folder name of the mod - this will cause errors with file reading/writing. You will also need some AI data files which are posted in the following post (with additional instructions).

I've replaced the Dawn of Man screen with an AI selecter screen. This screen allows you to view stats of the AI's currently in your AI store, as well as allowing you to swap them in and out of the game (upon pressing continue having done this there will be lag while it re-organises things). The firaxis default AI should be in your store named "Firaxis Team". This should let the progress of the new AIs be judged.

To get the AI's to auto-play. The keyboard CTRL-SHIFT-X sets them off. The game will restart as soon as one team wins, and continue to play with a fresh set of AIs. On completion of each game the AI data will be saved, and you can pick up from this data with a new game whenever you like.

Known issues:
Sometimes when exiting automation mode the game gets stuck with a "Waiting for other Civilizations" message. To fix this, enable debug mode (CTRL-Z with cheat code set), and cycle through the players (CTRL-ALT-Z) until you get to the working one. Thanks to suspendinlight for this fix.

The CCP team - I used the project as a base as it already had quite a few of the things I needed included within it.
jdog5000 - his autoplay code is the core to the code which restarts each game upon completion.

Link to mod thread

Spoiler changelog :

*Big algorithm involving city specialization added
*AI names not displayed on scores instead of leader names.

*Added a few AI algorithms controlled by genetics
*Removed some AI variables that shouldn't have been changing
*Upgraded method for scoring cultural victories
*Many more misc. internal tweaks

*Changed the way that cultural ratings for the AI are worked out
*Updated file format
*Number of AIs per file increased to 24.
*Minor tweaks

*Impoved logic of data set completion popup
*Fixed UN - it now works.
*Hopefully fixed a crash on load

*Untracking AIs now works correctly
*Ranks now shown starting at 1 (instead of 0)
*Fixed a load script bug
*New data format.

*Several performance tweaks
*No more setting randomization
*Improved restart script - barbs now reinitiate correctly, contacts and vision are reset correctly.
*No more CTD on incorrect AI load. Instead it tells you that you have loaded them incorrectly.

*Fixed a bug where AI's getting wiped out would cause a python errror.

*Fixed a bug where one in three AIs would not build any units.
*Games needed for a complete test reduced from 10 to 8. As some sets are potentially being run twice this will increase speed.

*Fixed a loading bug meaning old files could not be loaded.

*Fixed a big bug not causing results to be recorded!

* Fixed a crash when selecting more then 7 players.
The Great Apple
First release
Last update
0.00 star(s) 0 ratings
Top Bottom