Latest Posts

Topic: Measuring working time of productionsites

hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-01-24, 09:39

Tibor wrote:

hessenfarmer wrote:

@ Tibor:
Ok understood. I have started to do it in the other way yesterday. will upload it soon. I just experimented a bit with excel before and found that a time base of 5 Minutes will let us cross the 90% mark after 11 minutes. Would this be ok for you?

This sound interesting, I had never make such calculations. Can I interpret this that it takes 10 minutes to go from 10% to 90% and vice versa? Providing that site is fully working / idle over that 10 minutes...

Yes basically I attach my Excelsheet where you can see how long it lasts with different values of time base. As well as that it is only dependend on time base. With 10 minutes we need 24 minutes to reach 90% and then 20 minutes to go back to 10% (this is due to integer arithmetics. So for me nothing changes for AI except it may react a bit faster on economic demand, which might be not that bad, given that the Ai is still not very competitive.

This would be OK for me.

But I still dont like manipulation with production time duration...

what do you mean with this. I have reverted the floating duration back and I never manipulated anything else.

Edited: 2020-01-24, 09:41

Attachment:
Productivity.zip (12.6 KB)

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-01-24, 10:05

hessenfarmer wrote:

With 10 minutes we need 24 minutes to reach 90% and then 20 minutes to go back to 10% (this is due to integer arithmetics. So for me nothing changes for AI except it may react a bit faster on economic demand, which might be not that bad, given that the Ai is still not very competitive.
OK, then I am fully for this

But I still dont like manipulation with production time duration...

what do you mean with this. I have reverted the floating duration back and I never manipulated anything else.

OK than


Top Quote
JanO
Avatar
Joined: 2015-08-02, 11:56
Posts: 177
Ranking
At home in WL-forums
Posted at: 2020-01-24, 10:15

Is it possible to use the training for genetic AI to evaluate this? As Tibor says, I believe the floating time-base for those productivity calculations would affect the AI. But I would not be sure about the effect being negative.

I guess it is good if AI handles small buildings like wells quite flexible, because there almost always is some place to rebuild those. But it is not good if AI dismantles pretendedly unnecessary big productionsites, builds something else there and then recognises it needs the big ones again. Flexible time-base can help prevent this, if we take care that the time base is larger for the relevant buildings.

Furthermore, information about why productivity drops could be helpful for AI. As I suggested, it would be nice to have a hint if the reason is "ware not needed" or "shoratage of input". In first case it is very likely that the building can be dismantled without any harm. In the second case I would not recommend dismantling.

Generating these two values from the existing code should be not to complicated, as hessenfarmer already has the two calculations (time based and cycle based). Teaching the AI to handle those independently would be harder, I guess...


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-01-24, 10:35

I have reverted the change already back to the fixed time base of 5 minutes for all builddings. After reevaluating Tibors concern and looking into my excel it might be good to have comparable statistics for each building taking into account that the transport system might need some time to settle.
What I could try next week is watching a pure AI Game with either change and with current trunk to see whether we can i9dentify any changes in behaviour. If somebody else will do this also I am happy to discuss observations. Normally I use the "Full Moon" map for these exercises.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-01-24, 12:48

The statistics is used by AI to say if we should dismantle or built another building, so f.e.:

We have 4 building of type X (productionsite with inputs and outputs), average utilization is 10% (so basically all doing nothing in last ten minutes) => we can dismantle one. No need to look for a reason.

If we have 4 building with average utilization 90% => we need another. However AI considers also number of outputs. Because the more outputs the lower percentage should be considered as a trigger to build new one.

Also note that small buildings - depending on vicinity (woodcuters, quary, fishers...) have different and separate logic. Their output is not that important, or is not important at all.

Generally we can feed AI with multiple statistics of productivity, but then re-training would be needed.


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: 2020-01-24, 17:10

@Tibor: In build20 the productivity stats work very bad, that confuses the AI. The new developed stats sound very promising, we should test them. They might help the AI.


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: 2020-01-24, 18:18

WorldSavior wrote:

@Tibor: In build20 the productivity stats work very bad, that confuses the AI. The new developed stats sound very promising, we should test them. They might help the AI.

the player visible Productivity stats have no influence on AI as AI was using the time based value I now want to use for the players since b20. That is the origin of this thread. However in b20 it works not that good for AI as in the computation of the value we had an integer overflow (with a 32 bit unsigned integer this is not to be expected and it took me a couple of hours to hunt this down) this is fixed now in AI and it was retrained. So currently the whole thing is about using this statistics also for the players. AI is or was fine.
I fully understood Tibors concern about the influence on AI so I reverted my new concept of changing the time base constantly and just cut its length by 2. this won't change the concept but is making rise and fall times a lot quicker. In a code comment the value was explained by giving the economy time to settle after a Building has been added or removed. But I believe the 10 Minutes were meant as settle time, which is exactly the state we achieve with a 5 Minutes base while 10 Minutes resulted in 24 minutes settle time.
BTW: the time based statistics for player visibility change accidentally already went into trunk. We now only have to fix the issue that currently these percentages never reach 100.
So really I didn't want to start a big discussion about this. And I don't see any reason for having different stats for player and AI anymore. So I got rid of a lot of duplicate code and still I can remove another now superfluous function. Only thing is currently my code is somewhat instrumented to log the mean values of production time per cycle for each building as this was a side effect of my now declined concept and I want to have some values to compare them with the lua scripts.


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: 2020-01-24, 21:12

Okay. Sorry then for writing incorrect stuff...


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: 2020-01-25, 01:15

WorldSavior wrote:

Okay. Sorry then for writing incorrect stuff...

no worries, only discussion leads to new knowledge, and these things are hard enough to understand.


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

Grrr,
tried to test this with 4 AI players on my standard testmap (Full Moon). However it crashes for a reason I don't know. on my linux machine it threw a failed assert at player.cc:924 but I din't change anything on that side.


Top Quote