Latest Posts

Topic: Production Time

WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-05, 19:16

stonerl wrote:

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.

The action starts by going to a randomly chosen coast field where he starts to build the ship - which needs exactly as much resources as the shipyard can store.

So the total time for a ship is randomized. As far as I know, every object in Widelands moves one unit in 1.8 seconds. Before the worker moves from his flag to the coast, he has to move from the inside of the building to the flag (1.8 seconds).

Can I answer further questions?

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?

You can take a look of them and count how many steps the worker has to go. They also choose their spots randomly.

How are those with a much wider radius are calculated e.g. quarry?

Quarries (and woodcutters) don't choose randomly, but they choose - as far as I know - a spot which is minimally distanced from their building (instead of choosing spots which deliver the minimal walking distance --> bug! )

There I assume we cannot use the walking times, since they are different every time.

For farmers, the walking times are often different as well...


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-05, 21:14

Can I answer further questions?

How are slopes and inclines are handled? The aforementioned 1.8 seconds are for flat terrain, aren't they. Does it take 1.8s on a yellow or red section as well?


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-05, 22:50

stonerl wrote:

Can I answer further questions?

How are slopes and inclines are handled? The aforementioned 1.8 seconds are for flat terrain, aren't they. Does it take 1.8s on a yellow or red section as well?

No, it doesn't, I forgot about that. At least not for carriers. I don't know the time difference between different inclines.


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-05, 23:19

I calculated the production times for the shipyards.

So the minimum distance between the flag and the construction side is 3 units and the maximum 6. In both cases +1 unit from the building to the flag. For some reason the shipwright seems to prefer 6 units...

In the init.lua there is 35 second working time and a 20 second sleep time but for some reason it takes another 10 seconds before the shipwright leaves the building. Calculation looks like this:

 35s    working
+20s    sleeping
+10s    no clue why
+7.2s   walking to construction site 4*1.8
+5.5s   working on the ship
+7.2s   return to building
-------
=84.9s  1/16 to build the ship
*16     it takes 16 steps to build the ship
-------
=1358.4s
-------
=22,64m

So it takes min 22.64 minutes and max 25.52 minutes to build a ship.

These are the ideal conditions, as in: the terrain is flat. But i'm not sure if it es necessary to consider inclines. Since on the way back it should be faster since it downhill, right?


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-06, 00:17

stonerl wrote:

I calculated the production times for the shipyards.

So the minimum distance between the flag and the construction side is 3 units and the maximum 6.

Is the minimum distance not 1? When the flag is directly at the coast or on it? And for the maximum: What happens if the worker has to go around his building in the direction "from flag to building""? I want to say, maybe the maximum is higher. And theoretically the route to the spot can be very long (if there are some obstacles), can't it?

In both cases +1 unit from the building to the flag. For some reason the shipwright seems to prefer 6 units...

In the init.lua there is 35 second working time and a 20 second sleep time but for some reason it takes another 10 seconds before the shipwright leaves the building. Calculation looks like this:

``` 35s working +20s sleeping +10s no clue why

When happen the 10s?

These are the ideal conditions, as in: the terrain is flat. But i'm not sure if it es necessary to consider inclines. Since on the way back it should be faster since it downhill, right?

Yes, faster. But this doesn't mean that the times are the same. Though the effect of inclines could be maybe rather negligible.


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-06, 00:57

Is the minimum distance not 1?

I had tested around 20 shipyards with all 3 tribes. Even if I build the shipyard next to the see, where I expected a distance of 1, most of the time it was 3 and sometimes 6, but never 1.

And for the maximum: What happens if the worker has to go around his building in the direction "from flag to building""?

You're right I tested this, yet. I surrounded his building all the way to the see with Lumberjack's Huts and it took 8 units + 1. So 9 in total. I don't expect it to be more because this was the furthest away from the see. One buildingblock more and it would be to far to even start working on ships. So I guess 9 would be the max.

When happen the 10s?

Right before the shipwright leaves the building. When he enters the building one can see the working animation for 34s. After that I expected that it would take another 20s until he leaves the building but it took 30 in total.

The same occurs on the farm the sleeptime should be 14 but is 24. Also another 10s added for some reason.

Here the code:

   programs = {
      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _"working",
         actions = {
            -- 
            "call=plant",
            "call=harvest",
            "return=skipped"
         }
      },
      plant = {
         -- TRANSLATORS: Completed/Skipped/Did not start planting corn because ...
         descname = _"planting corn",
         actions = {
            "sleep=14000",
            "callworker=plant"
         }
      },
      harvest = {
         -- TRANSLATORS: Completed/Skipped/Did not start harvesting corn because ...
         descname = _"harvesting corn",
         actions = {
            "sleep=4000",
            "callworker=harvest"
         }
      },

The 10 seconds are added to the planting corn actions.

In the case of the shipyard after the ship action I assume

   programs = {
      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _"working",
         actions = {
            -- best time total: 1358.4
            -- worst time total: 1531.2
            -- average: 1444.8
            "sleep=20000",
            "call=ship",
            "return=skipped"
         }
      },
      ship = {
         -- TRANSLATORS: Completed/Skipped/Did not start constructing a ship because ...
         descname = _"constructing a ship",
         actions = {
            "checkmap=seafaring",
            "construct=atlanteans_shipconstruction buildship 6",
            "animate=working 35000",
            "return=completed"
         }

Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2018-08-06, 08:45

Have you tried to surround the shore with roads?

I have spot a bug/feature about building ships far away long time ago and the simplest workaround is just to build roads on the shore and leave one place for the ship. Shipyard has to build it there. Then you can test ships building with repeated conditions.


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

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-06, 15:29

Have you tried to surround the shore with roads?

@einstein13 this "bug" seems to be fixed. The problem is not the repeating conditions, I build a map exactly for this. After further testing I can emphasize that the minimum distance is indeed 3+1 units. and the maximum is 8+1. But there is one catch.

Take a look at this picture:

Shipyard_wrong.png

On the north coast the shipwright has to move 3 units from the flag to the construction site. And 3 when he walks back. In total 8 units

On the west coast the distance from the flag to the construction site is 3 units, but the shipwright cant walk vertical so he has to zigzag his way. This means he has to walk 5 units (black line) on his way to the construction site and 5 units back (white line). The construction site should be on the spot between 3 and 4 instead.

To upper shipyard builds a ship in 22 minutes and 38 seconds. The left one in 24 minutes and 33 seconds; which is 8.5% longer. This seems to be a bug?!?

Yes, faster. But this doesn't mean that the times are the same. Though the effect of inclines could be maybe rather negligible.

I measured the time for red inclines for a transporter. Upwards it takes 3.6 seconds for unit and downwards 0.9 seconds. Double and half the time of a green road. Which results in 3.6 seconds when he walks one unit forth and back. So the effect in case of the shipwright is 0. is is as if he would walk on a green unit.

So the minimum time for a ship being build is 22 minutes and 38 seconds. The maximum time 27 minutes 28 seconds.

Edited: 2018-08-06, 15:38

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-06, 15:45

stonerl wrote:

Have you tried to surround the shore with roads?

@einstein13 this "bug" seems to be fixed. The problem is not the repeating conditions, I build a map exactly for this. After further testing I can emphasize that the minimum distance is indeed 3+1 units. and the maximum is 8+1. But there is one catch.

Take a look at this picture:

Shipyard_wrong.png

On the north coast the shipwright has to move 3 units from the flag to the construction site. And 3 when he walks back. In total 8 units

On the west coast the distance from the flag to the construction site is 3 units,

No, the distance is 5 units.

but the shipwright cant walk vertical so he has to zigzag his way. This means he has to walk 5 units (black line) on his way to the construction site and 5 units back (white line). The construction site should be on the spot between 3 and 4 instead.

To upper shipyard builds a ship in 22 minutes and 38 seconds. The left one in 24 minutes and 33 seconds; which is 8.5% longer. This seems to be a bug?!?

No

Yes, faster. But this doesn't mean that the times are the same. Though the effect of inclines could be maybe rather negligible.

I measured the time for red inclines for a transporter. Upwards it takes 3.6 seconds for unit and downwards 0.9 seconds.

Interesting...

Double and half the time of a green road. Which results in 3.6 seconds when he walks one unit forth and back.

No, 4.5 seconds.

So the effect in case of the shipwright is 0. is is as if he would walk on a green unit.

So the minimum time for a ship being build is 22 minutes and 38 seconds. The maximum time 27 minutes 28 seconds.

No

But I was also wrong. 0.9 seconds don't seem to be negligible...


Wanted to save the world, then I got widetracked

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-06, 16:28

Sorry I was wrong about the 1 Unit construction site:

Shipyard_1unit.png

It is indeed possible to force a 1 unit or 2 unit construction site. But on its own the shipwright would never do this if there wouldn't be any roads.

No, the distance is 5 units.

Sorry to be pedantic, but the distance for the upper shipyard is 3. Have a look at the map without buildings:

water_test.png

The distance between 2 flags is 1 unit isn't it? The black line I drew was the way the shipwright was walking. He walks from the 2nd left flag to the 5th left one. I can give you the map if you want to test it yourself.

No, 4.5 seconds.

You're right... I'm stupid. It is indeed 4.5

But I was also wrong. 0.9 seconds don't seem to be negligible...

Yes that is indeed allot.


Top Quote