Currently Online

Latest Posts

Topic: Calculation of needed time for production

fuuya
Avatar
Topic Opener
Joined: 2020-03-21, 19:08
Posts: 4
Ranking
Just found this site
Posted at: 2020-03-22, 09:33

Hi! I'm relatively new to the game (downloaded this quarantine) and I really like it so far. I really like the help menu, but I want to do something about the Production Performance Calculation needed message.

I found the code for the coal mine production (I think) on GitHub:

...
      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start mining coal because ...
         descname = _"mining coal",
         actions = {
            "return=skipped unless economy needs coal",
            "consume=beer ration",
            "sleep=43000",
            "call=mine_produce",
            "call=mine_produce",
            "call=mine_produce",
            "return=no_stats"
         }
      },
      mine_produce = {
         descname = _"mining coal",
         actions = {
            "animate=working 14000",
            "mine=coal 2 50 5 17",
            "produce=coal",
         }
      },
...

So, what do these numbers mean? I guess, that in mine_produce, working 14000 14000 is the ms it takes to mine a single coal. Am I right or do I have to include the mine field as well into a calculation for the average time? I'd like to help fill those needed calculations. So I can create more of these production trees

Thanks in advance!


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1928
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-03-22, 10:41

You can find explanations for all commands used in these programs here: https://www.widelands.org/documentation/productionsite_program/

The working times (always in milliseconds) are defined in animate=… (as you correctly found out face-smile.png ) and also in sleep=… statements. So in the example above, the empire coal mine sleeps 43 s, then has three cycles of (work 14 s, produce 1 coal). The sleep times between cycles also needs to be taken into account so as to average over the long-term production/time ratio. (In this case, add a third of the 43s to each of the 3×14s)

Statements like mine are executed instantly and do not contribute to the working time.

(Edit: And the worker walks to the flag and back once for every produced ware instance, which takes 3.6 s on average.)

For buildings with multiple outputs, or where the worker walks around in the landscape, it is not possible to determine exact values, because the walking time differs from cycle to cycle.

A lot of times have been calculated for the helptexts already (in-game encyclopedia → buildings → Production-Performance or data/tribes/buildings/productionsites/…/…/helptexts.lua)

Edited: 2020-03-22, 10:43

Top Quote
fuuya
Avatar
Topic Opener
Joined: 2020-03-21, 19:08
Posts: 4
Ranking
Just found this site
Posted at: 2020-03-22, 13:09

Thanks, that was really helpful. I've created an issue on Github to help out fill the remaining production times, my only issue is that I don't have experience in contributing in open source projects, so I'm a bit unsure as to what to do next. Github issue is at https://github.com/widelands/widelands/issues/3791 . I've also added a comment about confusing incode comments regarding the production time.

Edited by kaputtnik: Fixed link

Edited: 2020-03-22, 13:37

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2020-03-23, 06:57

You could try forking the project and creating a branch. This way, you can test your changes and then make a pull requests when you're done.

We have some instructions: https://www.widelands.org/wiki/GitPrimer/

GitHub also has some really good documentation: https://help.github.com/en/github/using-git

I recommend that you get a Git client that has a graphical interface. There are many different ones out there - for Windows, I like TortoiseGit. GitHub also offers one and that might be the easiest path, since it will match their help.


Busy indexing nil values

Top Quote