Currently Online

Latest Posts

Topic: Solution proposals for maritime shipping problems

Solstice_s_Return
Avatar
Topic Opener
Joined: 2020-01-28, 13:24
Posts: 62
Ranking
Likes to be here
Location: Finland
Posted at: 2020-01-28, 21:31

Problem no1: Ships are incapable of assessing what should be taken onboard and as a result for this, may ship goods through really ineffective (read:annoying) routes - particularly when there's multiple destination harbors. Simplest solution: Add routes-button to ship's cargo view. By clicking this, player can left-click two harbors and set the ship to only be available between these two ports. When routing is active, it can be cancelled by clicking the same button again.

Problem no2: Shipping orders cripple economies beyond seas. Very often there's insufficient amount of goods in colonies and missing goods are ordered to be transported over the seas. However, very often there's at the same time production facilities in action in these very same colonies, but after the order they just idle and say that economy doesn't need product x, and so the player ends up waiting and waiting and everything drags on because of those resources beyond the seas. Solution: Make Widelands detect borderlines so that if the destination of a particular good is outside of the current border line, it will be sent to a different economic zone. As long as the goods are on their route, the other economic zone can supply missing goods itself if possible. Regardless of that, the shipment will be shipped to its destination as a surplus goods, which may then be reshipped to different destination if necessary, but most propably they will be consumed soon anyway.

Any comments?


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-01-28, 21:59

Moin Solstice_s_Return and welcome in the forum face-smile.png

Problem no1: Ships are incapable of assessing what should be taken onboard and as a result for this, may ship goods through really ineffective (read:annoying) routes - particularly when there's multiple destination harbors.

Which Widelands version are you using?

Simplest solution: Add routes-button to ship's cargo view. By clicking this, player can left-click two harbors and set the ship to only be available between these two ports. When routing is active, it can be cancelled by clicking the same button again.

If you want to service only fixed routes, we already have ferries. No need to make ships more similar to them.

Problem no2: Shipping orders cripple economies beyond seas. Very often there's insufficient amount of goods in colonies and missing goods are ordered to be transported over the seas. However, very often there's at the same time production facilities in action in these very same colonies, but after the order they just idle and say that economy doesn't need product x, and so the player ends up waiting and waiting and everything drags on because of those resources beyond the seas.

True, that can be quite annoying...

Solution: Make Widelands detect borderlines so that if the destination of a particular good is outside of the current border line, it will be sent to a different economic zone. As long as the goods are on their route, the other economic zone can supply missing goods itself if possible. Regardless of that, the shipment will be shipped to its destination as a surplus goods, which may then be reshipped to different destination if necessary, but most propably they will be consumed soon anyway.

I´m not sure if I understand correctly. So, I have settlements on two distant islands connected by a sea route. Both have a brick kiln, economy target for brick is 40. Island 1 has 50 bricks in store, Island 2 has 20 bricks. So the kiln on island 2 would keep producing bricks until Island 2 has 40 of them?


Top Quote
Solstice_s_Return
Avatar
Topic Opener
Joined: 2020-01-28, 13:24
Posts: 62
Ranking
Likes to be here
Location: Finland
Posted at: 2020-01-29, 08:01

Thanks. I'm using build 19. So are those ferries capable of seafaring and not similar to boats in Settlers2?

You almost got it right, but not on the quantities front. More precisely: Lets say you've built a sawmill into your colony and decide to put a couple of more buildings under construction. The colony already has wood cutter and forester and is able to produce planks. However, the sawmill chooses to idle because there was insufficient amount of planks at that moment and so the needed stuff got ordered from some distant land but takes ages to get shipped to its destination. Moreover, the sawmill seems to think that because those supplies are available somewhere and there's just enough them, it isn't necessary to produce them here and so it chooses to idle way too often. In this situation it just isn't true that the economy doesn't need planks.

I think distinct economic zones connected through sea routes could be a big improvement here. Then each economic zone will have its own target values and if there's shortage somewhere, an order is placed immediately just like now, but without overriding the economic zone's own output. So if the economic zone is able to supply required goods itself in the meantime, it will try to do so until the shipment arrives.

I will upload my new map Tasmania soon to the maps page. The map is very seafaring-heavy scenario like map and thus exposes this problem very well.

There may be partial workarounds already available, like stockpiling, but then it cripples the economy elsewhere.

Edited: 2020-01-29, 08:25

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-01-29, 11:14

Build 19 is way outdated, and its successor build 20 as well face-smile.png I really recommend updating to the latest development version, which has tons of new features, e.g. a completely rewritten shipping algorithm and ferries, which are rowboats carrying wares (no workers) on predefined waterways which can be built between any two flags on the shore.

You almost got it right, but not on the quantities front. More precisely: Lets say you've built a sawmill into your colony and decide to put a couple of more buildings under construction. The colony already has wood cutter and forester and is able to produce planks. However, the sawmill chooses to idle because there was insufficient amount of planks at that moment and so the needed stuff got ordered from some distant land but takes ages to get shipped to its destination. Moreover, the sawmill seems to think that because those supplies are available somewhere and there's just enough them, it isn't necessary to produce them here and so it chooses to idle way too often. In this situation it just isn't true that the economy doesn't need planks.

Ah ok. So if there is a demand that is not just the economy target (but issued by a productionsite or similar), the ware will be brought as now, but if it is very far away a nearby building will produce this ware if possible and the new ware will be assigned to the request instead of the distant ware.

We already had similar considerations for this related case: A log is brought from far away; meanwhile a nearby woodcutter produces a new log. The ware should be exchanged then. But this will not be implemented because in a big economy the checks needed here would be far too CPU-intensive.

Splitting road networks connected only by ships into Economy Zones, and onl checking for wares where location and destination are in different zones, might be less costly, but there´s still a risk that it would make the game intolerably slow on big maps...


Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-01-29, 14:42

There is also special feature when you set wares in warehouse as "preferred to store here" - then the good is evenly distributed among all warehouses with such preferred setting. So you can use this to spread abundant wares across multiple distant warehouses and mitigate this issue.


Top Quote
JanO
Avatar
Joined: 2015-08-02, 11:56
Posts: 177
Ranking
At home in WL-forums
Posted at: 2020-01-29, 18:13

I have an Idea how to change this, probably without causing an explosion of CPU-load.

First, my assumptions on how a ware is requested by now: I guess, in the moment when a ware is needed, a building sends out a request on the whole global economy. Then the economy searches for the closest one copy of this type of ware and assigns it to the requesting building. Once the ware is on it's way, only the ware knows it's destination and the requesting site sets a mark to not request this ware again. Observations on my charcoal burners and woodcutters lead me to the conclusion, that wares which are just being on their way to a warehouse are treated was being already inside the warehouse. They change the direction of transportation on the road, when they go to a warehouse and suddenly a charcoal burner sets up a request.

Now my proposal how to change this in a way, that seafaring and maybe even "normal" transportation could hopefully profit from it:
There should be another instance of requests. If a ware is needed, it should set up a request on this new level. The following reaction is almost the same as known: The (global) economy looks out for the closest copy of the ware and sends it on it's way. The difference: The ware should not been assigned to the requesting building itself but to the closest warehouse (or port) and the requesting building should mark the ware as requested on this instance.

From now on, the requesting building shall only call requests for this ware to this (closest) warehouse. Only these local requests to the closest warehouse should be able to trigger a ware to be assigned to the requesting building.

In short:
Each new demand for a ware is first requested from the closest warehouse.
Only if not available there, it is requested from the global economy.
These global requests must be stopped as soon as the ware is on its way towards the target economy.
The ware must only be assigned to a requesting building if it is close to the closest warehouse.


Maybe this could be handled most reasonable if each flag gets a marking/tag/hint that assigns it to the closest warehouse. Somehow this is already the case, as normally each produced ware finds it's shortest way to a warehouse. I guess at the moment this is calculated for each ware individually.

Objectives that probably will occur:
1) A ware which is assigned to another warehouse because of a global request of another building, has to be marked somehow so it is excluded from other global requests.
2) Maybe on the level of warehouse-warehouse-transportation, a reallocation should be triggered when a global request finds enough copies of a ware to cover all demands.


Top Quote
Solstice_s_Return
Avatar
Topic Opener
Joined: 2020-01-28, 13:24
Posts: 62
Ranking
Likes to be here
Location: Finland
Posted at: 2020-01-29, 21:03

Tibor wrote:

There is also special feature when you set wares in warehouse as "preferred to store here" - then the good is evenly distributed among all warehouses with such preferred setting. So you can use this to spread abundant wares across multiple distant warehouses and mitigate this issue.

Thank you for the tip. I rationally thought that it can be in only one place at a time and did not bother to test if has other functions too. I think it is sufficient workaround for now, but can't be the final solution.

Also, as long as this is the solution, the "economy does not need product x" - message threshold should depend from how many separate economic zones a player has. So each new economic zone should increase the limit when the message shows up. But of course the game doesn't currently recognize those areas as different zones and to make it do so is in almost a half way to a full fix.


Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-01-29, 21:18

Solstice_s_Return wrote:

Also, as long as this is the solution, the "economy does not need product x" - message threshold should depend from how many separate economic zones a player has. So each new economic zone should increase the limit when the message shows up. But of course the game doesn't currently recognize those areas as different zones and to make it do so is in almost a half way to a full fix.

Why dont you just set own target number for a product? Let say, you have 3 preferred warehouse, so just set the target to 10 or 15 and auto-distributing algorithm should work fine enough.

This concept of "sub-economies" complicates entire logic. While know we have X available products in an economy, with this new design we would have two numbers - one for economy and second for sub-economy. The more complicated system the more chances something goes wrong and more corner cases.


Top Quote
Solstice_s_Return
Avatar
Topic Opener
Joined: 2020-01-28, 13:24
Posts: 62
Ranking
Likes to be here
Location: Finland
Posted at: 2020-01-29, 21:22

Jan0 wrote:

Now my proposal how to change this in a way, that seafaring and maybe even "normal" transportation could hopefully profit from it: There should be another instance of requests. If a ware is needed, it should set up a request on this new level. The following reaction is almost the same as known: The (global) economy looks out for the closest copy of the ware and sends it on it's way. The difference: The ware should not been assigned to the requesting building itself but to the closest warehouse (or port) and the requesting building should mark the ware as requested on this instance.

From now on, the requesting building shall only call requests for this ware to this (closest) warehouse. Only these local requests to the closest warehouse should be able to trigger a ware to be assigned to the requesting building.

In short: Each new demand for a ware is first requested from the closest warehouse. Only if not available there, it is requested from the global economy. These global requests must be stopped as soon as the ware is on its way towards the target economy. The ware must only be assigned to a requesting building if it is close to the closest warehouse.

Yeah, this is almost exactly how I thought the zones should work. However, I don't quite get the third point from the In short - list. Yes, it should also be done that way, but the major crippling part is waiting if you already have production site in that particular economy and because of the dispatched order it just waits instead of producing needed wares in the meantime if possible. Ships should be like moving warehouses when they're at sea and so their content can be reordered on the fly if destination zone can produce the required goods during the meantime.


Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2020-01-29, 21:32

@Jan0

I think this design is too complex.

Imagine a scenario when a warehouse is destroyed how should a ware heading there react? The production site will now address another warehouse - but what with previous "agreement" with previous warehouse?

Currently a ware has a destination - simple enough, but when primary destination will be warehouse, and weak secondary destination a productionsite... I mean the design should be as much primitive as possible. Evil is hidden in corner cases, as usual.

Experimenting with this stuff needs actual capability to modify C++ and many and many hours of work. Would be fun of course....


Top Quote