News:

SimuTranslator
Make Simutrans speak your language.

Limiting convoi speed to avoid "bumping" into preceding one

Started by dantedarkstar, May 17, 2009, 06:55:05 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

dantedarkstar

This idea just occured me yesterday or so. Would it be possible and easy to make convoi limit their speed as not to "bump" into a preceding one ?

If we have two convoi one after another, and the second one is slightly faster it will "catch up" with the previous one. Unfortunately at this moment it will stop (exactly when it reaches the end of the square and the preceding one is still occupied). This often makes a big slowdown (especially for faster and weaker vehicles), not to mention it "streches" the traffic effectively making them occupy more space.

What if...
When convoi detects that the next square in the route is occupied by non-stationary vehicle, it will limit its own speed to current speed of the blocking vehicle. Since the detection will take place just as convoi enters the new square, then the limited speed will mean the blocking convoi WILL vacate the preceding square before the convoi in question will attempt to enter it.
Since we have overtaking that already checks for vehicles in front, including its speed, I hope this might be easier to code. In fact, if the overtaking checks were done just when the vehicle entered new square (not when it actually "bumped" into preceding one), then both "limiting" and "overtaking decision" can be handled by the same function. If the vehicle checks and it CAN overtake, it will overtake. If not, it will limit its own speed to the vehicle preceding it.
This way, the vehicles will actually move more "organic". Different speed vehicle column will just have to drive with the speed of the slowest at the front (unless overtaking will happen), instead of constant "bumping" and stopping at 100kph just because the vehicle before us drives 99kph. And probably will increase average speed on high traffic roads.
Links+Tutorial: Make heightmap of any part of world !
http://forum.simutrans.com/index.php?topic=2210.0

prissi


dantedarkstar

If the check for overtaking was made the moment the preceding vehicle was detected (I'm not sure when it is done now), then the convoi could decide - overtake if it can, or limit speed if it cannot overtake (for whatever reason).
The only bad thing I see is that the vehicle that couldn't overtake due to some unlucky condition might get stuck behind a very slow vehicle, and since it will be on limit all the time, it will never gain speed to be 5kph over preceding and proceed with overtake.
The solution might be to not limit itself IF all other conditions aside from speed allow overtake and base speed was at least 5kph higher (so overtaking is possible at least in theory).
I think I will take a small peek into overtaking code, then maybe I can come up with an efficient solution (or maybe not ?).
Links+Tutorial: Make heightmap of any part of world !
http://forum.simutrans.com/index.php?topic=2210.0

prissi

This still would not avoid bumping. Imagine a third vehicle (or a city car, which accelerate much faster). This will follow close and since the main convoi will accelerate, it will follow. Suddenly the convoi in front deccelerate and it must even deccelerate further. After five convois the whole thing will come to a stop anyway. (THis happens also in reality ... )

jamespetts

I certainly support the idea of improving the traffic flow in this way: the present arrangement is unrealistic and looks odd. If the "bumping" as it has been called can be reduced to a realistic level, even if not eliminated entirely, this would be a great improvement.

Dante: if you would like to code a patch, I will consider it for inclusion in Simutrans-Experimental :-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.