Latest Posts

Topic: AI-Training

stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2019-04-26, 11:34

I do have some questions regarding AI-Training.

In the data/ai-folder are 4 wai-files; do they represent the 4 AI-difficult levels? If so, which one is difficult and which one is easy? Or do they represent the 4 Tribes?

When starting AI-Training, I get new wai-files for each Computer player in ~/.widelands/ai. When the game is finished, do I replace the wai-files in data/ai-folder with the new one? And start new training with those?

The Instructions are not very clear in the wiki.


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-04-26, 11:52

stonerl wrote:

I do have some questions regarding AI-Training.

In the data/ai-folder are 4 wai-files; do they represent the 4 AI-difficult levels?

No, difficulty is rather achieved by building-number-limits

If so, which one is difficult and which one is easy? Or do they represent the 4 Tribes?

They don't represent the 4 tribes neither, the AI more or less ignores its own tribe.

afaik, the 4 files represent 4 different variations of AIs with different "genes". (and a new AI can pick genes from all 4 variations.)

When starting AI-Training, I get new wai-files for each Computer player in ~/.widelands/ai. When the game is finished, do I replace the wai-files in data/ai-folder with the new one? And start new training with those?

The idea is to select the best 1 or 2 of the 4 AIs in .widelands/ai and replace the 4 files in data/ai with those best AI(s). afaik.

The Instructions are not very clear in the wiki.


Wanted to save the world, then I got widetracked

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-04-26, 12:19

The training should look like - you pick a map with 4 starting positions and run it like 15 times, so you will have 15 wai files from position 1, another 15 from position 2 and so on.
Then from each 15 pick the best performing one and place it as a new source WAI file...
Of course there is not link between player starting post and source wai files....
Also keep in mind that generated wai is usually worse than one in source wai files, this is how genetic mutations work, only sometimes it can be better... this is why you should pick the best one from bigger group of generated WAIs....

Edited: 2019-04-26, 12:20

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-04-26, 12:25

Tibor wrote:

The training should look like - you pick a map with 4 starting positions and run it like 15 times, so you will have 15 wai files from position 1, another 15 from position 2 and so on. Then from each 15 pick the best performing one and place it as a new source WAI file... Of course there is not link between player starting post and source wai files.... Also keep in mind that generated wai is usually worse than one in source wai files, this is how genetic mutations work, only sometimes it can be better... this is why you should pick the best one from bigger group of generated WAIs....

What about doing the training on a periodical map (all starting positions fully equal), so one can pick the 4 AIs which are really the best?

For training of large maps, one could for example remove 12 starting positions from your map "Cycles", if the correct ones get removed, you get a great periodic 4 player map for large games.


Wanted to save the world, then I got widetracked

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-04-26, 12:58

By the way, "desert tournament" seems to be map with a lot of advantages for AI training:

  • starting positions are similar
  • first, each AI has to defeat an opponent at close range. In most matches, two AIs should be defeated before the winners meat each other in the long-range fight, so there are no unfair situations where several AIs attack one other together. And so the AI will not learn only close range fight or mid range fight, but both.
  • it's not easy to play on that map, so maybe an AI which can handle it can also handle easier maps?

if that is correct, one could create a similar map which is even better for training. Maybe one with even more difficulties, and also with seafaring? One map could possibly contain all kinds of difficulties, even though this could be extremely hard for the AI.


Wanted to save the world, then I got widetracked

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-04-26, 13:51

WorldSavior wrote:

What about doing the training on a periodical map (all starting positions fully equal), so one can pick the 4 AIs which are really the best?

This is what I was doing initially. Only problem here is that you need to have very diverse maps and we dont have enough various periodic maps... so you would run the game 4x (15 players in each game) and promote 4 winners


Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-04-26, 13:54

WorldSavior wrote:

By the way, "desert tournament" seems to be map with a lot of advantages for AI training:

  • starting positions are similar
  • first, each AI has to defeat an opponent at close range. In most matches, two AIs should be defeated before the winners meat each other in the long-range fight, so there are no unfair situations where several AIs attack one other together. And so the AI will not learn only close range fight or mid range fight, but both.
  • it's not easy to play on that map, so maybe an AI which can handle it can also handle easier maps?

if that is correct, one could create a similar map which is even better for training. Maybe one with even more difficulties, and also with seafaring? One map could possibly contain all kinds of difficulties, even though this could be extremely hard for the AI.

I am already using desert tournament for training - run it 9 times and pick best performer from each starting position. My PC allows to run 3 games in pararel, so one round is 20 minutes, so in one hour (3 rounds) you have new set (generation) of WAI files


Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2019-04-26, 14:16

Do they use the files from the data folder as a basis or is every run a start from 0?


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-04-26, 14:31

Tibor wrote:

WorldSavior wrote:

What about doing the training on a periodical map (all starting positions fully equal), so one can pick the 4 AIs which are really the best?

This is what I was doing initially. Only problem here is that you need to have very diverse maps and we dont have enough various periodic maps... so you would run the game 4x (15 players in each game) and promote 4 winners

Okay, the problem here is that the best AI could be "doubled" by a pair of other AIs, so it loses.

Tibor wrote:

WorldSavior wrote:

By the way, "desert tournament" seems to be map with a lot of advantages for AI training:

  • starting positions are similar
  • first, each AI has to defeat an opponent at close range. In most matches, two AIs should be defeated before the winners meat each other in the long-range fight, so there are no unfair situations where several AIs attack one other together. And so the AI will not learn only close range fight or mid range fight, but both.
  • it's not easy to play on that map, so maybe an AI which can handle it can also handle easier maps?

if that is correct, one could create a similar map which is even better for training. Maybe one with even more difficulties, and also with seafaring? One map could possibly contain all kinds of difficulties, even though this could be extremely hard for the AI.

I am already using desert tournament for training - run it 9 times and pick best performer from each starting position. My PC allows to run 3 games in pararel, so one round is 20 minutes, so in one hour (3 rounds) you have new set (generation) of WAI files

I'd rather pick the four best performers in total than the best performer from each start spot.

stonerl wrote:

Do they use the files from the data folder as a basis

yes

or is every run a start from 0?

no


Wanted to save the world, then I got widetracked

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-04-26, 14:54

stonerl wrote:

Do they use the files from the data folder as a basis or is every run a start from 0?

Yes


Top Quote