Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Latest Posts

Topic: News about AI

Forums » Player Forums » Game Suggestions » News about AI



Tibor
Joined: 2009-03-23, 23:24
Posts: 904
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-16, 21:05

For me when looking at this we should distinguish what buldings were built as a part of "basic economy" buildings and what were built based on genuine AI decision.

As for well, the basic question is if there was indeed shortage of water. Probably yes, if you think that one well could not be enough.


Top Quote
soulless
Avatar
Joined: 2017-04-09, 13:20
Posts: 22
Ranking
Pry about Widelands
Posted at: 2017-07-16, 23:21

Tibor wrote:

For me when looking at this we should distinguish what buldings were built as a part of "basic economy" buildings and what were built based on genuine AI decision.

As for well, the basic question is if there was indeed shortage of water. Probably yes, if you think that one well could not be enough.

One well could never be enough face-wink.png Also the well was built very early in the game and a well will have a production rate of 100% at the beginning but this will fall down as there is less water after some time. But to give some values I watched the replay again and opened all warehouse and the headquarter. After 4 hours, the time where I started to overrun them, Barbarians had about 250 wheat in in those buildings and 0 water. Empire had after 3 hours (there I was a bit faster because barbarians was the second game and I thought that this could be boring so I made a few mistakes like building no barrack) had 53 water and 280 wheat .... but there was the problem that no one needs bread or beer because no armor smithy no need for iron no need for ration and so on.

As the economy in those strategy games is mostly counting if one plays it a few times I also think that this basic economy should be extended. There were no problems with building material because vineyard and winery and so on were built early. I now think of something like this:
building_economy
basic_economy
extended_economy
where for empire
building_economy is mainly what now is basic_economy, so
1 winery, 2 vineyards, 1 tavern, 1 sawmill, 1 stonemasons house, 1 barrack
and than basic_economy is
building_economy - 1 tavern, + 2 Inn, + 1 sawmill, + 1 mill, + 2 bakery, + 2 brewery, + 1 donkeyfarm, + 2 smelting_works, + 1 toolsmithy, + 1 weaponsmithy, + 1 armorsmithy, + 1 vineyard
and than extended_economy is
basic_economy + 1 Inn, + 2 mill, + 3 bakery, + 1 brewery, + 2 weaponsmithy, + 2 armorsmithy, + 4 smelting_works, + 1 sheepfarm, + 1 weaving_mill, + 1 vineyards, + 1 winery
That is mostly what I do every time .... if I have not forgotten something face-wink.png I never look at the stock, only for water, wheat and meat / fish and build up farm and piggery and well as needed (and found building spots on the map) to have enough of this.
I also think that with those values you have a normal ai, for weak ai reduce every needed count > 1 by 1 so only 1 smelting_works in basic_economy instead of 2 and so on and for very weak only build basic_economy and no extended_economy.
This should be at least enough for a strong ai and also give an option for weak and very weak ai. Mines I would only add those needed for building material in building_economy, so 1 marble mine for empire and 1 crystalmine for atlanteans and the rest as needed (and found). So that the ai will not go from building_economy to basic_economy without needed mines but from basic to extended_economy without counting available mines.

  • edit corrected a few counts
Edited: 2017-07-16, 23:29
Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 904
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-17, 08:54

The basic principle here is that all buidlings are anonymous, AI knows only:

  • inputs
  • outputs
  • build costs
  • production statistics
  • if outputs are needed
  • preciousness

And based on this value it should make a decision what to build.

I am against creating lists of buildings per tribe - with only exemption of basic buildings.

Because there are so many possibilities how a map can differ.

But I can look at savegames, to see if there is anything what must be fixed manually - outside of training of AI


Top Quote
soulless
Avatar
Joined: 2017-04-09, 13:20
Posts: 22
Ranking
Pry about Widelands
Posted at: 2017-07-17, 10:49

Ok, I think that a working economy is the same on every map, on small maps a basic_economy is mostly enough and on bigger ones (and The far north is big in this context) a extended . But that is only my opinion based on my strategy face-wink.png

Yesterday evening I also tested a quick game vs Atlanteans and they also only built one well. After 3 hours they have 0 water in warehouse / headquarter and 400 corn (and enough blackroot, didn't count that). They also, like empire, don't built any smelting works, armorsmithy and weaponsmithy. The water was used in spiderfarm. Perhaps there is a problem related to the upgrade-path metalworkshop -> ax-workshop -> warmill which only the barbarians have. Don't know the code but there is some logic if only the tribe with an upgrade-path built any weapon-producer.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 904
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-17, 12:08

Some maps can be limited in space, some maps can lack mines (or particular mine), sometimes the enemy is close, sometimes far, so I think hardcoding is not the best way to go..

It is hard to debug ex post. I can insert there some printf and see if AI considers such building at all and what score it gets, but this is not possible with replay...


Top Quote
soulless
Avatar
Joined: 2017-04-09, 13:20
Posts: 22
Ranking
Pry about Widelands
Posted at: 2017-07-17, 15:16

But if empire ai don't get a building_economy with at least
1 winery, 1 vineyards, 1 tavern, 1 sawmill, 1 stonemasons house, 1 barrack
and a basic_economy with at least
- 1 tavern, + 1 Inn, + 1 mill, + 1 bakery, + 1 brewery, + 1 smelting_works, + 1 toolsmithy, + 1 weaponsmithy, + 1 armorsmithy
the ai will do nothing at all. No new building, no new soldiers -> no working ai. The values for building, basic and extended economy must of course get tested if one hardcodes those values. They are in .lua-files so that should not be the problem. But of course perhaps there is another and better solution.

So If you add those printf and tell me what revision to use, what argument I need to start to get the statements and for what statements I must grep I will play some games again and give you the output. I'll be a good slave because I would like to have a good ai to fight in boring times face-wink.png


Top Quote
soulless
Avatar
Joined: 2017-04-09, 13:20
Posts: 22
Ranking
Pry about Widelands
Posted at: 2017-07-17, 16:57

After sending my last post I thought: hey, lua-files, basic ... let's just add basic_amount = 1 to armorsmithy, toolsmithy, smelting works and weapon smithy and play a quick game with no fog and that helps a litte. The ai generates new soldiers and also a trainer for the arena. But the problem with only one well remains. Did not watch the replay so no values but as there was only 1 well and the ai only generates a few new soldiers and only a handful of arena-trained soldiers I don't think this is necessary.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 904
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-17, 21:03

soulless wrote:

But if empire ai don't get a building_economy with at least
1 winery, 1 vineyards, 1 tavern, 1 sawmill, 1 stonemasons house, 1 barrack
and a basic_economy with at least
- 1 tavern, + 1 Inn, + 1 mill, + 1 bakery, + 1 brewery, + 1 smelting_works, + 1 toolsmithy, + 1 weaponsmithy, + 1 armorsmithy
the ai will do nothing at all. No new building, no new soldiers -> no working ai. The values for building, basic and extended economy must of course get tested if one hardcodes those values. They are in .lua-files so that should not be the problem. But of course perhaps there is another and better solution.

So If you add those printf and tell me what revision to use, what argument I need to start to get the statements and for what statements I must grep I will play some games again and give you the output. I'll be a good slave because I would like to have a good ai to fight in boring times face-wink.png

But I dont need any logs, I can generate hundreds of MBs of them. I wanted it for you to better understand what is going on.

Also I dont think we have anything like building_economy and I dont think that hardcoding is a good way. The problem are corner cases. And there are always corner cases.

What I intend to do is to start training again, prepare map similar to your map (but with e.g. 14 players) and start training for few generations. If there will be no improvement, some deeper change in code or DNA will be needed.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 88
Ranking
Likes to be here
Posted at: 2017-07-17, 22:03

Due to the hint to watch the replays I watched the replay from my last game to test the frisians where I deemed the opponents very weak.
Observations were:
empire AI (in yellow position on comet island): - expanded in a rather reasonable manner, although keeping to much small military buildings far away from the border.
- all basic buildings for a building infrastructure were build. further buildings were build in almost reasonable manner.
- in the complex empire economy some key buildings were not build at all over more than 2 hours:
a) tool smithy not build although roughly 5 types of tolls ran out and 2 forresters could not be manned
b) smelting works not build although iron ran out in the weapon smithy
c) brewery not build although iron mine and coal mine down to zero
d) bakery was built but no mill so bakery was useless
e) marble columns ran out due to marble ran out ( had to be harvested from quarry mostly) ai solution was to build another stonemason
f) after having used the first marble in a small mining plot the marble mine was not upgraded. Instead second basic mine was build. which ran out immediately and wasn't upgraded too.

so from this it looks like as if the deciding algorithm what to build next based on shortage of wares could have some gaps within the empire tribe. Furthermore if possible deciding could be improved by taking into account productivity of existing buildings of the same type (if lower than threshhold don't build the next building.). As well the production chain should be taken into account ( is there already a building for each input?). If a building is producing more than one ware it should be build if one of them is down to 0 (toolsmithy).
I don't know how the Ai expands but it might result in more competitve ai to expand in direction of ressources which are known by the ai.

Just my five cents hessenfarmer


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 904
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-17, 23:00

hessenfarmer wrote:

Due to the hint to watch the replays I watched the replay from my last game to test the frisians where I deemed the opponents very weak.
Observations were:
empire AI (in yellow position on comet island): - expanded in a rather reasonable manner, although keeping to much small military buildings far away from the border.
- all basic buildings for a building infrastructure were build. further buildings were build in almost reasonable manner.
- in the complex empire economy some key buildings were not build at all over more than 2 hours:
a) tool smithy not build although roughly 5 types of tolls ran out and 2 forresters could not be manned
b) smelting works not build although iron ran out in the weapon smithy
c) brewery not build although iron mine and coal mine down to zero
d) bakery was built but no mill so bakery was useless
e) marble columns ran out due to marble ran out ( had to be harvested from quarry mostly) ai solution was to build another stonemason
f) after having used the first marble in a small mining plot the marble mine was not upgraded. Instead second basic mine was build. which ran out immediately and wasn't upgraded too.

so from this it looks like as if the deciding algorithm what to build next based on shortage of wares could have some gaps within the empire tribe. Furthermore if possible deciding could be improved by taking into account productivity of existing buildings of the same type (if lower than threshhold don't build the next building.). As well the production chain should be taken into account ( is there already a building for each input?). If a building is producing more than one ware it should be build if one of them is down to 0 (toolsmithy).
I don't know how the Ai expands but it might result in more competitve ai to expand in direction of ressources which are known by the ai.

Just my five cents hessenfarmer

As I said above, I am going to resume training of AI and try to find out what is wrong - then either AI will learn or I will have to do some manual changes into code.

AI takes so much inputs into decision making, but it must to learn to properly weight them - this is long process.

And if we put apart idea of manual training (I dont believe there is a person who can play 100+ games in one week) all is depending on available machine - and this is my home PC that cannot run 24/7.


Top Quote