Page 1 of 1

Unnecessary train deadlock

Posted: 20 Feb 2025 14:57
by blind3rdeye
I've got a couple of trains that are blocking each other, and I don't understand why. One of the trains has a clear route to its destination. I don't see any reason why it won't just go.

I've been messing around with signal placement for ages trying to work it out. I can make it work by adjusting where the signals are, but I still can't understand what the problem is in the first place.

In my testing, I created a simplified version of the train network that produces the problem - this is shown in the attached screenshot.
ttd signal problem.png
(363.96 KiB) Not downloaded yet
Note: if I remove the signal that the cursor is currently pointing to, then the trains do not deadlock. I can also free the trains from deadlock by adding another signal behind the train on the left. Either way, I don't understand why the trains are deadlocked in the first place or how changing those signals helps.

I'm also attaching a save file with the actual (slightly more complex) network.

Re: Unnecessary train deadlock

Posted: 21 Feb 2025 03:04
by skc
NOTE: I'm ~99% confident I'm correct with my understanding of the internals of the pathfinding algorithms which underpins my response, though I haven't looked into it to be absolutely sure.

The pathfinder penalises routes which go through the 'back' of signals and use the diverging 'leg' of a junction.
There is only 1 opposing signal and 0 diverging junctions on the 'upper' route which is currently occupied by a train, while there are 2 of each on the route where you've got the cursor placed.
As a result, the pathfinder for the train in the station wants to go via the 'upper' route because the penalty for an occupied track is less than that for the 2 signals and junctions on the 'lower' route.

In this situation, I would do at least one of these 2 things:
  1. avoid making both sides of the 'loop' bi-directional - this will prevent the sort of deadlock you're experiencing as the pathfinder will see a almost-zero penality route down one side of the loop.
  2. use the type of signal in the lower-right of the Signal Selection panel - the white & red board is a visual aid to you to say that it can't be passed in the 'wrong' direction - the only valid way to pass the signal is to approach from the 'facing' direction.

Re: Unnecessary train deadlock

Posted: 21 Feb 2025 16:42
by blind3rdeye
Thanks. :) Your explanation makes sense, and I think it explains what I'm seeing. I had assumed that an occupied track would be treated as completely unusable by the pathfinder, rather than just 'undesirable'. I guess I was mistaken about that; and that's why I couldn't work it out. (Although, I'd still say what we are seeing is not how it *should* work!)

I'm slightly confused that you say you would "do at least one of these 2 things...", because your two things sound the same to me. Isn't #2 a description of how to make a one-way track (and therefore not bi-directional)?

Re: Unnecessary train deadlock

Posted: 22 Feb 2025 05:56
by skc
blind3rdeye wrote: 21 Feb 2025 16:42 I'm slightly confused that you say you would "do at least one of these 2 things...", because your two things sound the same to me. Isn't #2 a description of how to make a one-way track (and therefore not bi-directional)?
You're right, they very nearly are the same.
The 1st just involves you removing some signals you already have.
The 2nd involves replacing signals as well as removing the extras.

An advantage of the 2nd method is that it will still be impossible to get a deadlock when you add a 3rd train onto that small network.

I would also remove the signal between each station and the junction - it'll save you a few $$ in infrastructure maintenance.