Latest Posts

Topic: News about AI

WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-05-26, 14:47

Tibor wrote:

I already spend some time finetuning my lists so I have some confidence in them. You did no testing, so I have no idea if they would work.

I don't know why they shouldn't work...

While working on AI I had so many good ideas and high portion of them just did not work.

"Good" ideas like early crystal mines, I guess face-wink.png

So I am always sceptical with new ideas.

And avoiding deadlock is bottom line target

Then the lists should look different, maybe... For example barbarians can become stone-deadlocked if they don't build a granite mine plus every related building which costs stone...

  • would you accept if 10 % of AI players got stuck on the begining?

No, never. A non-weak AI should be clever enough to avoid dead-locks in every case. It's sad that the current AI gets dead-locked so often if it has got "fortified village" and empire or atlanteans, especially atlanteans.

Also I dont believe in a silver bullets in AI development. I believe performance difference between your and mine lists would be about <5% of teritory growth.

Well, territory growth is not the best criteria. Maybe for "territorial time" in the end, but otherwise...

I dont know which one would be better, but as I said mine were tested and works...

As I said, atlanteans shouldn't build crystal mines early ;-) So I think I know which lists would be better face-wink.png

But if you trust your suggestion that much, spend some 5-10 hours of your spare time and do test them.

Accept it, I don't do testing... face-wink.png I've already watched a huge number of AI-matches, but I don't test any lists.

GunChleoc wrote:

I have created a PPA. Once it's finished building, you shoule be able to get it with:

~~~~ sudo add-apt-repository ppa:gunchleoc/widelands-ai-test sudo apt-get update ~~~~

If you have any other Widelands PPAs (e.g. the daily one), there might be conflicts - you can remove the old PPAs with

~~~~ sudo add-apt-repository --remove ppa:widelands-dev/widelands-daily ~~~~

Thanks a lot! But it didn't work, when I tried to use it... (Build 18 has been installed instead)

Are you sure that it should work or is it rather my fault? face-wink.png


Wanted to save the world, then I got widetracked

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-05-26, 17:47

I am getting Build 18 too - I have tried fiddling with the package recipe, so we can try again tomorrow.


Busy indexing nil values

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 1954
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-05-26, 19:12

I get the same problem – build 19 is installed instead of the development build.

I have a question about the current development status: I think hardcoded exceptions about the numbers of sawmills were mentioned. If I understood this correctly, this should be removed so I can test and compare lists with 1 and lists with 2 sawmills.

One more question: I want to write a Java program to help with the testing. The plan is for this program to start many different test games at once and take a screenshot of the Game Statistics window when the game is over. This would speed up testing a lot and also create lots of results so the statistics are more significant. Does anyone have some pointers about how to simulate mouse clicks or keystrokes in a window that belongs to a process started by a Java program?


Top Quote
Tibor

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

Basic buildings are defined in init.lua files like here:
http://bazaar.launchpad.net/~widelands-dev/widelands/ai-post-b19-2/view/head:/data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua#L34

So here you cannot define quantity. I was considering changing the syntax to
is_basic=1
I can do it if it will make sense to you. Later. Or just remove the exemption for sawmill.

To automate testing and measuring performance I have function that prints outputs like:

LOGS/test_4.log: 8 001:20:24: reviewing AI mngm. data, sc: 1007 Pr.p: 2 (l: 1008 / 0 / 99, at: 0( 0),ts: 0(0), Bigsp: 7)
LOGS/test_4.log: 9 001:20:24: reviewing AI mngm. data, sc: 1088 Pr.p: 1 (l: 1034 / 0 / 154, at: 0( 0),ts: 0(0), Bigsp: 0)
LOGS/test_4.log: 15 001:20:24: reviewing AI mngm. data, sc: 578 Pr.p: 1 (l: 576 / 0 / 102, at: 0( 0),ts: 0(0), Bigsp: 1)
LOGS/test_4.log: 13 001:20:25: reviewing AI mngm. data, sc: 1533 Pr.p: 2 (l: 1322 / 0 / 75, at: 36( 36),ts: 0(0), Bigsp: 0)
LOGS/test_4.log: 16 001:20:26: reviewing AI mngm. data, sc: 1019 Pr.p: 2 (l: 840 / 0 / 70, at: 9( 9),ts: 0(0), Bigsp: 7)
LOGS/test_4.log: 5 001:20:28: reviewing AI mngm. data, sc: 961 Pr.p: 1 (l: 932 / 0 / 129, at: 0( 0),ts: 0(0), Bigsp: 1)

The final number that is used here is "sc:" = score value... So 4 pararel games starts, lua script terminates them after x minutes and score values are parsed from logs and winning AI's DNA is used for next turn. So no simulation of GUI actions is needed...

"l:" shows size of land / 2

I can create something like this for you...


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 1954
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-05-26, 20:17

Tibor wrote:

Basic buildings are defined in init.lua files like here: http://bazaar.launchpad.net/~widelands-dev/widelands/ai-post-b19-2/view/head:/data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua#L34

So here you cannot define quantity. I was considering changing the syntax to is_basic=1 I can do it if it will make sense to you. Later. Or just remove the exemption for sawmill.

Changing the syntax to determine how many buildings of a type the basic economy needs would be perfect, but I already have something in mind to work around this for now. Removing the exception is certainly necessary.

To automate testing and measuring performance I have function that prints outputs like:

LOGS/test_4.log: 8 001:20:24: reviewing AI mngm. data, sc: 1007 Pr.p: 2 (l: 1008 / 0 / 99, at: 0( 0),ts: 0(0), Bigsp: 7) LOGS/test_4.log: 9 001:20:24: reviewing AI mngm. data, sc: 1088 Pr.p: 1 (l: 1034 / 0 / 154, at: 0( 0),ts: 0(0), Bigsp: 0) LOGS/test_4.log: 15 001:20:24: reviewing AI mngm. data, sc: 578 Pr.p: 1 (l: 576 / 0 / 102, at: 0( 0),ts: 0(0), Bigsp: 1) LOGS/test_4.log: 13 001:20:25: reviewing AI mngm. data, sc: 1533 Pr.p: 2 (l: 1322 / 0 / 75, at: 36( 36),ts: 0(0), Bigsp: 0) LOGS/test_4.log: 16 001:20:26: reviewing AI mngm. data, sc: 1019 Pr.p: 2 (l: 840 / 0 / 70, at: 9( 9),ts: 0(0), Bigsp: 7) LOGS/test_4.log: 5 001:20:28: reviewing AI mngm. data, sc: 961 Pr.p: 1 (l: 932 / 0 / 129, at: 0( 0),ts: 0(0), Bigsp: 1)

The final number that is used here is "sc:" = score value... So 4 pararel games starts, lua script terminates them after x minutes and score values are parsed from logs and winning AI's DNA is used for next turn. So no simulation of GUI actions is needed...

"l:" shows size of land / 2

I can create something like this for you...

Thanks, but no need. Better spend your time on the is_basic=1 face-smile.png

I find output like this is always hard to parse with a Java program. It will probably be easier just to automatically screenshot the game statistics and put them all into one image file, where I can compare them more easily. This also makes it possible to compare many different factors (I want to look at land size, productivity rates, number of wares, number of workers, number of buildings).

By the way, are forced_after and prohibited_till really still useful if there is is_basic? Or can they be removed?


Top Quote
Tibor

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

Exemption for sawmill removed, I will push the change in short time...

I can implement the counts for basic buildings, but take a note that the basic economy should be really basic - to avoid material shortage, and than AI should make own decisions... By my testing only sawmills were bottleneck. AI tries to build a productionsite if output is needed (and considering many other factors), but early on the begining of game it is not too smart to prioritize/postpone buildings in right order...

AI training is completely unattended, so no human interferes and makes decision... (just for explanation)

Forced_after and prohibited_till - this is a QUESTION. Ideally they should be completely removed, but based on your opinion you can use it. I suggest to wipe out all these entries for init.lua files and if it will work fine I can remove the code altogether later. But no need to hurry here...


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 1954
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-05-27, 20:50

Tibor wrote:

Exemption for sawmill removed, I will push the change in short time...

I can implement the counts for basic buildings, but take a note that the basic economy should be really basic - to avoid material shortage, and than AI should make own decisions... By my testing only sawmills were bottleneck. AI tries to build a productionsite if output is needed (and considering many other factors), but early on the begining of game it is not too smart to prioritize/postpone buildings in right order...

AI training is completely unattended, so no human interferes and makes decision... (just for explanation)

Forced_after and prohibited_till - this is a QUESTION. Ideally they should be completely removed, but based on your opinion you can use it. I suggest to wipe out all these entries for init.lua files and if it will work fine I can remove the code altogether later. But no need to hurry here...

I have some more questions and requests while preparing for testing (the PPA still doesn´t work, but I´m working on a way around that).

  • I will remove all forced_after and prohibited_till. What about the other flags, such as weak_ai_limit or mines_... ? Which of these are important, which obsolete?

  • One very important request: Could it be implemented that every ~30 minutes Game Statistics are printed out to the standard output in a very simple syntax such as: STATISTIC 1800 300:20:50:100:30|250:30:40:90:40 which gives information about every player´s Land:Productivity:Number of Wares:Number of Buildings:Number of Workers (players divided by |) at the given time (1800 seconds in this example) prefixed by a keyword like STATISTICS. This would be a huge help for me!

  • I will test 3 lists: Tibor´s presets (T), WorldSaviour´s lists (W) and my own idea, which I didn´t post yet. I repeat Tibor´s and WorldSaviour´s lists now. If I made a mistake, correct me!

    T-BAR: wood hardener, fernery, lime kiln, bakery, micro brewery, tavern, smelting works, metal workshop, farm, ironmine

    T-ATL: fisher, 2×sawmill, smokery, mill, bakery, farm, spiderfarm, weaving mill, crystalmine

    T-EMP: stonemason, 2×sawmill, bakery, vineyard, winery, tavern, farm, marblemine

    W-BAR: 2×wood hardener, lime kiln, well, tavern, smelting works, metal workshop, ironmine, fisher, 2×hunter, 2×gamekeeper (and/or can´t be implemented)

    W-ATL: 2×sawmill, well, farm, spiderfarm, weaving mill

    W-EMP: stonemason, sawmill, 2×vineyard, winery, tavern, marblemine, fisher, 2×hunter


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-05-27, 21:10

headdesk about the PPA.

Have you tried ./compile.sh -r -w -t? This will create a release build without any website stuff or translations, which will help cut down the memory use when the libraries are linked into the executable.


Busy indexing nil values

Top Quote
Tibor

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

So I implemented your statistics, it will look like:

STATISTICS 1 630 355:6:272:13:180
STATISTICS 2 630 478:13:265:22:186
STATISTICS 2 630 478:13:265:22:186
STATISTICS 3 630 503:9:257:23:186

It is per player - because each AI player prints own stat, it prints the stat quite frequently, so you will just pick the lines you are interested in... The order is player,seconds,land, productivity, NumbOfWares, NumbOfBuildings, NumbOfWorkers as you wanted...

Also I reworked "is_basic" syntax in init.lua files, see example:

http://bazaar.launchpad.net/~widelands-dev/widelands/ai-post-b19-2/view/head:/data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua#L34

*ai_limit entries should be preserved, they apply only to "weak" and "very weak". Also I reccomend to use on "normal" mode for testing...

Small huts like fisher, hunter, gamekeeper were not intended to be controlled by basic buildings, because they cost only wood, so AI will build them independently of "basic economy" status. This might be tweaked or re-thought as well..


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-05-28, 00:46

Nordfriese wrote:

  • I will test 3 lists: Tibor´s presets (T), WorldSaviour´s lists (W) and my own idea, which I didn´t post yet. I repeat Tibor´s and WorldSaviour´s lists now. If I made a mistake, correct me!

    T-BAR: wood hardener, fernery, lime kiln, bakery, micro brewery, tavern, smelting works, metal workshop, farm, ironmine

    T-ATL: fisher, 2×sawmill, smokery, mill, bakery, farm, spiderfarm, weaving mill, crystalmine

    T-EMP: stonemason, 2×sawmill, bakery, vineyard, winery, tavern, farm, marblemine

    W-BAR: 2×wood hardener, lime kiln, well, tavern, smelting works, metal workshop, ironmine, fisher, 2×hunter, 2×gamekeeper (and/or can´t be implemented)

    W-ATL: 2×sawmill, well, farm, spiderfarm, weaving mill

    W-EMP: stonemason, sawmill, 2×vineyard, winery, tavern, marblemine, fisher, 2×hunter

That's amazing! And I'm curious about your lists.

I thought again about the lists and want to do an upgrade (that "and/or" can't be implemented is not great, but maybe it's not that important. i didn't remove anything, but I added something) :

W-BAR: 2×wood hardener, lime kiln, well, tavern, smelting works, 2x metal workshop, ironmine, coal mine, fisher, 2×hunter, 2×gamekeeper

W-ATL: 2×sawmill, well, farm, spiderfarm, weaving mill

W-EMP: stonemason, 2x sawmill, 2×vineyard, winery, tavern, marblemine, fisher, 2×hunter

I added the second metal workshop because "basic economy" shouldn't block the construction of an ax factory.

Does anyone have suggestions for improving this lists which I proposed? I would appreciate feedback face-smile.png

As I said, current problems of the AI could spoil my lists a bit. For example:

The Atlantean AI builds a lot of guard halls, even in cases where it's a big mistake to build a guard hall instead of a tower. As the  costs of guard halls include one diamond, I can see why the current AI builds crystal mines early.

 Another mistake which doesn't concern my list that much, but which I want to mention: The barbarian AI likes it a lot to upgrade taverns and even inns in situations where it has only surface mines. Surface mines are more efficient than bigger mines, but taverns are also much more efficient to support surface mines than inns and big inns (especially if they don't use any bread).

I don't remember any mistakes of the empire AI which concern my list. But it does exactly the same mistake which I discovered at the barbarians. And it builds piggeries instead of fisher's/hunter's huts, even though piggeries are less efficient.

But even if the guard hall's could let the list look bad without the crystal mine, it could be good to test them. face-smile.png


Wanted to save the world, then I got widetracked

Top Quote