Latest Posts

Topic: Logistics enhancement

DaggeTeo

Topic Opener
Joined: 2011-06-29, 16:09
Posts: 61
Ranking
Likes to be here
Posted at: 2018-10-16, 21:27

Widelands is one of my favorite games mainly because there's an element of both economy and logistics in it.

Ideas

Two features I believe would enhance this even further are 1. Safety stock levels in warehouse
2. Minimum item requirement for ships

1. Safety stock levels

For instance I like to divide my production in different sectors. One for food (meat, bread), one for taverns & inns and one for metal workings and military buildings (training center, arena etc).

So food section exports to both tavern sites and military buildings. I like to keep warehouse next to both these sites and have a priority for them. I don't believe the wares are divided equally between the two and therefore usually only the one ends up with a good amount. This means that one of the sites will require a longer transport between usage. I would like to be able to set a prioritized safety stock level so that the transportation between sectors occurs between warehouses rather than production/usage sites.

I would suggest that one would use the existing warehouse interface and that double clicking a ware (or shift/other combination) opens up a counter/tick window that lets you set the minimum required stock level.

Example:

Logic could be like this(ex. wheat):
Warehouse A with safety stock level set to 10 of wheat, no priority on wheat.
Warehouse B without any safety stock level, but with priority on wheat

If both A and B are empty and production sites have room for more wheat, then send the wheat to prioritized production site (mill, piggery, sheep etc)
If both A and B are empty and production sites are full, send wheat to A
If A is at safety stock level and B is empty/half full and production sites are full, send wheat to B
If production site requires the ware, send it from the closest warehouse, even if it means it reaches below safety stock level.

2. Minimum item requirement for ships

I wish there was a setting per port to set a minimum amount of wares for transportation. To avoid having ships sail half across the world for just a plank. It would be better if there was an option to set a minimum amount of items before the port sends for a ship. However I realize this could cause issues for rare items so I propose to mitigate that with two solutions:
1) If the minimum amount of wares isn't achieved in a certain amount of set time( example 5 minutes game time) the call for a ship still goes out.
2) If the ware has a high priority anywhere, the call for the ship goes out instantly.

I look forward to hearing the thoughts of the community face-smile.png


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

Safety stock levels in warehouse

I don't believe the wares are divided equally between the two and therefore usually only the one ends up with a good amount.

They aren't equally divided. They are divided by fact in which warehouse there is less wares of specific type. For example if you have:

  • warehouse A with:
    • 0 bread
    • 1000 meat
    • 1000 fish
  • warehouse B with:
    • 1000 bread
    • 0 meat
    • 1000 fish

Then:

  • produced bread will go to A
  • produced meat will go to B
  • caught fish will go to A or B with 50% of chances each

Also I have to mark here that all food wares are marked as "collect here" in each of warehouses.

This mechanism was tested many times and I can say for sure it was working in our last tournament (I used it many times). So if you have lack of specific ware, you should consider making faster roads and/or building up another warehouse next to empty one. Why? Consider warehouses as "attraction points" for a ware. The more empty warehouses, the bigger possibility is to send a ware there.

Also there is a possibility that your economy did maximum amount of specific ware and nothing else is produced. So you have bakeries, long roads and warehouses for bread. Then if your economy is not set properly, you produce for example 300 breads at once and then send them in a big traffic jam to all warehouses (f.e. 100 breads each). In one they are spent quickly, so after a while there is none of them. So the closest warehouse is sending bread and it takes ages (and you have total of 150 breads in all warehouses). But your economy settings is set to produce up to 50 breads, so your bakeries aren't working. If it is the problem, consider setting max limit to 500 or 700 breads.

Minimum item requirement for ships

This idea is quite interesting, but as you already mentioned, it can cause some major issues in some games. Also it will not work in all cases (there will be some ships with 1 ware taken immediately after queuing it in the port). And sometimes it is better to take only one plank instead of 2 of them. Why? Because one will go in completely opposite direction to the other.

Already ships algorithm was improved and hopefully it contain no bugs. Also it was tested in some artificial cases (once I made a simple program for testing ship algorithms). The results were that my idea of routing the ships is as good or worse than current situation.

Maybe you have a better idea how to solve the problem of ships? When I will have some time, I can try to add another case of algorithm with time/amount trigger. If you know anything about Python language, you can try on your own: https://github.com/einstein13/wl_ship_optimization

short conclusion

I like that you have some ideas how to improve Widelands! Maybe you have some ideas how to improve current algorithms and mechanics. That would be awesome! Unfortunately changing the game by adding more micromanagement is not seen as a good thing for lots of people. And some situations have workarounds already (that is "strategy" here face-wink.png ).


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

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-10-17, 08:29

As for the ships, i am a fan of having defining static routes for ship. So one ship can be connected to a set of ports (at least two ports). Of course this will not protect against having a ware sailing the whole world. I think this can only be prevented by adjusting the ware routing algorithm.

One thing i observe is: A construction site of an Empire fortress on an island does always lack 1 stone to finish the castle, it takes much time until the last stone arrives at the construction site. I thought building a fortress needs 8 stones and as soon the construction site is erected the demand of 8 stones goes out and 8 stones are going out from one warehouse (if 8 stones are available there). It seems that my thought is wrong, and the 8 stones are coming from different warehouses? If so, maybe this can be changed?


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

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

The problem with waiting for 8 granite in the same warehouse is that if you also build other buildings at the same time that need less granite or you have granite consumers, the 8 granite might never accumulate in the same warehouse, so you will never finish the building.

A possible solution might be that whenever a new ware gets produced, it checks if there is a fulfilled request for a building nearby that would be better satisfied by the newly produced ware and then swap the destinations.

Edited: 2018-10-17, 10:18

Busy indexing nil values

Top Quote
DaggeTeo

Topic Opener
Joined: 2011-06-29, 16:09
Posts: 61
Ranking
Likes to be here
Posted at: 2018-10-17, 21:42

einstein13 wrote:

Safety stock levels in warehouse

I don't believe the wares are divided equally between the two and therefore usually only the one ends up with a good amount.

They aren't equally divided. They are divided by fact in which warehouse there is less wares of specific type. For example if you have:

  • warehouse A with:
    • 0 bread
    • 1000 meat
    • 1000 fish
  • warehouse B with:
    • 1000 bread
    • 0 meat
    • 1000 fish

Then:

  • produced bread will go to A
  • produced meat will go to B
  • caught fish will go to A or B with 50% of chances each

Also I have to mark here that all food wares are marked as "collect here" in each of warehouses.

This mechanism was tested many times and I can say for sure it was working in our last tournament (I used it many times). So if you have lack of specific ware, you should consider making faster roads and/or building up another warehouse next to empty one. Why? Consider warehouses as "attraction points" for a ware. The more empty warehouses, the bigger possibility is to send a ware there.

Also there is a possibility that your economy did maximum amount of specific ware and nothing else is produced. So you have bakeries, long roads and warehouses for bread. Then if your economy is not set properly, you produce for example 300 breads at once and then send them in a big traffic jam to all warehouses (f.e. 100 breads each). In one they are spent quickly, so after a while there is none of them. So the closest warehouse is sending bread and it takes ages (and you have total of 150 breads in all warehouses). But your economy settings is set to produce up to 50 breads, so your bakeries aren't working. If it is the problem, consider setting max limit to 500 or 700 breads.

short conclusion

I like that you have some ideas how to improve Widelands! Maybe you have some ideas how to improve current algorithms and mechanics. That would be awesome! Unfortunately changing the game by adding more micromanagement is not seen as a good thing for lots of people. And some situations have workarounds already (that is "strategy" here face-wink.png ).*

I hadn't noticed this behavior myself, but it could be due to a multitude of reasons. In one way this speaks against my case of having a having a Safety Stock Level (henceforth SSL). In your conclusion you mention that micromanagement isn't always loved in the community. That is a fair point. But my proposition allows for a default setting, meaning micro management would be voluntary. The proposition would enhance the economic aspect of production management in the game, which I believe is one of the main draws for me and my peers.

This being said, the biggest point of having such a feature would be the affect it would have on transportation routes. It would lower congestion since it would enable just-in-time capabilities. Only necessary wares would be transported. This is important for avoiding unnecessary ship travels.

einstein13 wrote:

Minimum item requirement for ships

This idea is quite interesting, but as you already mentioned, it can cause some major issues in some games. Also it will not work in all cases (there will be some ships with 1 ware taken immediately after queuing it in the port). And sometimes it is better to take only one plank instead of 2 of them. Why? Because one will go in completely opposite direction to the other.

Already ships algorithm was improved and hopefully it contain no bugs. Also it was tested in some artificial cases (once I made a simple program for testing ship algorithms). The results were that my idea of routing the ships is as good or worse than current situation.

Maybe you have a better idea how to solve the problem of ships? When I will have some time, I can try to add another case of algorithm with time/amount trigger. If you know anything about Python language, you can try on your own: https://github.com/einstein13/wl_ship_optimization

Right, but this could easily be mitigated. Let's say that there are two settings
1) Minimum item requirement
2) Tolerance time, exemplified below

Example:
Port A requires a number of logs.
Port B holds 3 logs, has a minimum item setting of 5 items, ie we're below threshold. But the Tolerance timer is set to five minutes (game time). This means that during those five minutes, two things can happen. First case more logs could arrive at port B, meaning the call goes out before five minutes. Or second case, five minutes passes and no more logs arrive, still below threshold but the timer has met the tolerance point - call goes out for ship.

With certain wares or buildings you need items ASAP, this is where a wares priority would override the tolerance timer completely. Ie, say you need two planks at one building and your economy has two, one on the same island, and one on another island. By setting the priority for planks in the building to the highest you would tell all ports to send the plank as soon as possible without any delay.

Basically this approach is to average out the number of transports. There wouldn't be cases of stalled economy because the tolerance timer is an overrider as well as the priority. The combination is vital.

I would love to be able to contribute with actual programming. My skillz however are rather rudimentary. When my schedule leaves me more time I would probably learn some more by looking over code. I do however feel like a brat if I were to expect anyone to turn my thoughts in to concrete code. I could possible write some pseudo code if that is of any use?!

GunChleoc wrote:

The problem with waiting for 8 granite in the same warehouse is that if you also build other buildings at the same time that need less granite or you have granite consumers, the 8 granite might never accumulate in the same warehouse, so you will never finish the building.

A possible solution might be that whenever a new ware gets produced, it checks if there is a fulfilled request for a building nearby that would be better satisfied by the newly produced ware and then swap the destinations.

I'm assuming this has to do with my SSL-idea. And in that case I would say that the priority would be the following
1) Fulfill building request, take from closest warehouse regardless of level or straight from production site if suitable
2) Fulfill SSL at warehouse, take from production sites or preferred warehouse if items are available
3) Store at preferred warehouse or closest warehouse if non-preferred ware

One thing i observe is: A construction site of an Empire fortress on an island does always lack 1 stone to finish the castle, it takes much time until the last stone arrives at the construction site. I thought building a fortress needs 8 stones and as soon the construction site is erected the demand of 8 stones goes out and 8 stones are going out from one warehouse (if 8 stones are available there). It seems that my thought is wrong, and the 8 stones are coming from different warehouses? If so, maybe this can be changed?

This is a great case for my SSL-idea. Once you build a new port you could set the ports SSL for building materials to an appropriate level and thereby avoid the unnecessary transaction wait time when you decide to build a new building. In general this would be helpful when expanding your terrorrity as you could set building materials at the outer perimeter before you start building and thereby get materials sent on the way.


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

I was just thinking, maybe replace economy settings with warehouse settings? Then the number of wares that the economy wants to keep in stock would be the sum of the wanted stock for all its warehouses.


Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-10-18, 13:59

Well, the things should be as simple as possible.

In regard to SSL, the design could be:

if the warehouse has less ware then SSL on stock, it demands a ware. This is as simply as can be. Of course if there are two wares with the SSL for the same ware nearby, they can "steal" and ping the same piece of ware forever...


Top Quote