Latest Posts

Changes in Ai Training

Editor Comment

Proofreading.


Revision Differences of Revision 4

[TOC] ¶

##
The Genetic algorithm in wWidelands ¶

Up to Build 19 (including) the AI was fully rule-based. Internally
, it used a lot of constants that had to be fine-tuned by hand - and that was time consuming for the developers. So, we are in the process tof switching to a genetic algorithm where numerical constants are to be fine-tuned by a random process (mutations) + and the best mutations must be selected by a supervisor. Theis process is to be referred to as "AI training". ¶

## How
isthe AI's DNA is stored ¶

The numbers used by
the DNA are stored in separate text files with the suffix `wai`. STherefore, the training does not require recompilation but only copying the files. There are two location for these files:

* data dir - contains 4 wai files representing 4 individuals with slightly different DNA ¶
* home dir - can contain dumped DNAs from initialized DNA players. Those files tend to be unique, due to
a high "searching space". DThey also depending alson onthe Mmutation rate. ¶

## Training mode ¶

While
the DNA is mutated (and a unique DNA created) with each initialization of the AI player, it is usually not dumped in the home folder. So, there is a command line switch "`--ai_training"` to activate it. IThis switch will also increases the mutation rate. ¶
S
The s
econd usefull switch is "`--auto_speed"` that winll rkealtimep adjustsing the speed of the game bin reasl-timed, oin FPSorder to keep ithe current FPS around 14. The idea is to speed the game up as much as possible without badly affecting the AI due to lag. ¶

## Is
the AI really trained during the game? ¶

No, no actual training
neitheor learning is taking place. The learning here is just picking best AI from a group of randomly generated AIs, and copying it to the data folder, so that they could be used as a source for the next game.... CThis can be done by a human, or automated by a script based on score or soetc... ¶

## Content of wai files ¶

The format of source and output wai files are exactly the same, when you open them you will see
a 4 arrays of integers.