Latest Posts

Topic: about road promotion and demotion

king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-10-19, 12:27

The current algorithm for establishing if a road should be a main road or not has a simple counter that increases the value by 10 every time a ware has to wait at a flag, and decreases it by 1 every time a ware is not made to wait. This system is very simple calculation-wise, but it has a few flaws, the most important being that once there is a donkey, wares are more likely to be picked up immediately, and therefore a road is more likely to be demoted, even if a single carrier by itself is insufficient for it. I've seen rods with medium traffic become busy, then becoming efficient, not getting stuck anymore, and being gradually demoted; once a piece of the road is demoted, a traffic jam will be formed, which will cause the road to be promoted again within a minute or 2 so the jam will be fixed. It is especially important for roads without junctions, because after the first piece of the road the helpers will move wares at a rithm that will cause subsequent carriers to always pick up the wares immediately, thus causing all the roads afterwards to be demoted gradually, in a neverending cycle of promotion and demotion.

It doesn't really affect traffic in the long run, because those traffic snags get solved within a few minutes, but I find them very annoying; also, seeing a major highway with random pieces or smaller roads popping up in between is ugly. Many solutions have been proposed; some want to manually be able to promote a road, and here there is an old topic with proposed new algorithms that are more elegant and effective but likely too complex and calculus-intensive to ever be considered.

https://wl.widelands.org/forum/topic/1712/?page=1

However, I had a simpler idea. What if the current algorithm is kept, but with the simple addition that when a ware is transported along a busy road, the counter is reduced only if BOTH the carriers are idle when the ware is dropped? If instead there is one carrier busy, the value of the road is still increased by 2, or 5. That should be very easy to code, and it should fix the problem of broken highways, which is the only real probem of the current algorithm (yes, thhere are other inefficiences, but really, the impact of those on the game is very minor).


Top Quote