Latest Posts

Topic: Solution proposals for maritime shipping problems

kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2020-02-03, 10:09

Nordfriese wrote:

Just a question: Is shipping wares preferred over shipping workers?

I had a agame where i have to move all wares and workers to another island, and a brewery waits hours to get the brewer because all ships are only transferring wares.

A brewer doesn´t need a tool so he should be created in the nearest warehouse and not require shipping...

All shippingitems are equal, no matter whether they are a ware or worker. Whether one item is preferred over another is decided by exactly two factors: Their destinations, and how long they are waiting in the portdock already.

Thanks for the info face-smile.png Maybe i have messed up this logic with some economy settings: Prefer all wares and workers in port of island2, remove all wares and workers from port and headquarters of island1. Anyway i noticed also some ships were idling at island2, although there were plenty of wares waiting for shipping at island1. This game had only two ports...


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Yo...
Avatar
Joined: 2019-10-28, 14:47
Posts: 26
OS: Win 10
Version: 1.0 + 1.2
Ranking
Pry about Widelands
Location: MiddleEurope
Posted at: 2020-02-03, 11:57

Nordfriese wrote:

How about workers and soldiers? How they are preferred or not?

Currently: Not at all. Algorithm considers only number of items shipped for a certain destination. (...)

Ok, now I know it's not just a feeling when I think the priority-settings for wares are sometimes ignored ...

(...) Sometimes it seems the soldiers have the lowest priority, (...)

That´s because if you urgently need your soldier, you tend to be a bit impatient (...)

Yes, but this discovery doesn't help much to make the game better face-wink.png

I implemented it now

Thank you face-smile.png


Top Quote
simplypeachy

Joined: 2009-04-23, 12:42
Posts: 153
Ranking
At home in WL-forums
Location: Hampshire, UK
Posted at: 2020-02-03, 17:46

Tibor wrote:

So these per ware per warehouse targets will work like upper limit - they would not allow another ware and force provider to look for another warehouse to send the ware to.

But is is still possible that count of existing wares will exceed the sum of all targets and thus the engine will be forced to pick one of the warehouses.

My thinking was that the warehouse targets would serve as a minimum requirement. I would propose that once the minimum is met, the Prefer/Normal priorities are honoured. Whether the "Do Not Store" priority is honoured, or ignored, until target is met, well this is another matter. I can see why we would want to keep 20 marble in a remote warehouse, but make sure no other marble is kept there. But then it could be thought of as somewhat counter-intuitive.


WARNING: New-style view packet not found. There may be strange effects regarding unseen areas.
_aD on IRC

Top Quote
simplypeachy

Joined: 2009-04-23, 12:42
Posts: 153
Ranking
At home in WL-forums
Location: Hampshire, UK
Posted at: 2020-02-03, 17:49

hessenfarmer wrote:

Nordfriese wrote:

So those limits would work like this:

  • When a newly produced brick is intended to be stored at a warehouse:

  • If there are warehouses with less bricks than their individual target, send the brick to the closest of those

  • Otherwise, send the brick to the closest warehouse

That was my original thinking. There is an argument for honouring Prefer/Normal priorities, too.

Almost. I would prefer to have the brick being brought to the warehouse with the biggest difference of target and amount. And productionsites and constructionsites would have precedence over warehouses of course.

Great idea to give warehouses a lower priority in that situation. I would say that the mechanic for sending to the largest difference could be useful, but doesn't need to be restricted to warehouses. Perhaps keep it simple to begin with.


WARNING: New-style view packet not found. There may be strange effects regarding unseen areas.
_aD on IRC

Top Quote
simplypeachy

Joined: 2009-04-23, 12:42
Posts: 153
Ranking
At home in WL-forums
Location: Hampshire, UK
Posted at: 2020-02-03, 17:52

Nordfriese wrote:

I think a region system which the player has to configure himself would be too complex.

I agree here. One of Widelands' strengths is its simple mechanics which then allows for emergent strategy. I'd prefer ports to simply act like economy nodes across water, as they are now.


WARNING: New-style view packet not found. There may be strange effects regarding unseen areas.
_aD on IRC

Top Quote
simplypeachy

Joined: 2009-04-23, 12:42
Posts: 153
Ranking
At home in WL-forums
Location: Hampshire, UK
Posted at: 2020-02-03, 17:54

Nordfriese wrote:

This is how the current algorithm works:

Wow. I know a lot of thought and effort goes into the code of the game but I hadn't realised how clever the ship and port system was. I wouldn't have been able to envisage such a system, let alone create one <3


WARNING: New-style view packet not found. There may be strange effects regarding unseen areas.
_aD on IRC

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2020-02-03, 17:58

i didn't follow the last 5 pages or so, but i just had an idea on the large economy problem:

if we send a ware to a faraway place, and we try to see if there is a duplicate of that ware closer to the destination, it's going to kill the cpu.

but it could be reasonable to do it when wares go into a port.

then all you have to do is check if there is already a duplicate of that ware in the destination port. only once per ware. very cpu light, would already be helpful


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

Good idea face-smile.png We would only need to check:

If there is the same ware type at the other dock, and it´s heading to the first dock, swap their destinations. If this is not the case, but the given ware type is stored in the other port´s warehouse, use that one instead and cancel transporting the current ware.

Should this be done only for wares or also for workers?

This is not strictly related to the shipping algorithm though, it needs to go in a completely different code path (and one which I am not very familiar with, so I can´t tell if it might have side effects...)


Top Quote
niektory
Avatar
Joined: 2019-06-03, 20:06
Posts: 206
Ranking
Widelands-Forum-Junkie
Location: Poland
Posted at: 2020-02-03, 23:16

Nordfriese wrote:

If there is the same ware type at the other dock, and it´s heading to the first dock, swap their destinations. If this is not the case, but the given ware type is stored in the other port´s warehouse, use that one instead and cancel transporting the current ware.

Should this be done only for wares or also for workers?

Would be nice if it was done for workers too. Should be especially useful in case of builders because they move around a lot (and it's hard to ensure you have enough of them in every colony).

I also have another unrelated idea. What if the number of wares in a warehouse was considered when requesting a ware by a production site, so warehouses with a big surplus would be preferred over near-empty ones? Distance would still be the primary factor, this would only be considered when there are several warehouses with similar distance to the requesting site.


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2020-02-03, 23:18

i suppose for workers too. i got very frustrated playing a sea map today because i had plenty of wares and workers on the colony but the game insisted in shipping them from the mainland.

we need to make an exception for wares that are simply going to the warehouse, though, like if a warehouse is set up as preferential storage. in that case the wares are just getting stored there, and you do want them transported. only wares/workers that are requested by a bulding are double-checked.

speaking of shipping, i noticed another weakness of the shipping algorithm: the incapability of recognizing that one ship doesn't have enough cargo hold to take all the wares. i had those two very distant ports, and i had hundreds of wares and workers to be transported. and yet, one single ship was called. the ship would crawl to the distant port, load the wares it could, and only then a new ship would be called. again, only one. so, i had one port that could not ship all the wares it accumulated, and i had half my ships idle. the port should be taught to call a new ship when the amount of items to be shipped exceeds the capacity of a single one. also, the current algorithm results in a few ships loading 40 wares and doing a very long tour of all the ports, while other ships are idle. I'd also add that if you have at least 2 idle ships, the port should call a second ship when it exceeds 20 wares anyway, to split the load. and then only load the first 20 on the first ship, and the rest on the second. if you have at least 7 idle ships, it should call a new ship when it has 10 wares to ship.


Top Quote