My Train Junction Layout needs some tuning!?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Gecko
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sat Nov 29, 2014 8:52 pm
Contact:

My Train Junction Layout needs some tuning!?

Post by Gecko »

Hello dear reader!

Since the trains got smarter somewhere around .11.13 I tried to implement a lot of train networking in my worlds and even dedicated a whole map to see whats possible with trains.

I'm always runing in a simple but crucial occurence: Junctions! I figured that one-way-rails are more efficient as there are only trains using the rail in one direction, so shorter waiting times. Upon this the design of my junction seems not far to seek yet pretty slow working.
For visualisation purposes I added a picture of the junction. All inbound connections (red arrows on the sides) have directly before the junction a signal. This means if one train uses the junction, no other train can enter.

I tried signals on the black marked spots. Those positions seemd to be logical because if one train uses the outer ring to turn left, i.e. a train from the oposite side can pass the junction and doesn't have to let the turning train complete it's turn.
In addition I added signals on the red marked spots to see if it improves the 'smoothness' of the trains passing the junction. In most cases this junction works fine...

BUT once in a while all my trains are gone - at least nothing is passing by my HQ. When I take a look around I find them gridlocked on one of the junctions (the blue squishy thomething I marked. One in the middle comming from the north and one from the left). So I abandoned my idea of a fast working junction and keept instead only four signals (one on each inbound intersecting rail).

Can anybody tell me what I'm doing wrong? I thought I'm rather advanced in this game but this junctions giving me a hard time.
Trainlogic
Looking forward to any suggestions, comments!
Cheers!

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

Re: My Train Junction Layout needs some tuning!?

Post by ssilk »

You do nothing wrong. The problem is, that Factorio misses pre-signals.
That is a new signal type, which jumps to green only, when it can reserve a paths for its own. See http://wiki.openttd.org/Signals#Pre-signals

In other words: Avoid setting any signals, where the distance between two signals is shorter than a train or can be blocked in a way, that another train must stop, because the first train is in the way, but that stop will also block the first. Uhm. :) Perhaps better: Avoid creating junctions, where you place signals inside the junction, or do that only, if you think through all possibilities. Or wait, until they implement them. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Xeteth
Fast Inserter
Fast Inserter
Posts: 158
Joined: Tue Feb 17, 2015 6:06 am
Contact:

Re: My Train Junction Layout needs some tuning!?

Post by Xeteth »

I too am having trouble with my rail network - I am currently working on a world with Dytech and BobsMods installed, so I have various bases and massive stations in the rail network and an estimated 50 or so trains.

The issue is I can't seem to get a good design for a functioning junction. The best I came up with was this one, however I have trains get stuck since the distance between signals is less than the length of my trains. However if I remove the signals around the circle part it only allows one train on the junction at any time - therefore a massive backlog of trains occurs simply because not enough traffic can get through.


Image

As a side note - Are trains massively CPU intensive? If I stop all the trains the game runs very smoothly however if I run them all I get terrible FPS. If anyone can suggest a layout for junctions that allows high traffic without blockages that'd be amazing. (My train's are currently 2 locomotives and 4 wagons in length).

Gecko
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sat Nov 29, 2014 8:52 pm
Contact:

Re: My Train Junction Layout needs some tuning!?

Post by Gecko »

ssilk wrote: In other words: Avoid setting any signals, where the distance between two signals is shorter than a train or can be blocked in a way, that another train must stop, because the first train is in the way, but that stop will also block the first. Uhm. :)
This was my concern in the first place. I implemented this on the segments between the junctions some time ago. The signals are exactly as far apart as one train is in length plus an additional rail just to be on the safe side. I unified all the trains to one locomotive and three wagons. This ensures to pack the waiting trains as tight as possible to avoid them getting stuck in a station.


Xeteth wrote: If I stop all the trains the game runs very smoothly however if I run them all I get terrible FPS.
In one of the most reacent Friday facts one of the devs mentioned the same problem. They considered the smoke as on of the major reasons for the lag.


Xeteth wrote: If anyone can suggest a layout for junctions that allows high traffic without blockages that'd be amazing.
Exactly this is what this thread is about (in case you didn't read the headline). One post before ssilk mentioned:
ssilk wrote: You do nothing wrong. The problem is, that Factorio misses pre-signals.
meaning, it is not exactly possible at this state of development.

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

Re: My Train Junction Layout needs some tuning!?

Post by ssilk »

Gecko wrote:it is not exactly possible at this state of development.
Yes! There is no sure way to avoid deadlocks/gridlocks completely. Gridlocks have a "chance" of happening. It is the same problem as in a very big database-system: you cannot really avoid them and the more load you put on them, the more sure it will happen.
[Figuratively speaking in a database-engine one of the blocking train (=database operation) must be reset to the starting station. Then it will wait for some time and then the next train is reset. Until the database runs again. Here this approach is not possible.]

The only way you can currently avoid of happening that so often is
a) build lock-free crossings
b) build bigger lock-free crossings around the lock-free crossings
c) build crossings around the crossings to make them even more lock-free
d) repeat, until the chance for gridlock is quite low. :)

Well, another good tip I can give from a world I played with 80+ trains is this:

- Avoid crossings with 4 directions. They are a really bad idea. I was really successful, when I begun to build only crossings with 3 tracks (or 6, one in each direction). This 3-way-junctions are a lot more stable against gridlocks, than 4. And this is also much faster.
- Avoid building circles as crossings. I saw that often, but after my game I came to the conclusion, that I should really avoided them for junctions, cause - as you see in this thread - they are really slow, if you build them locking. Only one train can pass at one time. Instead I use the circles only ... as circles. Trains need to change direction: Circles can be built in the middle of a straight double-track: two tracks lead in, two out. And in that case you can built signals to part the both directions of the circle, so that trains going in opposing directions don't need to wait. It will in that special case only gridlock, if you put in more tracks. Well a rest of chance of gridlock still is there, if you jam all tracks until the circle.

TL;DR:
- Don't use 4-way junctions or circles to create junctions.
- Use better 3-way junctions. See also this article: https://forums.factorio.com/forum/vie ... =18&t=9044
- Use circles only for changing direction of train
- Build more tracks around junctions. try to avoid jams around junctions. If that doesn't help, use more tracks. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Gecko
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sat Nov 29, 2014 8:52 pm
Contact:

Re: My Train Junction Layout needs some tuning!?

Post by Gecko »

Thanks for your clarification, sslik!

Most of your hints I discovered by myself playing around with trains, but the 3-way approach is realy interesing. Considering the junction beeing used just 1/4 less this makes a huge difference in the speed trains are able to use the junction. I tested this in my train-dedicated world. It realy does wonders. Now at least two trains can use the junction at the same time. Maby even three as the post explains you linked to. Pretty nice indeed!

Post Reply

Return to “Gameplay Help”