Polls

Default Game Speed

Log in to vote!

Latest Posts

Topic: Fixing "Calculation Needed"

WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 1345
Ranking
One Elder of Players
Location: GER
Posted at: 2019-11-24, 15:47

@JJG: You're welcome. And thanks for your posts

hessenfarmer wrote:

I believe if theres is a slope from building to flag the effects of slowing down uphill and accelerate downhil should average so it should be 3.6s all the time.

Not exactly, to be precise

How does skip work? Does it take the same amount of time as production?

no skipping takes 10 seconds I believe but you need to look into the c++ code to confirm this.

Is this bug not fixed already? I think that it build19 it was like that, but in build20 skipping doesn't take any non-neglectable time.

It looks like there is skip data comparisons for "needs" and "has" I can look at in more detail.

yes skipping is always done conditional either for economy reason (the ware is not needed) or production reason the inputs to produce the ware are not available. This reasons are normally defined in the lua code. Personally I believe we could and should only calculate performance in the good case (all inputs available and wares are needed). As this is where performance matters.

If one could distinguish if a building has low productivity because of missing wares or missing need, this would be a good feature. Or even if one couldn't distinguish it. However, the productivity numbers are broken anyway, so maybe we need a better implementation...


“It's a threat to our planet to believe that someone else will save it.” - Robert Swan

Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 278
Ranking
Tribe Member
Location: Earth
Posted at: 2019-11-24, 18:11

The skip bug is solved since build 20.

The way skips work is quite simple. A production program gets started and it checks whether the wäre isbnwededbor Not. If the economy doesn't need the ware itbskips the production and the programm ends. Before the program gets started again the logic checks whether the program finished with a skipped and whether this skip was more then 10 seconds ago. If not, the program doesn't get started. If it is more than 10 seconds since the program got skipped, it is removed from the skipped stack and started again.


Top Quote
JJG
Avatar
Joined: 2017-07-30, 03:48
Posts: 6
Ranking
Pry about Widelands
Posted at: 2019-11-25, 00:49

WorldSavior wrote:
@JJG: You're welcome. And thanks for your posts

If one could distinguish if a building has low productivity because of missing wares or missing need, this would be a good feature.
However, the productivity numbers are broken anyway, so maybe we need a better implementation...

My goal is to fix the productivity numbers that now show in the help as "Calculation needed". Did you means something other than that?

Edited: 2019-11-25, 01:05

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3073
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2020-01-03, 14:01

JJG wrote:

Thanks for pointer to syntax and location for logging.
I can't find productionsite_program.cc
But in src/logic/map_objects/tribes/ there is a production_program.cc and a productionsite.cc

production_program.cc is the one. Ideally, we would have some doce in there that will calculate it for us, so we won't have to recalculate whenever we change a program.

Some production programs also call worker programs, in which case the average walking speed depending on work area radius becomes important.

playsound is just a trigger and doesn't cost any time.


Busy indexing nil values

Top Quote
JJG
Avatar
Joined: 2017-07-30, 03:48
Posts: 6
Ranking
Pry about Widelands
Posted at: 2020-01-08, 02:52

JJG wrote: Thanks for pointer to syntax and location for logging.
I can't find productionsite_program.cc
But in src/logic/map_objects/tribes/ there is a production_program.cc and a productionsite.cc

GunChleoc wrote: production_program.cc is the one. Ideally, we would have some doce in there that will calculate it for us, so we won't have to recalculate whenever we change a program. Some production programs also call worker programs, in which case the average walking speed depending on work area radius becomes important.

playsound is just a trigger and doesn't cost any time.

Good tips, thanks. Production speed data like this is currently missing or hard coded as independent values, prone to get stale, but simplest to implement. - With sufficient coding, it could be calculated at run-time, which increases startup time and isn't needed. - With sufficient compiler macros, it could be calculated at compile-time, probably better than run-time. - My goal is to write a perl script to create the missing data as hard coded independent values, so someone can run the script before releasing the code before compile-time.

I counted 384 production building lua files, lets assume 200 of them need updating. I haven't climbed the learning curve for code updates yet. -- "decades are not cardinally numbered"


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

Hi JJG,

while going over our bug list in github I found some very useful information. see https://www.widelands.org/forum/topic/4523/ and https://github.com/widelands/widelands/issues/3437 so there are 2 basic ways of calculating performance.
1. a building does all its work inside - in this case we have 2 subcases
a. it produces only one type of ware - so performance from my point of view is sleep time + animation time (if defined) + walking time to the flag (3.6s) divided by number of wares produced in one cycle (could be more then one)
b. it produces multiple wares - in this case we could average the time over all products or we could provide the value for each product. for the latter we should provide the value if only this ware is produced and the value if all wares are produced (taking the other products time as additional waiting time)
2. A building sends workers out to do the work (e.g. woodcutter) - for these we need to calculate all sleep and animate times togehter with the mean walking time based on working radius according to einsteins calcualtions in the links I provided above.

Edited: 2020-01-09, 12:48

Top Quote