Latest Posts

Topic: New weaknesses of the AI

WorldSavior
Avatar
Topic Opener
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-06-06, 18:40

The changes of gameplay in trunk lead to at least two new weaknesses of the AI:

  1. The AI never increases the economy limit of soldiers. In combination with the weakness that it never dares to attack an opponent which is much stronger (militarical statistics), this is a disaster.

  2. Trainers need "tools" now. But this "tools" go now often to the barracks, so the barracks avoid that the trainingssites can begin their work often.


Wanted to save the world, then I got widetracked

Top Quote
Tibor

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

There were no changes in AI since build19, but indeed some "external" changes affects the AI.

As for point 1 - in new AI the attack logic was completely reworked so AI will take more inputs into account when attacking (considering) attack. But you are right, current AI does not attack when player is too weak.

As for point 2 - What is your opinion, how this could be addressed?


Top Quote
WorldSavior
Avatar
Topic Opener
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-06-06, 19:46

Tibor wrote:

There were no changes in AI since build19, but indeed some "external" changes affects the AI.

As for point 1 - in new AI the attack logic was completely reworked so AI will take more inputs into account when attacking (considering) attack. But you are right, current AI does not attack when player is too weak.

That sounds good.

I just realized that I should have rather asked if your new AI will be able to increase the economy limit of soldiers... face-wink.png

So I was a little bit unprecise. Sorry.

As for point 2 - What is your opinion, how this could be addressed?

Does "addressed" mean "solved" here? Well, it could be solved by an algorithm which the AI uses if a trainer is missing. In most cases it would be enough if the store limit of wares in all barracks will be decreased sufficiently. Of course decreasing to zero until the trainers exist would be enough, but the algorithm could be smarter.

In the perfect algorithm, stopping all barracks could also be included.


Wanted to save the world, then I got widetracked

Top Quote
Tibor

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

I see no point in increasing limit of soldiers, as there are usually no spare soldiers in warehouses, so even default limit will always allow creation of new soldiers.

Consider trainingsites without trainers when stopping barracks is good idea. I added this parameter to algorithm, so perhaps genetic algorithm will learn to take this into account, this is matter of training now...


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2017-06-06, 22:40

I would put an algorithm that

IF soldiers in warehouse >= target quantity,

          AND training camp has full wares, AND battle arena has full wares, AND military power of that player has not increased in the last 10 minutes,

                        THEN target soldiers = currenta target soldiers + 30.

that would ensure that an economy would never stop, for if it does ever stop, it will soon get a signal to build more soldiers. At the same time, it will ensure that all soldiers are fully promoted before making new ones. I would also add

IF soldiers < target quantity,

        AND target quantity > default target quantity, AND "soldiers lost" counter for the player has increased since the last time it happened that "soldiers >= target quantity = true"

                 THEN target soldiers = current target -10

this condion means that if a player was increasing his soldier target quantity, and then he starts fighting and loses soldiers, the target quantity will be gradually lowered to something more reasonable.


Top Quote
WorldSavior
Avatar
Topic Opener
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-06-07, 18:03

That looks good. I think that 30 is quite high, and ten minutes maybe as well, but it would be an improvment

EDIT: Of course it would be smart to not apply this algorithm in peaceful matches (which are rare but also a part of widelands imho).

And the "trainingssites full of wares" should ignore that trainingssites can store fish and meat - if one of this would be full, it should be enough

Tibor wrote:

I see no point in increasing limit of soldiers, as there are usually no spare soldiers in warehouses, so even default limit will always allow creation of new soldiers.

Well, for the current AI it is usual. And what does your new AI? Does it let all spare soldiers vanish? face-wink.png

Edited: 2017-06-07, 18:15

Wanted to save the world, then I got widetracked

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-07, 20:38

When testing, usual problem is unoccupied positions in militarysites. AI generally grows as fast as it can. It must be very special situation (restricted space) that all militarysites are full and soldiers are pilled in warehouses. So this algorithm is to control situation that does not happen...


Top Quote
WorldSavior
Avatar
Topic Opener
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-06-07, 21:53

No... It is absolutely normal in the late game

Edited: 2017-06-07, 21:59

Wanted to save the world, then I got widetracked

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-07, 22:01

Indeed? My test games run for 4 hours and the main problem is always shortage of soldiers in militarysites.


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2017-06-07, 22:53

Tibor wrote:

When testing, usual problem is unoccupied positions in militarysites. AI generally grows as fast as it can. It must be very special situation (restricted space) that all militarysites are full and soldiers are pilled in warehouses. So this algorithm is to control situation that does not happen...

WorldSavior wrote:

No... It is absolutely normal in the late game

Tibor wrote:

Indeed? My test games run for 4 hours and the main problem is always shortage of soldiers in militarysites.

that's because we have a different concept of "late game". ok, in a normal match it does not happen, but there are some maps that are meant to be played for several tens of hours (pretty much all of my challenge maps, plus large ocean and a few older ones) where the AI will grow for a long time without fighting, and it will fill all spots and get a storage of soldiers. So that algorithm is there to check on an uncommon situation that only arises in special games. doesn't seem complicated, and i don't see what bad could happen by including it.

and by the way, 4 hours seem really short for an optimization test. did you consider that you may be optimizing the AI to specifically adopt a style that is only goood for 4 hours? like, after 3 hours don't build any economy because by then it will be too late to make a difference before the 4th hour? don't build more than X buildings because in 4 hours you can't expand more than that? I understand that testing time is limited, but in that case i would suggest running tests with a random time end between 2 and 6 hours. hmm, this bit of randomization may be good to ensure a strategy that keeps being decent for alll the game, but it still suffers the same limitations in thatit completely discourages expansion after 6 hours.

also, how do you judge which AI was more successful after the time ends? this is tricky; if you count military power, then you are encouraging the AI to make many cheap soldiers, which give a big boosts to the stats but are worthless in battle against the more advanced ones. If you count wares, then you are encouraging the AI to stockpile water and other inexpensive resources, and a similar problem if you're counting the number of buildings, while if you count the populaton, the AI will be rewarded for making many warehouses, which hold 100 carriers each. the only good marker I can think of would be real "converted cost of your army".


Top Quote