OpenTTD / OpenTTD

OpenTTD is an open source simulation game based upon Transport Tycoon Deluxe
https://www.openttd.org/
Other
6.41k stars 896 forks source link

[Bug]: Train waits for free path when it doesn't have to #11340

Open DonaldDuck313 opened 1 year ago

DonaldDuck313 commented 1 year ago

Version of OpenTTD

13.4, Windows 11

Expected result

If there are two ways a train can go that are equally long but one is occupied by another train, the train should choose the one that's free. For example, in the following screenshot, the train should go along the red arrow:

Skärmbild 2023-09-28 213004

Actual result

The train waits for the occupied path to be free. For example, in the following screenshot, it wants to go along the red arrow, but that path is occupied so it's waiting for a free path instead of using the path that's already free:

Skärmbild 2023-09-28 213004

Note that there is a signal under the bridge in the middle track for trains going the other way, but that allows trains to go through it both ways (if it's not clear what I mean, you can download the saved game below and see for yourself). Removing the signal solves the issue. But normally occupied tracks have a higher penalty than tracks with a signal going the other way, so I don't see why that shouldn't be the case here.

Steps to reproduce

  1. Download and open this saved game: Stora Miggsvall Transport (no newgrf).zip (sorry it's in a zip file but GitHub refuses to let me upload .sav files)
  2. Look at train 9. It's on its way to Fomberg (which is in the direction the red arrows are pointing in the screenshot above), so obviously the best way to go is to use the middle track. The problem is that it's trying to use the track that train 17 is on, so it has to wait for train 17 to move, which itself has to wait for train 15 to move, which will take a while. I In this case I stopped train 15 to make it easier to see the problem before it goes away, but earlier train 15, which is on a schedule, was stopped at Kröndlöv Kalkbruk for a while to wait for its schedule, so train 9 has been sitting there for a while for no reason. The entire reason I built the middle track was to avoid situations like this, so it's annoying it didn't work.
  3. You can try removing the signal under the bridge on the middle track and then train 9 will use it, which shows that the signal is the problem.
  4. You can also try un-electrifying the track that train 17 is on and then train 9 will also use the middle track, which proves that it can, it's just not willing to pass through the signal if it doesn't have to (even if this means waiting for a long time for the other track to be free).
  5. If you try to un-stop train 15 so that train 17 can pass, train 9 will use the middle track as expected as soon as train 17 moves. So it seems like it's not entirely unwilling to use the middle track, it just waited for train 17 to move for some reason.

What's even more weird is that if I wait a while for train 75 to arrive in this area (train 75 is headed in the same direction as train 9), train 75 uses the middle track through Kröndlöv station and then continues on the middle track to pass train 17 just as it should, which train 9 isn't doing for some reason.

PeterN commented 1 year ago

Turn on path reservations. I think you'll find the path is reserved by the train leaving the station in the top left.

DonaldDuck313 commented 1 year ago

Turn on path reservations. I think you'll find the path is reserved by the train leaving the station in the top left.

It doesn't seem like it's reserved:

Skärmbild 2023-09-28 215032
PeterN commented 1 year ago

Ah sorry didn't see the signal there.

The default for pf.yapf.rail_pbs_signal_back_penalty of 1500 seems to be too high in this instance.

You could put a another reverse signal on the adjacent track with the waiting train to fudge it.