Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Currently Online

Latest Posts

Topic: Production Time

stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-09, 20:28

I think I found another bug in the barbarians big_inn. Shouldn't it be one sleep on one animate statement instead of 2 sleep. Also the times for rations are weird:

      produce_ration = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a ration because ...
         descname = _"preparing a ration",
         actions = {
            "return=skipped unless economy needs ration",
            "sleep=23000",
            "consume=barbarians_bread,fish,meat",
            "playsound=sound/barbarians/taverns tavern 100",
            "sleep=10000",
            "produce=ration"
         }
      },
      produce_snack = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a snack because ...
         descname = _"preparing a snack",
         actions = {
            "return=skipped unless economy needs snack",
            "sleep=5000",
            "consume=barbarians_bread fish,meat beer",
            "playsound=sound/barbarians/taverns biginn 100",
            "sleep=32000",
            "produce=snack"
         }
      },
      produce_meal = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a meal because ...
         descname = _"preparing a meal",
         actions = {
            "return=skipped unless economy needs meal",
            "sleep=5000",
            "consume=barbarians_bread fish,meat beer_strong",
            "playsound=sound/barbarians/taverns biginn 100",
            "sleep=35000",
            "produce=meal"
         }

Like this:

      produce_ration = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a ration because ...
         descname = _"preparing a ration",
         actions = {
            "return=skipped unless economy needs ration",
            "sleep=5000",
            "consume=barbarians_bread,fish,meat",
            "playsound=sound/barbarians/taverns tavern 100",
            "animate=working 28000",
            "produce=ration"
         }
      },
      produce_snack = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a snack because ...
         descname = _"preparing a snack",
         actions = {
            "return=skipped unless economy needs snack",
            "sleep=5000",
            "consume=barbarians_bread fish,meat beer",
            "playsound=sound/barbarians/taverns biginn 100",
            "animate=working 32000",
            "produce=snack"
         }
      },
      produce_meal = {
         -- TRANSLATORS: Completed/Skipped/Did not start preparing a meal because ...
         descname = _"preparing a meal",
         actions = {
            "return=skipped unless economy needs meal",
            "sleep=5000",
            "consume=barbarians_bread fish,meat beer_strong",
            "playsound=sound/barbarians/taverns biginn 100",
            "animate=working 35000",
            "produce=meal"
         }


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 341
Ranking
Tribe Member
Location: Bavaria
Posted at: 2018-08-09, 21:10

animate working does not work if no animation is designed


Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-09, 21:32

hessenfarmer wrote:

animate working does not work if no animation is designed

What are the working_xx.png and working_xx_pc.png in the big_inn folder? Aren't these the files for the animation?

Edited: 2018-08-09, 21:33
Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 685
Ranking
One Elder of Players
Location: Saxony, GER
Posted at: 2018-08-09, 21:34

stonerl wrote:

Also the times for rations are weird:

Why are they weird?

By the way, the big inn is about to be changed a little bit, it will look like this: https://bazaar.launchpad.net/~widelands-dev/widelands/mines-worldsavior/view/head:/data/tribes/buildings/productionsites/barbarians/big_inn/init.lua


*insert phrase about the necessity of saving the world here*

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 1416
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-09, 21:57

stonerl wrote:

hessenfarmer wrote:

animate working does not work if no animation is designed

What are the working_xx.png and working_xx_pc.png in the big_inn folder? Aren't these the files for the animation?

The *pc.png are used to display the player color on top of the other image with the same name.


Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-09, 22:18

stonerl wrote:

hessenfarmer wrote:

animate working does not work if no animation is designed

What are the working_xx.png and working_xx_pc.png in the big_inn folder? Aren't these the files for the animation?

I'm pretty sure this is a bug. At the top of the init.lua for the big_inn there ar the following lines:

   animations = {
      idle = {
         pictures = path.list_files(dirname .. "idle_??.png"),
         hotspot = { 57, 88 },
      },
      build = {
         pictures = path.list_files(dirname .. "build_??.png"),
         hotspot = { 57, 88 },
      },
      working = {
         pictures = path.list_files(dirname .. "working_??.png"),
         hotspot = { 57, 88 },
      },
   },

In the big_inn folder the working_??.png are present. So there are animations. That's why I meant the times are weird. If the second sleep where the animation, then the actual animation would be very short compared to a normal inn(18s) or tavern(19s).


Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-09, 23:28

@WorldSaviour

This is how it should look like:

https://bazaar.launchpad.net/~stonerl/widelands/big_inn_missing_animation/view/head:/data/tribes/buildings/productionsites/barbarians/big_inn/init.lua

Tested it and send a merge request to your branch.


Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-10, 02:43

I do have a suspicion why the Reed Yard, farm and many other production sites where the worker has to leave the building have an additional 10 seconds added. I use the Reed Yard for my explanation. After the gardener enters the Redd Yard, the production program starts:

  1. planting

  2. harvesting

Since he starts harvesting only after the third reed has been planted the timings are as follows:

 18s plant first reed
33s plant second reed
33s plant third reed
 5s harvest reed
28s plant reed
 5s harvest redd
.
.
.

These are the times between entering and leaving the building. 18s is the sleep time for the plant action and 5 seconds the sleep tome for harvest. So second and third plant are:

 18s plant sleep
+ 5s harvest sleep
+10s those ominous 10 seconds

After the second time these 10 seconds get added to every plant action.

I found the following in this file:

https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/logic/map_objects/tribes/productionsite.cc#L902

In this very line 10 seconds are added, when a program gets skipped? I guess? Can't really explain this. But to my, limited, understanding this seems to be related.

Any Ideas?


Top Quote
stonerl
Avatar
Joined: 2018-07-30, 00:03
Posts: 44
Ranking
Pry about Widelands
Location: Earth
Posted at: 2018-08-10, 22:41

Okay I now know whats going on here. IMHO this is a severe bug. The line I mentioned in my last post adds 10 seconds when the production is skipped.

https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/logic/map_objects/tribes/productionsite.cc#L902

uint32_t const earliest_allowed_start_time = i->second + 10000;

So as an example I choose the gold ore mine in the mining routine this is defined:

"return=skipped unless economy needs gold_ore",

The mining program is skipped and the above mentioned adds 10 seconds before it starts the mining routine again. this is okay because here we have the condition "unless economy needs gold_ore"

The problem is this:

         actions = {
            "sleep=39000",
            "return=skipped unless economy needs gold_ore",
            "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
            "call=mine_produce",
            "call=mine_produce",
            "call=mine_produce",
            "return=skipped"
         }

The last return=skipped has no condition so even if the mining was successful. The 10 seconds penalty is added every time. Even if it was successful. I grepped through the data folder and these are the files where this need to be removed or a condition added:

./frisians/farm/init.lua
./frisians/armor_smithy_large/init.lua,
./frisians/drinking_hall/init.lua
./frisians/tailors_shop/init.lua,
./frisians/smokery/init.lua
./frisians/furnace/init.lua,
./frisians/reed_farm/init.lua
./frisians/ironmine_deep/init.lua
./frisians/armor_smithy_small/init.lua,
./frisians/reindeer_farm/init.lua,
./frisians/tavern/init.lua
./frisians/blacksmithy/init.lua,
./frisians/coalmine/init.lua
./frisians/shipyard/init.lua
./frisians/goldmine_deep/init.lua
./frisians/rockmine/init.lua
./frisians/rockmine_deep/init.lua
./frisians/coalmine_deep/init.lua
./frisians/aqua_farm/init.lua,
./frisians/mead_brewery/init.lua
./frisians/quarry/init.lua
./frisians/honey_bread_bakery/init.lua
./frisians/recycling_center/init.lua
./atlanteans/farm/init.lua
./atlanteans/goldmine/init.lua
./atlanteans/toolsmithy/init.lua
./atlanteans/smokery/init.lua
./atlanteans/ironmine/init.lua
./atlanteans/weaving_mill/init.lua
./atlanteans/mill/init.lua
./atlanteans/blackroot_farm/init.lua
./atlanteans/crystalmine/init.lua
./atlanteans/crystalmine/init.lua
./atlanteans/crystalmine/init.lua
./atlanteans/crystalmine/init.lua
./atlanteans/weaponsmithy/init.lua
./atlanteans/coalmine/init.lua
./atlanteans/armorsmithy/init.lua
./atlanteans/smelting_works/init.lua
./atlanteans/shipyard/init.lua
./atlanteans/quarry/init.lua
./barbarians/farm/init.lua
./barbarians/granitemine/init.lua
./barbarians/ironmine_deeper/init.lua
./barbarians/warmill/init.lua
./barbarians/helmsmithy/init.lua
./barbarians/coalmine_deeper/init.lua
./barbarians/ironmine_deep/init.lua
./barbarians/ax_workshop/init.lua
./barbarians/big_inn/init.lua
./barbarians/coalmine/init.lua
./barbarians/smelting_works/init.lua
./barbarians/inn/init.lua
./barbarians/shipyard/init.lua
./barbarians/goldmine_deep/init.lua
./barbarians/goldmine_deeper/init.lua
./barbarians/coalmine_deep/init.lua
./barbarians/metal_workshop/init.lua
./barbarians/quarry/init.lua
./barbarians/reed_yard/init.lua
./empire/farm/init.lua
./empire/goldmine/init.lua
./empire/toolsmithy/init.lua
./empire/marblemine/init.lua
./empire/marblemine/init.lua
./empire/marblemine/init.lua
./empire/ironmine/init.lua
./empire/vineyard/init.lua
./empire/ironmine_deep/init.lua
./empire/weaponsmithy/init.lua
./empire/coalmine/init.lua
./empire/armorsmithy/init.lua
./empire/smelting_works/init.lua
./empire/inn/init.lua
./empire/shipyard/init.lua
./empire/goldmine_deep/init.lua
./empire/coalmine_deep/init.lua
./empire/quarry/init.lua
./empire/marblemine_deep/init.lua

If these 10 seconds are intentional then they should be added directly to the buildings lua file.


Edit: with the worldsaviours branch there are even more sites affected.

Edited: 2018-08-11, 00:51
Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 341
Ranking
Tribe Member
Location: Bavaria
Posted at: 2018-08-10, 23:50

Sounds like a real problem, cause we need this unconditional skips to not screw up statistics. However I do not exactly know what is going on in the code you mentioned. For example I don't understand all if conditions there and neither do I understand the check and setting of tdelta which is the real variable triggering the scheduler. Hopefully one of our c++ experts could have a look into this piece of code.


Top Quote