Latest Posts

Topic: AI-Training

Tribal-Chief
Avatar
Joined: 2018-12-09, 17:16
Posts: 62
Ranking
Likes to be here
Posted at: 2019-04-29, 11:07

I have worked for years developing AI for other programmes and see some serious flaws with the system being attempted with WL.

There are a couple of important factors with WL AI, different tribes with different supply chains, differenr maps with varying starting conditions, and what does not seem to be considered yet different start settings and different win conditions.

Until the AI player knows how to react to differing win conditions any work done is pointless. From my experiments the AI cannot cope at all with harder starting setups, they can sometimes play Village but anything harder just leaves them blocked within a few minutes.

AI hints are supposed to adapt the general AI rules to tribe specific rules but they fail spectacularly in many cases. With after the wood gnomes map, which has thousands of trees to be cleared to build anything, the AI starts by building forresters, Epire have a granite mine as a basic building but having built it but before it is manned it will often build a second mine as the first is not producing, it builds it next to the first and that will probably not produce as the vinyard it builds is often surrounded by roads so has no work place.

To produce an AI that can actually play WL the first requrment is to know how to play different win conditions, secondly how to cope with different start settings then it needs to either have separate tribe specific rules or a better implementation of AI hints. At that point you can test if there needs to be any map specific settings.

In an ideal world just playing should produce AI changes on your system, the programme itself should work out if the changes were good and update your AI files, when playing online players would automatically swap their best AI files eventually producing AI players that are indistinguishable from human players.

I am sorry to say I have no time free to work on this this year.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2019-04-29, 13:00

Although I agree that the current AI has some flaws (most of them have been correctly identified by Tribal-Chief) I do not fully agree to the solution / topics to work on.

I agree on:
- Biggest flaw is AI road building, which is chaotic and often blocks small spaceconsumers (vine yard, reed farm). I would love to have an A* algorithm here which is already used in some other functions.
- Also big flaw is that AI doesn't know about win conditions (in principle this would be achievable by choosing the correct fitness function for this win condition resulting in wincondition dependent AI values with all the effort needed to train in this direction)
- Training while playing could be an option: this would have the existence of a proper fitness function as a prerequisite. So if we could make an automated fitness function for an AI we could encourage players to switch on "training mode" to produce and evaluate AI files.

I don't agree on:
- AI needs to be able to play starting conditions with hard settings. As for my understanding they are made to make life harder for human players which would be contradicted by setting the AI back to them as well.
- AI hints are failing often and spectacular. Building a forester where no one is needed is no fail it is just a supoptimal decision. Building none where one is required would be a fail. AI hints are set to be on the safe side to prevent deadlock. These might be to conservative on some maps.

The described behaviour of the empire regarding second marble mine is a problem indeed, but should not be that frequent. However having mines in basic economy is a problem as we can't guarantee mountains nearby. there is definitely room for improvement and any ideas fitting into the current system are welcome I believe. Vine yard surrounded problem is part of the Road algorithm problem.

Edited: 2019-04-29, 13:50

Top Quote
Tibor

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

The current state of AI is that it ignored starting conditions and win condition. E.g. we have "basic buildings" concept and if we want to adjust to different starting condition first thing we would need is specific basic buildings for each condition. This is 80% of success. Also different win conditions - this is for further discussion.

My opinion until we have good playing "general conditions AI" it is too soon to bother with wind conditions and so on...

AI makes thousands (or at least hundreds) decisions during gameplay and I see no way how every single could be real-time scored and evaluated as good or bad. What we can do is only some "general evaluation", without analyzing what decisions helped or hurt that final result. If you have an idea how to evaluate decisions like: "in 1:23:45 we attacked building at 12x23 with 8 soldiers", or "in 0:12:34 we built ranger on 98x67" just say your opinion.

BTW what is the game you have experiences with?


Top Quote
Tibor

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

hessenfarmer wrote:

  • Biggest flaw is AI road building, which is chaotic and often blocks small spaceconsumers (vine yard, reed farm). I would love to have an A* algorithm here which is already used in some other functions.

I think the A* is not relevant here. Because A* is already used. What is needed is some "damage points" and each field the road goes through (or intended road) should sum there damage points - also damage points of nearby fields as the road usually degrades nearby fields. In fact AI already considers building capabilities of crossing fields, but this is not enough. The main problem is performance here. Keep in mind that AI builds only small part of calculated roads, so the calculation costs / effort might not be visible for an observer

Edited: 2019-04-29, 13:54

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-05-01, 16:48

Tibor wrote:

For training you don't need ability to compile. However e.g. on Linux you need x-server or the game will not even start....

how do you mean that, x-server?

Tibor wrote:

WorldSavior wrote:

Is this really better than training the AI on one very hard map which contains most possible problems? It sounds very ineffective that the map gets changed all the time.

I think it is close to impossible to come up with such map. I think AI needs to be trained on different terrain layouts and with different distance to enemies and so on...

Cannot different distances be covered by maps like desert tournament? And why shouldn't the different terrain layouts be on one single map?

hessenfarmer wrote:

I agree on: - Biggest flaw is AI road building, which is chaotic and often blocks small spaceconsumers (vine yard, reed farm). I would love to have an A* algorithm here which is already used in some other functions.

I'm not sure if I agree here. If the AI would breed carrier animals the road network could still be good enough to handle the poor amounts of wares which the AI produces.

I don't agree on: - AI needs to be able to play starting conditions with hard settings. As for my understanding they are made to make life harder for human players which would be contradicted by setting the AI back to them as well.

+1

Tribal-Chief wrote:

I have worked for years developing AI for other programmes

Oh really? Which programmes exactly?


Wanted to save the world, then I got widetracked

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2019-05-01, 16:57

WorldSavior wrote:

Tibor wrote:

For training you don't need ability to compile. However e.g. on Linux you need x-server or the game will not even start....

how do you mean that, x-server?

x_server is the software providing a windowed gui on linux I guess. So without this the game won't start. i think this answer was related to my suggestion to use the widelands server for training.

Tibor wrote:

hessenfarmer wrote:

I agree on: - Biggest flaw is AI road building, which is chaotic and often blocks small spaceconsumers (vine yard, reed farm). I would love to have an A* algorithm here which is already used in some other functions.

I'm not sure if I agree here. If the AI would breed carrier animals the road network could still be good enough to handle the poor amounts of wares which the AI produces.

What I meant is that the AI is blocking a lot of spots by its weird road layout. I think the problem is that Ai is only calculating path cost from unconnected flag to connected flag found and it should calculate path cost to nearest warehouse. this might help probably.

Edited: 2019-05-01, 16:57

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2019-05-01, 16:58

Tibor wrote:

My opinion until we have good playing "general conditions AI" it is too soon to bother with wind conditions and so on...

I fully agree to this.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-05-01, 17:04

hessenfarmer wrote:

WorldSavior wrote:

Tibor wrote:

For training you don't need ability to compile. However e.g. on Linux you need x-server or the game will not even start....

how do you mean that, x-server?

x_server is the software providing a windowed gui on linux I guess. So without this the game won't start. i think this answer was related to my suggestion to use the widelands server for training.

I redesigned the sound system on current trunk so we can start without loading that, but we still load the graphics. I don't want to touch the graphics right now, because I have too many related open branches that would conflict with a change there.


Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-05-02, 07:14

GunChleoc wrote:

I don't want to touch the graphics right now, because I have too many related open branches that would conflict with a change there.

there is one interested aspect here - game autospeed is calculated based on game FPS, so I dont know how deep with removal of graphics you plan to do....


Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2019-05-02, 07:18

hessenfarmer wrote: What I meant is that the AI is blocking a lot of spots by its weird road layout. I think the problem is that Ai is only calculating path cost from unconnected flag to connected flag found and it should calculate path cost to nearest warehouse. this might help probably.

I understand, but that means AI will need to calculate also road distance from 1-5 candidate flags to nearest warehouse..... This means CPU utilization... while candidate flags are gathered with one A* algorithm, this would mean additional 1-5 (depending on candidate flags count) A* algorithms. Or rethink it somehow completely...


Top Quote