How-to: Two-way rails

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
dood
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Mar 21, 2018 8:36 am
Contact:

Re: How-to: Two-way rails

Post by dood »

impetus maximus wrote:especially early on when resources are scarce
The only times I've had iron scarcity on that kind of level happen was when I was a beginner and never built rails because I didn't understand them and what are trains good for anyway when I have belts etc.
The solution is to plan ahead and make a move to secure more resources early.
adam_bise
Filter Inserter
Filter Inserter
Posts: 443
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: How-to: Two-way rails

Post by adam_bise »

I use a two way system with branches and one gargantuan loop, but that is just how I like to play. I spend a lot of time just trying stuff out or exploring for huge patches, my productivity certainly isn't anywhere near some of the bases I've seen on this forum.

I prefer to have smaller bases, more of them, much farther apart, and loooong trains moving a ton of items at once. Also, my bases are not connected via electricity and so the longer trains aren't derailed by behemoth biters =)
thorr18
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat May 04, 2019 3:18 am
Contact:

Re: How-to: Two-way rails

Post by thorr18 »

I love this old post. Everywhere else I looked, people seem to presume 1-way rail is the only way or scoff at the mention of 2-way rails. With the help of this guide, I got my broken factory off the ground and won the game using all 2-way rails (with 7-car passing lanes sprinkled throughout based on your "four-car split" ). For me, two-way is the only way!
peternlewis
Inserter
Inserter
Posts: 49
Joined: Mon Aug 27, 2018 4:40 am
Contact:

Re: How-to: Two-way rails

Post by peternlewis »

Great post, still highly relevant.

I tend to use two lane, one way rails around my base and for nearby initial outposts, and nearby initial resource patches. In the last game I played, I expanded the main bus of the rail system to four lanes (two each way) to enhance throughput in that area.

Then I will often use one or more large one way loops to access further resources, with ore patches being short one way loops off the main loop, which also allows room for buffering trains.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3110
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: How-to: Two-way rails

Post by BlueTemplar »

Two-way rails are probably going to need "double signals" in order to fix issues due to lack of automatic re-pathing :
[0.17.66] Trains waiting at regular signals do not try to Repath every X seconds ?
viewtopic.php?f=23&t=75140
Image
(Green train won't re-path.)
Image
(Supposed) solution :
Image
Last edited by BlueTemplar on Fri Mar 11, 2022 12:09 pm, edited 1 time in total.
BobDiggity (mod-scenario-pack)
Tallywort
Inserter
Inserter
Posts: 23
Joined: Thu Mar 25, 2021 11:57 am
Contact:

Re: How-to: Two-way rails

Post by Tallywort »

I kind of have to disagree on that, even when using two way tracks that scenario seems rather rare and unlikely. And even if it does occur, it isn't too bad to have a train take a longer route or path to further station once in a while.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3110
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: How-to: Two-way rails

Post by BlueTemplar »

I reported it because it happened to me. In a vanilla game (Death World + Marathon) where (IIRC) I wasn't even at yellow science yet.

Also, you don't seem to understand the issue ? Which is that the train(s) do NOT take the longer route, but get stuck instead, potentially forever.
BobDiggity (mod-scenario-pack)
robot256
Filter Inserter
Filter Inserter
Posts: 921
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: How-to: Two-way rails

Post by robot256 »

Repathing is not allowed to change direction after the train leaves a station. The devs have said before this will not be changed, for performance reasons.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: How-to: Two-way rails

Post by aaargha »

BlueTemplar wrote: Fri Mar 11, 2022 12:08 pm I reported it because it happened to me. In a vanilla game (Death World + Marathon) where (IIRC) I wasn't even at yellow science yet.

Also, you don't seem to understand the issue ? Which is that the train(s) do NOT take the longer route, but get stuck instead, potentially forever.
That is a pretty interesting bug report, BlueTemplar. I did some additional testing and the trains only get stuck if they are waiting at a rail signal, for chain signals the train will happily switch direction after waiting about 5 seconds. While this kind of feels like a bug I can understand the rationale of having the train run the pathfinder again for chain signals but not for rail signals (the former usually have multiple paths while the latter usually don't, except for bidirectional trains & rails)

Attached is a save file where I recreated the setup from you bug report (the save is too old to load in current 1.1.61), just remove the train limit on the train stop to the right and the train will switch direction and go there, if I used rail signals the train remains stuck. The setup on the left is a simple example of switching directions, just send the train going and you'll see how it works.

That said, the situation you're showcasing is something you'll only run into when not following the rules outlined in the guide, specifically the first part:
The only signals you are allowed to place on two-way tracks are chain signals.
Following the rule will prevent the issue in two ways: 1) trains should never stop in the kind of place where this would be an issue; 2) chain signals allow the train to switch direction.

Please do get back to me though if you have any examples where my analysis does not hold.
Attachments
direction_change_Test.zip
(626.96 KiB) Downloaded 109 times
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: How-to: Two-way rails

Post by aaargha »

robot256 wrote: Fri Mar 11, 2022 1:24 pm Repathing is not allowed to change direction after the train leaves a station. The devs have said before this will not be changed, for performance reasons.
While they may have said so (or some version of it) it is not true, see counterexample in the post above.
mrvn
Smart Inserter
Smart Inserter
Posts: 5865
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: How-to: Two-way rails

Post by mrvn »

While it might be true that trains can change direction on a chain signal but not on a full signal isn't that all besides the point?

The train setup in the example above is totally flawed. A two-way rail must only contain chain signals except for where it exits into a one-way rail. All the signals in that big loop should be chain signals and then the green train would not get stuck and would have driven the other way from the start.

So I consider this a none issue since it only affects train setups that are flawed.
Post Reply

Return to “Railway Setups”