Latest Posts

Topic: News about AI

Ex-Member
Avatar
Joined: 2014-09-12, 10:53
Posts: 184
Ranking
Widelands-Forum-Junkie
Posted at: 2017-08-05, 13:21

The source package contains data/ai with 4 files in it, the build package does not contain the folder, adding the folder and files manually does not help. On first run a folder ai is created in ~/.widelands but is empty, adding the 4 files manually to that folder allows the game to run.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-05, 16:05

From linux perspective two folders are relevant here:

 /usr/share/widelands/ai

and

 /home/tibor/.widelands/ai

First one is to be created by installer with 4 mentioned files - they should be read-only (as other data files), unless you manually manipulate with them as a part of training

Second one will contain files like: 2017-07-31T23.44.07_ai_player_15.wai created during ai initialization.

The format is exactly the same.

I am not familiar with the installer logic and locations on other platforms so cannot help with polishing this.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2434
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-05, 16:19

Tibor, i think the ai-folder has to be added to CMakeLists.txt? See http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/CMakeLists.txt#L265


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-05, 16:26

kaputnik I COULD SWEAR I added it there, probably I forget to copy updated CMakeList.txt to branch and upload.

I will prepare new branch and ask for merge


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-05, 16:34

New branch created, and proposed for merge...

BTW I will be offline next week


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2434
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-05, 20:00

No Problem Tibor face-smile.png

Things get overlooked some times. Also in the code review.

Second one will contain files like: 2017-07-31T23.44.07_ai_player_15.wai created during ai initialization.

Close after starting a new game, i guess this the time when ai initialization is done, this folder remains empty on my system. The console output is then:

ComputerPlayer(1): initializing as type 2
 1: DNA initialization... 
    ... Primary parent: 0, secondary parent: 1
    ... DNA initialized
 1: mutating DNA with probability 1 / 128:
      Neuron  3: weight:   47 ->   79, new curve: 2   
      Neuron 45: weight:  -12 ->  -40, new curve: 1   
      Neuron 66: weight:  -39 ->  -39, new curve: 0   
      F-Neuron  6: new value:    4251386950l, changed bits:  1   
      F-Neuron 10: new value:    1804139160l, changed bits:  1   
      F-Neuron 20: new value:     127153596l, changed bits:  1   
      F-Neuron 29: new value:     117898422l, changed bits:  1   
      F-Neuron 38: new value:    1159021716l, changed bits:  1   
      F-Neuron 42: new value:    2045650228l, changed bits:  1   
 1: Initializing in the basic economy mode, required buildings:
    56 / barbarians_tavern        - target 1
    50 / barbarians_reed_yard     - target 1
    49 / barbarians_lime_kiln     - target 1
    42 / barbarians_rangers_hut   - target 1
    58 / barbarians_smelting_works- target 1
    41 / barbarians_lumberjacks_hut- target 1
    48 / barbarians_wood_hardener - target 1
    44 / barbarians_hunters_hut   - target 1
    62 / barbarians_metal_workshop- target 2
    45 / barbarians_gamekeepers_hut- target 1
    63 / barbarians_barracks      - target 1
    46 / barbarians_well          - target 1

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-05, 20:29

Very weird, there should be line like:

2: AI to be dumped to ai/2017-07-31T22.09.22_ai_player_2.wai

going to investigate


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-05, 20:57

I figured it out, there is "aitrainingmode" and when it is ON, the ai files are created. By default it is OFF. So philosophical question:

Should be new AI files generated only in aitrainingmode mode, or always?

There is a plan for command line switch "aitrainingmode", but now it is hardcoded (recompilation needed to change it)

Edited: 2017-08-05, 20:57

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-06, 10:24

We have some issues with the new branch for adding AI folder to data dir:

https://code.launchpad.net/~widelands-dev/widelands/ai_cmakelist/+merge/328630

Perhaps windows build needs more than changes to cmakelist.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2434
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-06, 11:51

Should be new AI files generated only in aitrainingmode mode, or always?

I think this depends on how the AI is learning. Can you explain what the new generated AI files in ~/-widelands/ai are used for and what the difference is in regard to the shipped files?


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote