Currently Online

Latest Posts

Topic: Improving the AI

Tibor
Joined: 2009-03-23, 23:24
Posts: 1332
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-02-11, 13:01

Are you sure that this behavior is new?

EDIT:

Of course I will run some training after your changes..

Edited: 2020-02-11, 13:02

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-11, 14:06

Tibor wrote:

Are you sure that this behavior is new?

Which one?
the 2 coal mines built are new, as I always saw the AI struggling for coal which gave frisians an advantage over the other tribes due to them being able to produce charcoal more efficiently. So this really jumped to my eyes. Only thing might be it resulted from a mutation which is just coincidental.
Marble mine ais also evident in gameplay as empire now builds only 1 as defined in basic economy while Atlanteans build 2 crystal mines as defined in the AI Code for BuildMatProducer (Although they were removed from basic economy). This could be optimized further as most of the time they only need one of these mines, this isn't criritcal however as long as the workers get released from coal mines if we have no occupied ironmine.

EDIT:

Of course I will run some training after your changes..

that was what I had recommended in any case thanks for the offer.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-11, 21:33

hessenfarmer wrote:

Ok,
I implemented the check for raw_build_material and removed the definition of rawlog and granite. This worked ok in first tests.
1. First observation is: the imperial Marble mine is no longer a critical mine now as marble can be obtained (although in low quantities) from quarries. This is covered by having a marble mine in basic economy though and did not work that bad in the tests.
2. Second observation: For whatever reason AI now starts with 2 coal mines instead of 1 before the change. I have no explanation for this yet though. Furthermore it does not dismantle a coalmine if a critcal mine needs some workers, as it should be. This is bad for atlanteans as they get deadlocked on Full Moon without this feature currently I believe the problem is within the detection of critical_mine_unoccupied as the AI tends to always build 2 of them while the the check assumes there is only one.
3. Due to my research for 2. I beleive it is more efficient to evict workers instead of dismantling to achieve the workers released. So I'd like to change dismantle to evict workers for this special case after I have fixed the detection of unoccupied critical mines.
4. The definition of ironore() is only used once in the code where in every other instance the iron_resource_id is used to identify an iron mine, so I propose to get rid of this attribute as well as it might lead to inconsistency. Alternatively I'd change everything to use the ironore() definition and probably reintroduce the kIronMine property to achieve this. Anyhow this should be harmonized to prevent weird behaviour if the ironore() is defined alternatively (as in the Europeans for example).

Ok, I found it. It was my fault. I made a logical error rather then just identifiying raw materials I accidentally declared everything else to refined materials so nearly every building got the kBuildingMat producer flag. solving this solved 1 and 2.
I implemented 3 but as the mine is then instantly unoccupied it gets dismanteled anyway. I will prevent this for the last mine at least cause constant rebuilding is a waste of time and material.
Still need to decide on 4. but will give it a try without the ironore() definition.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-12, 09:35

I pushed a version this morning. However this is not finished yet and needs some polish.
But I left a NOCOM in the Code and would happy if Tibor could have look on this. basically we are using in alot of instances Mines.finished + Mines.in_construction while this is defined as Mines.total_count() in our headers


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-13, 08:59

Hi,
I pushed a commit now which should boost AI performance in long games, as AI is now building more then 2 mines per type based on performance statistic of existing mines (i.e. driven by economy) so it doesn't lack coal that heavy anymore.

Would be glad if someone could test this in addition to the review to be performed. To test you could start a local multiplayer with all slots AI or closed so you are an observer in the end feel free to choose all tribes and let them compete. If you do this with trunk and with my branch https://github.com/widelands/widelands/tree/cleanup_AI you should see the difference.


Top Quote
the-x
Avatar
Joined: 2019-01-19, 13:23
Posts: 447
Ranking
Tribe Member
Posted at: 2020-02-16, 13:39

The AI is great in long games now, I think. Maybe what we could do is make them fit for short games, like crater or where you soon get to the enemy. I wish that we can implement that the AI can build Labyrinth or Arena at the beginning. AI should start trainings soldiers even more early.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-16, 13:45

the-x wrote:

The AI is great in long games now, I think.

did you test it? Which map you choose which slots for AI or did you try an AI only game? would be happy for some detailed feedback.

Maybe what we could do is make them fit for short games, like crater or where you soon get to the enemy. I wish that we can implement that the AI can build Labyrinth or Arena at the beginning. AI should start trainings soldiers even more early.

AI has to ensure first it doesn't get stuck. Therefore it needs to establish its basic economy first and this takes time. So I think what you suggest will never happen until you have a genius idea how to do that code wise. In small maps you might choose village as starting condition to get a challenge.


Top Quote
the-x
Avatar
Joined: 2019-01-19, 13:23
Posts: 447
Ranking
Tribe Member
Posted at: 2020-02-16, 13:50

hessenfarmer wrote:

the-x wrote:

The AI is great in long games now, I think.

did you test it? Which map you choose which slots for AI or did you try an AI only game? would be happy for some detailed feedback.

I am just about to play. Feedback like?

Maybe what we could do is make them fit for short games, like crater or where you soon get to the enemy. I wish that we can implement that the AI can build Labyrinth or Arena at the beginning. AI should start trainings soldiers even more early.

AI has to ensure first it doesn't get stuck. Therefore it needs to establish its basic economy first and this takes time. So I think what you suggest will never happen until you have a genius idea how to do that code wise. In small maps you might choose village as starting condition to get a challenge.

Yes, obviously. Maybe we can get 2 parralel developments, like building basic + basic soldiers train program. I mean it doesnt take much, Labyrinth plus Räucherei and finished face-smile-big.png so that we really see partly trained soldiers instead of always sero trained AI soldiers till minute 40-60


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1331
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-16, 14:01

the-x wrote:

hessenfarmer wrote:

the-x wrote:

The AI is great in long games now, I think.

did you test it? Which map you choose which slots for AI or did you try an AI only game? would be happy for some detailed feedback.

I am just about to play. Feedback like?

of course feed back is appreciated and necessary to get the new change into the game.

Maybe what we could do is make them fit for short games, like crater or where you soon get to the enemy. I wish that we can implement that the AI can build Labyrinth or Arena at the beginning. AI should start trainings soldiers even more early.

AI has to ensure first it doesn't get stuck. Therefore it needs to establish its basic economy first and this takes time. So I think what you suggest will never happen until you have a genius idea how to do that code wise. In small maps you might choose village as starting condition to get a challenge.

Yes, obviously. Maybe we can get 2 parralel developments, like building basic + basic soldiers train program. I mean it doesnt take much, Labyrinth plus Räucherei and finished face-smile-big.png so that we really see partly trained soldiers instead of always sero trained AI soldiers till minute 40-60

that would be an atlanteans early game only AI. I feel I am sorry this is neither the concept for developping an AI nor do I see how to master the workload to implement such a thing for every tribe and situation, nor do I see the benefit of it.


Top Quote
the-x
Avatar
Joined: 2019-01-19, 13:23
Posts: 447
Ranking
Tribe Member
Posted at: 2020-02-16, 14:05

Indeed, why we need it i think is because we have so many small and medium maps. So even if i play a medium map, the first contact with AI is always the same. A barrack with 2 soldiers, untrained of course and they attack. So if you play this some times, it really gets all the time the same. So, if the AI has 2 soldiers with evade training, the next 1 with attack and evade it gets so much more exciting and i have the feeling that i could really lose against the AI.


Top Quote