Railroad Tycoon style signaling

Post all other topics which do not belong to any other category.
Post Reply
Gus_Smedstad
Fast Inserter
Fast Inserter
Posts: 163
Joined: Fri May 16, 2014 2:30 pm
Contact:

Railroad Tycoon style signaling

Post by Gus_Smedstad »

I've been playing with the Marathon and RSO mods, which has forced me to build a substantial, long distance rail network during regular play, not in the post-victory stage or just for kicks. Because resources were very, very short when I had to build my first long distance rails, I went with two-way traffic on a single rail. Not a problem with a single train, obviously. As I expanded I experimented with a largely single-track network, with occasional passing blocks, and it worked surprisingly well.
Passing Block
In vanilla, double-track single-direction rail makes sense, because the distances are all pretty short, and train volume per track-mile somewhat high. The Marathon + RSO setup mimics Railroad Tycoon, which in turn mimicked real life - distances between stations are very long, rail a substantial outlay, and traffic density over most long stretches low, only getting high near the hub. Single track works nearly as well as double track for most of it.

Railroad Tycoon had a somewhat simple rail model. Any number of trains could occupy a signal tower, but the blocks between signal towers could only take 1 train per track. However, direction didn't matter, so a double-track block could take 2 trains going in the same direction just as easily as trains headed in opposite directions. This meant that fast trains could easily pass slow trains, which was common since RRT had short, fast passenger trains and long, slow freight trains. The typical Factorio two-lane track can't do that.

This is generally a non-problem with most Factorio train setups, since I imagine most of us run trains of very similar length. I'm currently running 1 locomotive + 2 wagons for all my trains except my passenger train I use to maintain stations, which is a double-header with a single wagon. You may run much longer trains, but odds are they're nearly the same length.

Still, that had me thinking "how would I solve that?" That is, how could a create a two-track system where trains could run in either direction on either track, switching tracks at signal blocks if desired, or waiting if the rail block was full?

I thought I had a relatively simple solution until I discovered how finicky train pathing is. Trains will always choose the shortest path, even if that path is currently blocked by another train waiting at a signal. An early "waiting zone" I created for my master train station clogged up because trains ignored sidings and waited for the most direct route to open.

What does work is paths that are exactly the same length. Trains will choose any track and pass stopped trains if the paths are equal length.
Waiting Zone
Thus, a theoretical signal block might be possible, one that routes trains to one of 2 two-way tracks, and which allows trains to wait if both are full, or pass trains in either direction without delay. The obvious thing was to split into 4 one-way tracks, two in each direction, since regular rail signals really need one-way track.

What defeated me was keeping all paths the same length. If the first block's tracks are A1 and B1, the signal-tower tracks are East 1, East 2, West 1, and West 2, and the next block's tracks are A2 and B2, invariably there would paths that were shorter than others. A1 -> East 1 -> A2 and A1 -> East 2 -> A2 might be the same length, and A1 -> East 1 -> B1 and A1 -> East 2 -> B2 were the same length, but A1 -> A2 paths were shorter than the A1 -> B2 paths, so trains would never switch from A to B if B2 was full.

Here's an odd-looking and space-consuming attempt. Some curves are in there in an attempt to adjust path length. There are signaled waiting segments at the start and end in both directions.
Signal Block

User avatar
bigyihsuan
Filter Inserter
Filter Inserter
Posts: 299
Joined: Thu Jan 01, 2015 12:57 pm
Contact:

Re: Railroad Tycoon style signaling

Post by bigyihsuan »

Huh, that's neat.

What we really need is a path signal like in OpenTTD that, instead of reserving a path for the train through the block, forces the train to recalculate its path once it reaches that signal. This is to not have to use a station with a wait time of 0 to force the recalculation of the path.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Railroad Tycoon style signaling

Post by ssilk »

I thought, this is done with 0.12.4?

https://forums.factorio.com/forum/sea ... sf=msgonly
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Gus_Smedstad
Fast Inserter
Fast Inserter
Posts: 163
Joined: Fri May 16, 2014 2:30 pm
Contact:

Re: Railroad Tycoon style signaling

Post by Gus_Smedstad »

I'm pretty sure trains insisting on waiting when there's a clear path still happens in 12.4, but I'll retest when I get a chance.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Railroad Tycoon style signaling

Post by ssilk »

If not, make a bug report. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Gus_Smedstad
Fast Inserter
Fast Inserter
Posts: 163
Joined: Fri May 16, 2014 2:30 pm
Contact:

Re: Railroad Tycoon style signaling

Post by Gus_Smedstad »

I've done some testing. It turns out that trains will persist in pathing through locked train blocks if the open path is longer than the blocked path.
Path through locked block
In this example, the green, yellow, cyan, and purple trains each found an alternate path, but the white locomotive does not. This is because the G block is longer than the A block. This is true even if I replace the chain signal between the E and G blocks with a rail signal - the white locomotive does not bypass A-D blocks to enter G block.

However, if I make all the blocks longer, the white locomotive does enter E.
Longer blocks
This is because A is now longer than G.

With this in mind, I mocked up a simpler double-track signal block, and tested that it does work, because it's relatively easy to make the lockable blocks longer than the switching blocks.
Double track signal block
It has another problem - a train pathing through the switching area blocks both two-way tracks. This limits it to one train per block despite the two tracks. The two-way track has to split into separate one-way track segments before the cross-track switching, since the chain signals turn the two tracks into one big block if they touch.

This ends up being much bigger, but it works. I took a little extra space to enable proper signaling for both cross-overs - mashing them together made placement of some signals impossible. The rail signals protect the two-way segments from the rest of the signal block.
Signal block v. 3

Post Reply

Return to “General discussion”