Explain intersection based vs. loop based rail networks

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

Explain intersection based vs. loop based rail networks

Post by Gus_Smedstad »

It's been a while (over a year, really) since I played, and with the release of 0.12, I was thinking about getting back into Factorio. In preparation for that I was reading the Creations board, to see what (if anything) people have done with the new features. I ran into some negative remarks about loop-based rail networks, and frankly, I don't understand.

What I've done in the past is set up two-lane rail networks, with each rail going only one way, and all trains having one locomotive. There are occasional points where a train can turn around, by following a section of rail that loops from rail1 to rail 2.

I've seen an example of an "intersection based" rail network, where there are two rails, each one way, but trains are all double-headed, and trains switch direction by pulling into a section on rail 1, and then reversing to exit on rail 2. That saves a little space by not requiring a rail loop from rail 1 to 2, but I'm not seeing how it's otherwise different. I'm also not seeing what prevents double-headed trains from going the wrong way, deciding to back out on rail 1 when you intend them only to leave the station on rail 2.

There's some mention of deadlocks on a loop-based rail system, and I don't understand how that's possible. If the loop system is all one way, there should always be one train at the front of a one-way rail. Deadlocks should only happen if you use Y-intersections instead of rotary intersections.

User avatar
Stickman
Inserter
Inserter
Posts: 40
Joined: Fri Jul 17, 2015 2:34 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by Stickman »

If you like what you've been doing in the past, then keep doing it. There's nothing wrong with loops. Other people prefer other methods. Do what you like. That's the great thing about Factorio; you can build stuff however you want and the only thing that matters is whether or not you like what you built.

The double-headed trains provide a few advantages, yes. The main advantage is the material savings in rail creation. You don't have to spend as much because you can accomplish the same task with fewer straights and curves manufactured.

The other big advantage is space savings. More compact designs means more complex designs but more efficient rail systems, too. Maybe it takes less time to transition between stations if a train doesn't have to spend that extra second or three playing ring-around-the-rosey just to get pointed in the correct direction. With a few seconds saved on each individual stop, that time quickly piles up in the long run. Especially with mega train stations or mega size load pickups and deliveries, those few seconds saved (and eventually minutes and eventually HOURS saved) means that your mega factory stays stocked with ore or plates or whatever you're transporting so it can keep working.

Think of it like the meta gameplay in MOBAs. Sure, you can play however you want, but the guy who sticks to the meta or finds a way to squeeze out every last drop of efficiency is going to be doing it that much better.

Deadlocks weren't a guarantee. Sure, before 0.12 they were easy to mistakenly create but they were also easy to avoid if you spent some time re-engineering your intersections. They're still possible to create, but much easier to avoid if you build them right with the new rail light.
I tried snorting coke once. The ice cubes got stuck up my nose.

imajor
Fast Inserter
Fast Inserter
Posts: 164
Joined: Thu Aug 14, 2014 11:02 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by imajor »

Gus_Smedstad wrote: I'm also not seeing what prevents double-headed trains from going the wrong way, deciding to back out on rail 1 when you intend them only to leave the station on rail 2.
If you add signals to the tracks, won't that make them one way? So then the train knows which one is forbidden?

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

Up until 0.12, when using roundabout (circular) junctions you had two options - either make each junction exclusive, so that only one train can use it at a time (even if technically they could share), or put signals in the middle and risk deadlocks. There were ways to mitigate it somewhat, with passing right-turns (left turns, if your traffic is left-handed), but generally those were your options.

In 0.12, with the addition of chain signals, this is now longer the case - dividing your roundabout into quarters with chain signals (and putting chain signals on all four entrances) makes the junction 100% deadlock proof, and allows maximum throughput. In my opinion this way is actually more elegant and simple than the cross junctions.

So I think it boils down to personal taste - I personally like having the roundabouts - they look nice, they are efficient (now with chain signals), and they are easy to build and understand. And I really don't like double-headed trains, but that's just a pet peeve :D

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

Re: Explain intersection based vs. loop based rail networks

Post by Gus_Smedstad »

While I'm not absolutely focused on efficiency, I'm always interested in hearing why one layout is more efficient than another.

Also, I'm not clear on how the chain signals on a rotary works. Isn't that the same as making the rotary a single block, so only one train can use it? If having a train in any quarter blocks off all the entrance signals?

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by ratchetfreak »

I think the biggest reason loops/roundabouts are more prone to deadlock is that a train has a harder time reserving the entire path through the roundabout because the individual blocks in the roundabout are longer.

Which means it's more likely that a train can reserve the first block of its route but not the second because another train has gotten there first. This results in more chances for deadlock.

While an intersection based network the "critical" blocks are much shorter so it's less likely that a deadlock can occur.

With chains this is no longer a factor because a train can't reserve a block after a chain without being able to reserve the next block in its path.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by ratchetfreak »

Gus_Smedstad wrote:While I'm not absolutely focused on efficiency, I'm always interested in hearing why one layout is more efficient than another.

Also, I'm not clear on how the chain signals on a rotary works. Isn't that the same as making the rotary a single block, so only one train can use it? If having a train in any quarter blocks off all the entrance signals?
Chains work by looking forward and making sure the train can leave the block before letting it pass. This means that on a roundabout, all trains going right (on a right hand drive network) will not block each other. If entrances and all internal signals were chains.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

Gus_Smedstad wrote:While I'm not absolutely focused on efficiency, I'm always interested in hearing why one layout is more efficient than another.

Also, I'm not clear on how the chain signals on a rotary works. Isn't that the same as making the rotary a single block, so only one train can use it? If having a train in any quarter blocks off all the entrance signals?
Consider this roundabout
Roundabout
Since every quadrant is it's own block, a train going from east to west for example will only reserve the top two quadrants. That means that any train coming from west going east or south, and any train coming from south going east, is free to use the roundabout at the same time. Please also note that all signals going into the roundabout are chain signals. This is important, when considering the following scenario:
Train 1 starts crossing from East to West. At the same time, Train 2 wants to go from South to North. Since the NE quadrant is reserved/occupied, Train 2 will wait outside the roundabout, so if Train 3 now arrives from West going East, it can use the bottom two quadrants.

So, basically, when using chain signals in this way, a train inside the roundabout only blocks what it needs, nothing more - nothing less.

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

Re: Explain intersection based vs. loop based rail networks

Post by Gus_Smedstad »

Since the internal signals are chains, I would have thought that once a train enters the rotary, all the internal signals and the entrance signals would turn red. I guess I'll have to build some actual rails to see how it works in practice.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by ratchetfreak »

Gus_Smedstad wrote:Since the internal signals are chains, I would have thought that once a train enters the rotary, all the internal signals and the entrance signals would turn red. I guess I'll have to build some actual rails to see how it works in practice.
no the chains that can still lead to an open path will turn blue.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

They actually turn blue, which I guess means "blocked in some cases, open in others", which happens if a chain signal is in the beginning of a block with multiple exits - some may be available, others not. Practically, I tried it with a train in the top two quadrants. All chain signals were blue, but a train going west to east had no problem passing through them.

I tried making the equivalent cross junction, but it gets to crammed to put any signals. Since I don't usually make cross junctions I won't say there is no way of making them as compact, just that the obvious way I tried doesn't seem to work:
Cross

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by ratchetfreak »

sillyfly wrote:They actually turn blue, which I guess means "blocked in some cases, open in others", which happens if a chain signal is in the beginning of a block with multiple exits - some may be available, others not. Practically, I tried it with a train in the top two quadrants. All chain signals were blue, but a train going west to east had no problem passing through them.

I tried making the equivalent cross junction, but it gets to crammed to put any signals. Since I don't usually make cross junctions I won't say there is no way of making them as compact, just that the obvious way I tried doesn't seem to work:
Cross
Making the left-hand turns (if right-hand drive) wider would help in find space.

OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by OBAMA MCLAMA »

yes, blue means atleast one path is blocked, and one is open.

I used to use loops over junctions, and i even still used them on SP after playing with @ColonelWill (the go to guy for trains)
But over time, i just became OCD against my own method. And will was not nagging me at the time about loops really, it was mainly from me, making his method (the junctions) in our multiplayer instance, and coming to like and love everything about it.

in the end, it IS personal preference. But i now believe junctions are superior. And i will be that guy that says "ahh, go with junctions instead of loops man, ack #WillQuoteOnAck"
When i stream twitch i always answer questions and try to help, come visit me.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

I tried fiddling with it a few minutes, but I'm too tired to get anything practical. If you (or any other cross-junction user) have a working 4-way cross junction to share I'd love to see it.

OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by OBAMA MCLAMA »

sillyfly wrote:I tried fiddling with it a few minutes, but I'm too tired to get anything practical. If you (or any other cross-junction user) have a working 4-way cross junction to share I'd love to see it.

You need to make that cross junction.. bigger, although with chain signals you can just not have a train enter the junction if room is a problem
When i stream twitch i always answer questions and try to help, come visit me.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

OBAMA MCLAMA wrote:
sillyfly wrote:I tried fiddling with it a few minutes, but I'm too tired to get anything practical. If you (or any other cross-junction user) have a working 4-way cross junction to share I'd love to see it.

You need to make that cross junction.. bigger, although with chain signals you can just not have a train enter the junction if room is a problem
That would defeat the purpose of having it efficient. Making an exclusive junction is easy. The great advantage (as far as I'm concerned) of roundabouts with chain signals is efficiency (trains can share the junction as long as their paths don't truly intersect), and simplicity (one circle, divide into quarters by chain signals, chain signals on entries, normal signal on exits).
It may be because I'm not used to making cross junctions, or maybe because I'm too tired right now, but I can't figure out how to make a cross junction with an equivalent efficiency, and comparable simplicity.

I saw this thread on the reddit - https://www.reddit.com/r/factorio/comme ... sm_wanted/ , but this junction is inferior efficiency-wise to the roundabout I presented (simplicity is negotiable, but I would argue my option is also way simpler, as it uses far less signals).

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

Re: Explain intersection based vs. loop based rail networks

Post by ssilk »

This is an interesting thread.

Some point I want to throw in:
To make a good rail-crossing, you need to think in chances. Think if "How probable is it, that a train will occupy this block?" and "What is also blocked, if this block is locked?"

This leads to some very simple ideas:
a) It is not a good idea, to lead a crossing of 4 (8 with two directions) rails into a circle, cause the chance, that a train locks a block inside the circle is obviously high.
b) Which leads to simple thoughts about 2-way circles (inner circle goes left, outer circle goes right)
c) ... and much more of such ideas. The forum is full of them.

But in the end you land at 3-way junctions. ;) Because here you have the minimal size of a block, only one lock and the lock is then only for one direction over 3 rails! No other crossing-type can hit this. :)
(I hope so, if not prove me wrong :) )
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by sillyfly »

Okay, let's try to calculate some things :)
I will assume for simplicity that trains never try to make a u-turn in a roundabout, because in a cross-junction it is impossible to begin with.
So we have 3 equally-likely scenarios involving two trains - having them arrive at 90 degrees, 180 degrees or 270 degrees. Each train is equally likely to want to turn left, right, or go straight ahead.
Boring math
Summing the results, we have 10/27 = 37% of the cases no train will be waiting.

Making a similar calculation for 3-way roundabout
More math
We get 1/2 = 50% of the cases there will be no waiting.

As for comparing this to a cross junction, I'm still waiting for a specimen :D

Edit: Comparing to this 3-way T-junction (https://forums.factorio.com/forum/vie ... 640#p92173) it has exactly the same 50% chance for a train to wait. It also has the exact same amount of signals required for the equivalent 3-way-roundabout, so I would consider them equivalent both simplicity- and efficiency-wise.

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

Re: Explain intersection based vs. loop based rail networks

Post by ssilk »

The interesting thing with such locks is, that they behave chaotic. You can see that at any traffic crossing: the traffic runs fluent until a certain point. And then it suddenly jams. And it keeps jamming. It doesn't go away. The traffic must fall under a certain point, before the crossing is unblocked again. :)

And it makes a lot of difference if the chance for this blocking is 50% or 63%.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Explain intersection based vs. loop based rail networks

Post by ratchetfreak »

ssilk wrote:The interesting thing with such locks is, that they behave chaotic. You can see that at any traffic crossing: the traffic runs fluent until a certain point. And then it suddenly jams. And it keeps jamming. It doesn't go away. The traffic must fall under a certain point, before the crossing is unblocked again. :)

And it makes a lot of difference if the chance for this blocking is 50% or 63%.
Studying intersections and programming traffic lights for a living I can tell you that there is always a tipping point. However the reason it takes a while to clear up once traffic drops back down below it is that the back log needs to clear first. But as long as the queue is shrinking then the jam is clearing up. It may take an hour but eventually it will clear up.

Post Reply

Return to “General discussion”