The International Simutrans Forum

 

Author Topic: Limiting convoi speed to avoid "bumping" into preceding one  (Read 2736 times)

0 Members and 1 Guest are viewing this topic.

Offline dantedarkstar

  • *
  • Posts: 98
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9566
  • Languages: De,EN,JP
Re: Limiting convoi speed to avoid "bumping" into preceding one
« Reply #1 on: May 17, 2009, 07:17:20 PM »
Then overtaking will never take place ...

Offline dantedarkstar

  • *
  • Posts: 98
Re: Limiting convoi speed to avoid "bumping" into preceding one
« Reply #2 on: May 17, 2009, 08:52:42 PM »
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 ?).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9566
  • Languages: De,EN,JP
Re: Limiting convoi speed to avoid "bumping" into preceding one
« Reply #3 on: May 17, 2009, 09:17:46 PM »
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 ... )

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Limiting convoi speed to avoid "bumping" into preceding one
« Reply #4 on: May 17, 2009, 10:18:12 PM »
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 :-)