Page 1 of 1

Train path isn't switching fast enough

Posted: Tue Jan 10, 2023 10:24 pm
by Tk1Elmo
(I'm a Factorio newbie) so I have been trying to build a modular train network, with blocks in which I can place factories and other production facilities. This far I am letting the trains run for a bit with different train stop orders (sample: 1-2-3-4-5-6-7-8-9-10-11-12, 12-11-10-9-8-7-6-5-4-3-2-1, 1-3-2-4-5-7-6-8-9-11-10-12 and a few more) to find errors and fails (the numbers are train stops). In this system of 4 blocks, are currently 3 trains, I used to have 4, but that would lead into dead stops at the edges because there are only 4 railways in there and with 4 trains there is no alternative, so I took one out. The requirements for this train network is that the trains can reach train stops in both directions and the trains are 1 locomotive and 3 train cars long. As you can see in the pictures below, there are some incidents where the trains seem to be in a deadlock, even tho there are alternative routs that are open for at least 1 or 2 trains. After waiting for like 3–4 minutes, sometimes one train decides to switch his route and take the alternative path, which unclogges the deadlock. But this takes incredibly long and does not always work. That is why I wanted to ask if there is any possibility to exhilarate this process of path switching and fixing the deadlocks or if this system that I built is fundamentally flawed. Thx for any help and excuse my bad English, writing is not my strength.  :D

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 12:23 am
by FuryoftheStars
My personal take is to make all rails one-way (and so do even number of rails, like 2 or 4, to allow for your 2-way traffic) and then put the stations in sidings/dedicated tracks off from the main rails. For busy enough stations, you may want to consider having stackers as well. As such, you may want to increase your block size some.

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 1:14 am
by astroshak
Two-way track is good for when you have exactly one train that you expect to be on it. An example would be a terminal station at a copper mine. Another example would be a dedicated rail line bringing coal in from a nearby mine to the coal fired power plant.

An actual system, however, you want paired one-way tracks. One track for going, the other track for coming back. You can set up station inlets and outlets to allow entry/exit from either direction.

If you are dead set on two-way tracks, then minimize your use of Rail Signals to just before and after stations. Use Chain Signals everywhere else, to try to prevent head-to-head deadlocks.

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 6:27 am
by robot256
While redesigning the system would result in far fewer problems, rhe immediate cause of repathing being slow is the train stop you put on a mainline bidirectional track. Train stops that the train is not stopping at penalize a path by 2000 tiles. The penalty for another train stopped and blocking a path starts small and increases over time. Not until the train on the left has waited a long time for the train on the right will it decide traveling through a station is a better path.

You should avoid putting train stops on bidirectional tracks and tracks that you expect trains to use when moving through the network.

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 9:26 am
by Tertius
If you're designing some kind of railway grid with 2 parallel unidirectional tracks, one back and one forth, and add tracks to all 4 sides, you have the dilemma that you cannot overlay the tracks with the next tiled section. It seems you tried to resolve this dilemma by using bidirectional tracks. However, bidirectional tracks are inferior to unidirectional tracks, and your grid has much too much rails in general - it looks pretty like some ornament, but it has limited functionality.

You can solve the dilemma by providing unidirectional tracks only on one side in the blueprint for one grid tile, for example only tracks on the left and on the bottom, but not on the right and not on the top. The tracks on the right are provided by the tiled section you add to the right, and the tracks on the top are added by the tiled section you add to the top. This way you don't overlay anything, you're only tiling.

It's not clear if such narrow railway grid is the best solution, because it's slow. If you have a certain amount of trains, they will often stop at crossings, and it's a huge amount of tracks to put down. It may be a better design to make tiled grids without rails for production lines and overlay a bigger railway grid that spans multiple production line grids.

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 1:09 pm
by robot256
Tertius wrote:
Wed Jan 11, 2023 9:26 am
If you're designing some kind of railway grid with 2 parallel unidirectional tracks, one back and one forth, and add tracks to all 4 sides, you have the dilemma that you cannot overlay the tracks with the next tiled section.
Geometrically speaking, there is no problem with a unidirectional rail grid. Imagine a single grid square enclosed by a unidirectional counterclockwise loop. Top side goes left, left side goes down, bottom side goes right, right side goes up. Now form your grid by placing these loops adjacent to one another. Each edge of the grid now has two tracks, one in each direction, in a left-hand drive system. The only tricky bit is deciding what intersection to use and how to make the blueprint overlap with itself properly.

Re: Train path isn't switching fast enough

Posted: Wed Jan 11, 2023 2:27 pm
by Tk1Elmo
Thx for the fast response, all your answeres were really useful. Hopfully i can build a working train network now :D