Currently Online

Latest Posts

Topic: News about AI

Tibor

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

PkK wrote: In this savegame, it was the Atlantean players that stopped expanding, while Barbarians and Empire continued to expand.

Philipp

OK, so perhaps atlanteans only needs to tweak basic buildings list...


Top Quote
Tibor

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

I looked again at the whole problem, but I think this is how it is. Some training would help (I will continue in it after merging into trunk) - but generally there is no obvious problem that could be fixed in the code....


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-04, 15:57

Finally, the new AI got into trunk.

The change is quite big so especially power players will notice a difference. As I said before, the bigger bottleneck is training of AI, on my home PC it goes very slow, but I will go on with training with next weeks and months.

Also there are some details remaining to implement, the idea is to allow anybody to train own AI based on own custom maps. I know this is not going to be extensively used, but should be technically possible (without manipulating source files and recompiling).

Another thing is balancing normal - weak - very weak AI players. It would be fine to have some benchmarks to be sure that gaps between them are appropriate, I made no tests in this regard.


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: 2017-07-05, 21:21

Tibor wrote:

Also there are some details remaining to implement, the idea is to allow anybody to train own AI based on own custom maps. I know this is not going to be extensively used, but should be technically possible (without manipulating source files and recompiling).

That sounds good!


Wanted to save the world, then I got widetracked

Top Quote
Ex-Member
Avatar
Joined: 2014-09-12, 10:53
Posts: 184
Ranking
Widelands-Forum-Junkie
Posted at: 2017-07-14, 11:20

Are these changes in 8401? I did not see a great difference in the last week I have been testing several maps, tribes and win conditions.

I tried first barbarians against imperial on the Far North map with collectors. To win you need to avoid spending gold on buildings and avoid using valuable weapons on upgrading soldiers which means avoiding the enemy, I spent 2 hours building a stable economy and had just started gold mining, my score was in the 40's and the enemy was stuck in the 20's. I noticed just after this their score dropped to 0, which meant they had used their starting gold to build training camps and were probably recruiting soldiers, I built a barracks to counter them and as soon as I noticed a sentry being built near my gold mines (protected by a fortress and some barriers) I added a battle arena. It was time to test their power so I attacked the two sentries I could see with three soldiers to each one, I discovered another sentry behinf and sent three more to that one and the tower guarding them was found and I sent 6 soldiers there. As the tower sent out 3 soldiers to defend the sentries I sent one more to each sentry attack. I won every attack although I lost half of my forces. What I missed, which was an AI improvement, was that during the attack they sent three soldiers to a barrier of mine over the mountain, four soldiers from there were in my attack party, they capured it which destroyed my just completerd arena and cut my gold mine off from the rest of my economy. As they were isolated it was easy to recaptur the barrier. I noticed from the captured tower they built a lot of senries along the border but they were never manned, as I swept through their territory I found the had not built a barracks, they had two training sites but never trained any soldiers and most military buildings only had one soldier.

Other tests with other maps produced similar results, the win condition made no difference, they grew at bit and then stagnated, they never recruited soldiers or trained them much. One thing I did notice was if I attacked and lost they would often attack me at a site where I only had one defender left, a good move, apart from the fact they usually sent two or three soldiers with about 10% health left against my one fully fit defender.

I never bothe with weak or very weak AI, they are to easy to beat on normal level.

Edited: 2017-07-14, 11:22

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-14, 12:17

Hi,

it was merged in 8397 (July 04). If you see the difference, you must had been using older versions.

Generally I intend a lot of training before offcial release, though now I do nothing as I am waiting for completion some features (writing/loading AI's DNA into files). So this performance will be improved over time.

I am not familiar with collectors score, because AI does not distinquish various game modes. It could but separate training would be needed and separate sets of DNA. So AI is trained with combined goal territory+military strenght.

What you describing is that you two exhausted themselves but you had an edge and won. Pretty common.

You mentioned trainingsites - this is exactly what needs huge amount of training.

Also note that there are 4 DNA in the code and they are picked randomly, so next time it can behave slightly differencly.

Note that attacking sites is very rough, AI considers actual soldiers there, nearby militarysites, but cannot consider territory layout and nearby production/trainingsites (it never could). So what you appreciated is sheer luck of AI - it saw undermanned site and attacked it.

I wish one thing - I have 100 slaves who would play against AI over and over and train it. Because if the ~ same AI fights each other it leads to 'reinfoced idiosyncrasies'.


Top Quote
PkK

Joined: 2012-01-06, 12:19
Posts: 236
Ranking
Widelands-Forum-Junkie
Posted at: 2017-07-14, 14:05

Tibor wrote: I wish one thing - I have 100 slaves who would play against AI over and over and train it. Because if the ~ same AI fights each other it leads to 'reinfoced idiosyncrasies'.

If you say that in somewhat politer words, and make it easy to do so (e.g. by providing a command line option or a checkbox in the game start screen) there might be many people willing to provide AI training data when playing a game against the AI anyway. Also, the requirements should be clear - i.e. required game mode, if the game needs to be played to the end, etc.

Philipp


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-07-14, 15:18

PkK wrote:

Tibor wrote: I wish one thing - I have 100 slaves who would play against AI over and over and train it. Because if the ~ same AI fights each other it leads to 'reinfoced idiosyncrasies'.

If you say that in somewhat politer words, and make it easy to do so (e.g. by providing a command line option or a checkbox in the game start screen) there might be many people willing to provide AI training data when playing a game against the AI anyway. Also, the requirements should be clear - i.e. required game mode, if the game needs to be played to the end, etc.

Philipp

Please look here: http://bazaar.launchpad.net/~widelands-dev/widelands/ai_dna_dump/files/head:/data/ai/

These files contains entire DNA of ai. The logic is (to be)

  • you play the game
  • decide which one (or more) player was best
  • copy its output file from your home folder (the files are generated during AI initialization for each player), to location as in link above
  • go on with next game and repeat

This is doable, BUT!!!! the results are not mergeable!!!! You can not receive these files from multiple sources and merge them together for "stronger" AI.

Also testing on multiple map types is needed, because AI can overspecialize and then perform poor on other type of maps. But this is general problem.

Edited: 2017-07-14, 15:30

Top Quote
Ex-Member
Avatar
Joined: 2014-09-12, 10:53
Posts: 184
Ranking
Widelands-Forum-Junkie
Posted at: 2017-07-15, 10:34

Some win conditions would need a different AI process I think, but initially improving general performance is good, most players seem to play autocrat by default.

I would not be averse to being an AI training slave but as Pkk said the instructions need to be clearer. I am not sure what the files you link to are, what file is created in my home folder? I assume I need to do something other than just start a game to get the file created.


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

A question about the tables the AI demands in every tribe´s tribename.lua file. While implementing the Frisians, I just pulled and merged the latest changes from trunk, so now I´m working with the new AI. I found I had to add mappings for the tables:

barracks = "frisians_barracks",
bakery = "frisians_bakery",
ironore = "iron_ore",
rawlog = "log",
refinedlog = "brick",
granite = "granite",

I´m not entirely sure what these mappings are supposed to do. Particularly refinedlog – Frisians do not refine logs, they improve granite using coal and clay, which is made from water. And I´m unsure about the role of the bakery, as basic soldier training needs bread, but advanced soldier training and deep mining need honey bread from the honey bread bakery (an enhanced form of the bakery, and it does not bake ordinary bread).

What are the new tables used for and what are the best mappings for the described situation?


Top Quote