Train deadlock on a single-track line

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
Player701
Engineer
Engineer
Posts: 8
Joined: 12 Jan 2010 10:22
Location: Russia

Train deadlock on a single-track line

Post by Player701 »

Hello. I have a problem with trains on a single-track line. I'm uploading a screenshot and a savegame to demonstrate.

I have the following track setup. There is a line with terminal stations A and B. On this line, there are stations C and D. Each of the stations C and D has two platforms which allow one-way movement (each platform has its own direction), and a passing track, which allows two-way movement. Because there is only one track on the line which connects station A to station B via stations C and D, passing tracks on stations C and D can be used by a train to wait while another train passes from the opposite direction.

And here comes the problem.

Imagine there are two trains, train 1 and train 2. They are standing on stations A and B respectively. Train 1 needs to get to station B, and train 2 needs to get to station A. Both trains pass C and D without stopping (there may be other trains which stop there). When started, the trains will move forward until they reach stations C and D. They will then get stuck on passing tracks of C and D, waiting for each other forever. Each of the trains will try to reach the other station's passing track but will fail to do so because there is another train standing there. They will completely ignore the fact that there are free tracks with platforms on C and D which will allow them to pass.

Note that if I remove one of the track pieces marked with a red circle (on the screenshot), the corresponding train will recognize the platform and pass through it. After removal of the track piece, there are evidently no more ways to get to the other station except through the platform, so the train will go through it.

I know that this is somehow related to the way the pathfinder works. The question is: can this be fixed without changing the track layout? Maybe there is some configuration setting which will allow trains to pass through free platforms when there are no more free ways to pass?

I hope I was clear in describing the issue. Thank you.
Attachments
Safingley Market Transport, 29-е ноя 1950 г..png
(516.83 KiB) Downloaded 6 times
TrainDeadlock.sav
(102.66 KiB) Downloaded 126 times
User avatar
kamnet
Moderator
Moderator
Posts: 8705
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Train deadlock on a single-track line

Post by kamnet »

I was able to duplicate your problem. I was able to resolve it by going into the console and lowering yapf.rail_station_penalty to 499.
User avatar
siu238X
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 13 Sep 2004 18:54
Location: Hong Kong, China

Re: Train deadlock on a single-track line

Post by siu238X »

IMHO it's better to have the station spanning over the passing track as well.
With the default penalty of passing through backward PBS, the trains won't abuse your passing track unless the network itself is overcrowded.
Image
Image
Player701
Engineer
Engineer
Posts: 8
Joined: 12 Jan 2010 10:22
Location: Russia

Re: Train deadlock on a single-track line

Post by Player701 »

Thanks for the replies. Unfortunately, I wasn't able to solve the problem by lowering yapf.rail_station_penalty (I double checked that the pathfinder being used for trains is actually YAPF). I also don't recall changing pathfinder settings, at least in the past year. I'll post all the lines from my config file which start with yapf for reference.

Code: Select all

yapf.disable_node_optimization = false
yapf.max_search_nodes = 10000
yapf.rail_firstred_twoway_eol = false
yapf.rail_firstred_penalty = 1000
yapf.rail_firstred_exit_penalty = 10000
yapf.rail_lastred_penalty = 1000
yapf.rail_lastred_exit_penalty = 10000
yapf.rail_station_penalty = 499
yapf.rail_slope_penalty = 200
yapf.rail_curve45_penalty = 100
yapf.rail_curve90_penalty = 600
yapf.rail_depot_reverse_penalty = 5000
yapf.rail_crossing_penalty = 300
yapf.rail_look_ahead_max_signals = 10
yapf.rail_look_ahead_signal_p0 = 500
yapf.rail_look_ahead_signal_p1 = -100
yapf.rail_look_ahead_signal_p2 = 5
yapf.rail_pbs_cross_penalty = 300
yapf.rail_pbs_station_penalty = 800
yapf.rail_pbs_signal_back_penalty = 1500
yapf.rail_doubleslip_penalty = 100
yapf.rail_longer_platform_penalty = 800
yapf.rail_longer_platform_per_tile_penalty = 0
yapf.rail_shorter_platform_penalty = 4000
yapf.rail_shorter_platform_per_tile_penalty = 0
yapf.road_slope_penalty = 200
yapf.road_curve_penalty = 100
yapf.road_crossing_penalty = 300
yapf.road_stop_penalty = 800
yapf.road_stop_occupied_penalty = 800
yapf.road_stop_bay_occupied_penalty = 1500
yapf.maximum_go_to_depot_penalty = 2000
siu238X wrote:IMHO it's better to have the station spanning over the passing track as well.
With the default penalty of passing through backward PBS, the trains won't abuse your passing track unless the network itself is overcrowded.
Well, let's say, I'm trying to get a balance between realism and efficiency in my game.

Real world stations - I'm talking about stations with extended track layouts, not about those which are called "halts" or "flag stops" - usually don't have platforms on every track. Additional tracks can be used for passing, overtaking, performing cargo operations (besides simple loading / unloading - e.g. storing, sorting, etc.) and so on. In OpenTTD these tracks can only be used for passing, and sometimes overtaking (if a train stops at the station but the one behind doesn't); unfortunately, there's (perhaps only for the time being?) no way to do things such as storing series of cars on tracks, or coupling / uncoupling trains dynamically (not in a depot).
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Train deadlock on a single-track line

Post by Eddi »

changing the value in the config file does not affect your savegame. you must change it from the ingame console instead.
Player701
Engineer
Engineer
Posts: 8
Joined: 12 Jan 2010 10:22
Location: Russia

Re: Train deadlock on a single-track line

Post by Player701 »

First I changed it in console and it seemed to have no effect. After that I changed it in config file and started a new game. Still no effect though.
Vinnie_nl
Engineer
Engineer
Posts: 41
Joined: 13 Mar 2011 18:32

Re: Train deadlock on a single-track line

Post by Vinnie_nl »

On the same line as Eddi but i suggest that instead of lowering a pf penalty you increase the penalty of the backwards PBS.

set yapf.rail_pbs_signal_back_penalty 5000

Seems to do the trick. Tried 2x result was "realistic"

In other words either edit in the config file of openttd. start game and start new map to apply setting, or ingame load save press the ~ key next to the 1 above the tab and type yapf.rail_pbs_signal_back_penalty 5000. Return key and close with ~ key.

edit very important: the command is

set yapf.rail_pbs_signal_back_penalty 5000
Last edited by Vinnie_nl on 23 Jul 2013 07:04, edited 1 time in total.
ccomley
Traffic Manager
Traffic Manager
Posts: 227
Joined: 31 May 2013 16:19

Re: Train deadlock on a single-track line

Post by ccomley »

Player701 wrote: Well, let's say, I'm trying to get a balance between realism and efficiency in my game.
.
Ah, but "realism" would give you a signal box operator who would decide which train goes first and which route it takes! :-)
User avatar
siu238X
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 13 Sep 2004 18:54
Location: Hong Kong, China

Re: Train deadlock on a single-track line

Post by siu238X »

Player701 wrote:
siu238X wrote:IMHO it's better to have the station spanning over the passing track as well.
With the default penalty of passing through backward PBS, the trains won't abuse your passing track unless the network itself is overcrowded.
Well, let's say, I'm trying to get a balance between realism and efficiency in my game.

Real world stations - I'm talking about stations with extended track layouts, not about those which are called "halts" or "flag stops" - usually don't have platforms on every track. Additional tracks can be used for passing, overtaking, performing cargo operations (besides simple loading / unloading - e.g. storing, sorting, etc.) and so on. In OpenTTD these tracks can only be used for passing, and sometimes overtaking (if a train stops at the station but the one behind doesn't); unfortunately, there's (perhaps only for the time being?) no way to do things such as storing series of cars on tracks, or coupling / uncoupling trains dynamically (not in a depot).
I fully understand what you want to simulate when I posted the previous reply.

I only suggested putting the tracks under the same roof such that trains don't make stupid mistakes.
The unrealistic-ism, if exists, concerns the train's path-finding rather than any of the "track / station / signal layout" suggested in this post. I don't find it "unrealistic" putting passing tracks under the same roof (many stations in Britain have platforms facing passing tracks, as far as I know)

Player701 wrote: In OpenTTD these tracks can only be used for passing, and sometimes overtaking (if a train stops at the station but the one behind doesn't); unfortunately, there's (perhaps only for the time being?) no way to do things such as storing series of cars on tracks, or coupling / uncoupling trains dynamically (not in a depot).
Dynamic train coupling is probably yearned by most of us. I personally think that brings constructive challenge to the game play, and makes one plan networks better.

I had heard about a shunting patch lately, but I am not quite able to find it out.
Image
Image
Player701
Engineer
Engineer
Posts: 8
Joined: 12 Jan 2010 10:22
Location: Russia

Re: Train deadlock on a single-track line

Post by Player701 »

Vinnie_nl wrote:set yapf.rail_pbs_signal_back_penalty 5000
Hey, it worked! Thank you very much! :)

I hope it won't cause any other problem somewhere else... I have to test it.
ccomley wrote:Ah, but "realism" would give you a signal box operator who would decide which train goes first and which route it takes! :-)
A signal box operator would definitely prevent such deadlocks from happening :)
siu238X wrote:I only suggested putting the tracks under the same roof such that trains don't make stupid mistakes.
I didn't quite get you at first try, but now I do understand what you mean.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 5 guests