Latest Posts

Topic: Production Time

stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-07-31, 14:54

I hope this is the appropriate part of the forum.

I already asked about the proper calculations for production cycles here. As stated, for most tribes the correct times are missing and/or they are wrong. So my Idea was to calculate the correct times first and secondly update the Tribal Encyclopedia and add the missing ones.

I would propose is that the results for the total time and average time are added in the respective init.lua files as comments.

For the barbarian bakery:

   programs = {
      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start baking bread because ...
         descname = pgettext("barbarians_building", "baking pitta bread"),
         actions = {
            -- time total: 67,2
            -- average: 33,6
            "sleep=20000",
            "return=skipped unless economy needs barbarians_bread",
            "consume=water:3 wheat:3",
            "animate=working 20000",
            "produce=barbarians_bread",
            "animate=working 20000",
            "produce=barbarians_bread"
         }
      },
   },

For buildings with multiple products like the barbarian axe_shop it would look like this:

   programs = {
      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _"working",
         actions = {
            -- time total: 238,8
            -- average: 79,6
            "call=produce_ax",
            "call=produce_ax_sharp",
            "call=produce_ax_broad",
            "return=skipped"
         }
      },
      produce_ax = {
         -- TRANSLATORS: Completed/Skipped/Did not start forging an ax because ...
         descname = _"forging an ax",
         actions = {
            -- time total: 76,6
            "return=skipped unless economy needs ax",
            "sleep=36000", -- +10 enlarge
            "consume=coal iron",
            "playsound=sound/smiths smith 192",
            "animate=working 28000",  -- +6 enlarge
            "playsound=sound/smiths sharpening 120",
            "sleep=9000",
            "produce=ax"
         }
      },
      produce_ax_sharp = {
         -- TRANSLATORS: Completed/Skipped/Did not start forging a sharp ax because ...
         descname = _"forging a sharp ax",
         actions = {
            -- time total: 79,6
            "return=skipped unless economy needs ax_sharp",
            "consume=coal iron:2",
            "sleep=37000", -- +11 enlarge
            "playsound=sound/smiths smith 192",
            "animate=working 30000", -- +8 enlarge
            "playsound=sound/smiths sharpening 120",
            "sleep=9000",
            "produce=ax_sharp"
         }
      },
      produce_ax_broad = {
         -- TRANSLATORS: Completed/Skipped/Did not start forging a broad ax because ...
         descname = _"forging a broad ax",
         actions = {
            -- time total: 82,6
            "return=skipped unless economy needs ax_broad",
            "consume=coal:2 iron:2",
            "sleep=38000", -- +12 enlarge
            "playsound=sound/smiths smith 192",
            "animate=working 32000", -- +10 enlarge
            "playsound=sound/smiths sharpening 120",
            "sleep=9000",
            "produce=ax_broad"
         }

The 3,6 seconds it takes for the craftsman to transport every produced item to the flag is also included in this calculation. I think having the total and average time in the lua-files is a good starting point. It also would also simplify the second step, adding the correct values to the Encyclopedia. What do you guys think about this idea.


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2018-07-31, 15:13

yes, it's good if someone takes care of that.

This project is developed by the users, so most of the times the only thing really needed to do something is someone willing to do it


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2018-07-31, 15:33

I had an idea about testing the timing in real game, but I had no time to do so. And after some time I have spot that most of them can be taken directly from the lua code. So my experiment is useless now. face-smile.png OK, for most of cases. Farms, woodcutters, foresters, etc. have some more details about how they work.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

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: 2018-07-31, 15:38

Just take care of the fact that some production times are currently under development - for example the "+ enlarge" in the smithies are about to be removed again.


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-07-31, 16:13

Is there a list of production times that are going to be changed? I assume the frisians times are still under development so I won't touch them. But what about the other tribes?


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: 2018-07-31, 16:46

stonerl wrote:

Is there a list of production times that are going to be changed? I assume the frisians times are still under development so I won't touch them. But what about the other tribes?

I can make such a list:

Atlanteans

Armor Smity

Weapon Smithy

Weaving Mill

Barbareans

Ax Workshop

War Mill

Helmsmithy

Empire

Weapon Smithy

Armor smithy

As far as I know that's all at the moment.

Details are here: https://bazaar.launchpad.net/~widelands-dev/widelands/mines-worldsavior/revision/8765


Wanted to save the world, then I got widetracked

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-07-31, 19:19

The best thing would be to parse the production programs in the C++ code and calculate everything there - we haven't found the time to do so yet though.


Busy indexing nil values

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-02, 18:59

I started with the Atlanteans' , but I ran into some problems. How should buildings that produce multiple wares be calculated? Here are the times for the crystal mine:

            -- granite, quartz and diamond needed
            -- total time: 371
            -- average granite: 41.2
            -- average quartz: 92.8
            -- average diamond: 185.5

            -- only granite and quartz needed
            -- total time: 255.2
            -- average granite: 31.9
            -- average quartz: 63.8

            -- only granite and diamond needed
            -- total time: 255.2
            -- average granite: 42.5
            -- average quartz: 255.2
            -- average diamond: 127.6

            -- only quartz and diamond needed
            -- total time: 231.6
            -- average granite: 57.9
            -- average quartz: 77.2
            -- average diamond: 115.8

            -- only granite is needed
            -- time total: 139.4
            -- average granite: 27.9
            -- average quartz: 139.4

            -- only quartz is needed
            -- time total: 115.8
            -- average granite: 38.6
            -- average quartz: 38.6

            -- only diamond is needed
            -- time total: 115.8
            -- average granite: 115.8
            -- average diamond: 57.9

and these are the ones for the smelting_works:

            -- iron and gold is needed
            -- total time: 190.8
            -- average iron: 95.4
            -- average gold: 190.8

            -- only iron is needed
            -- total time: 127.2
            -- average iron: 63.6

            -- only gold is needed
            -- total time: 63.6
            -- average gold: 63.6

            -- iron_ore is missing
            -- time total: 73.6
            -- average gold: 73.6

            -- gold_ore is missing
            -- total time: 137.2
            -- average iron: 68.6

This applies to all tribes and all buildings that produce multiple wares (I just chose those to as an example). The Atlanteans tool-smithy for example needs the same time and produces the same amount. I think it does not need to be as detailed, since it is unlikely that all 12 tools have to be produced constantly. So it is sufficient enough to say, that a new tool can be produced every 70.6 seconds. Without specifying the tool.

But maybe I'm just overcomplicating things...


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: 2018-08-02, 22:07

stonerl wrote:

I started with the Atlanteans' , but I ran into some problems. How should buildings that produce multiple wares be calculated? Here are the times for the crystal mine:

``` -- granite, quartz and diamond needed -- total time: 371 -- average granite: 41.2 -- average quartz: 92.8 -- average diamond: 185.5

        -- only granite and quartz needed
        -- total time: 255.2
        -- average granite: 31.9
        -- average quartz: 63.8

        -- only granite and diamond needed
        -- total time: 255.2
        -- average granite: 42.5
        -- average quartz: 255.2
        -- average diamond: 127.6

        -- only quartz and diamond needed
        -- total time: 231.6
        -- average granite: 57.9
        -- average quartz: 77.2
        -- average diamond: 115.8

        -- only granite is needed
        -- time total: 139.4
        -- average granite: 27.9
        -- average quartz: 139.4

        -- only quartz is needed
        -- time total: 115.8
        -- average granite: 38.6
        -- average quartz: 38.6

        -- only diamond is needed
        -- time total: 115.8
        -- average granite: 115.8
        -- average diamond: 57.9

```

Maybe one could just write something like: The crystal mine performs three different kinds of actions.

Action 1: Mine needs 27.9 seconds to produce granite and 139.4 seconds to produce quartz

Action 2: Mine needs 38.6 seconds to produce granite and 38.6 seconds to produce quartz

Action 3: Mine needs 115.8 seconds to produce granite and 57.9 seconds to produce diamond

and these are the ones for the smelting_works:

``` -- iron and gold is needed -- total time: 190.8 -- average iron: 95.4 -- average gold: 190.8

        -- only iron is needed
        -- total time: 127.2
        -- average iron: 63.6

        -- only gold is needed
        -- total time: 63.6
        -- average gold: 63.6

        -- iron_ore is missing
        -- time total: 73.6
        -- average gold: 73.6

        -- gold_ore is missing
        -- total time: 137.2
        -- average iron: 68.6

```

A hint: The smelting works are about to be simplified (there will be no difference whether one ore is missing or not), so it will be (maybe) sufficient to say that they need 63.6 seconds for smelting a metal and that they prefer to smelt iron in 67% of all cases.

This applies to all tribes and all buildings that produce multiple wares (I just chose those to as an example). The Atlanteans tool-smithy for example needs the same time and produces the same amount. I think it does not need to be as detailed, since it is unlikely that all 12 tools have to be produced constantly. So it is sufficient enough to say, that a new tool can be produced every 70.6 seconds. Without specifying the tool.

Yes

But maybe I'm just overcomplicating things...

I'm not sure, because the crystal mine isn't a simple building indeed.


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-04, 21:01

I did the first batch of calculations for Atlanteans, Barbarians & Empire. I only calculated the times for buildings that produce the wares without their workers having to leave the building itself. Also the shipyards and the buildings WorldSavior told me not to touch aren't calculated.

I added the calculations to the init.lua files. The changes can be found here:

https://bazaar.launchpad.net/~stonerl/widelands/production-times-calculation/revision/8773

Can anybody give me a hint on how to calculate the times for the shipyards.

Also how do we calculated farmers/reed_yard etc? Since their working radius is limited it is easier to do. But where do i find the walking times for them to the fields?

How are those with a much wider radius are calculated e.g. quarry? There I assume we cannot use the walking times, since they are different every time.


Top Quote