Factorio

Factorio

576 ratings
Beginners Guide to Rail
By piper.spirit
A Beginners Guide To Rail intended to help new players with trains
25
13
2
15
4
4
2
2
2
   
Award
Favorite
Favorited
Unfavorite
The Golden Rule
Chain Signal Into Junction, Rail Signal Out.
This is the universal rule when using rail, and will work in all situations. By placing a chain signal before a junction, and a rail signal on every exit, pathfinding issues are eliminated from your network.

Rail Directions
A rail signal placed below the track, designates it one way, in the direction left to right.


A rail signal placed above the track designates it one way in the direction right to left.


A track with a rail signal above and below designates the track two way (eg trains can go in both directions).

The white position, on the other side of the rail track, indicates the space to place the rail signal in order to make the track two way.
Rail Signals
In Factorio, signals can be placed on the track, breaking it into blocks, which help to control and manage the network. Different blocks are represented by different colours- the actual colour is irrelevant, it is only there to help the player distinguish between each block.


There are two types of rail signal in Factorio, the standard rail signal, and the chain signal.
The standard rail signal will be open (green), provided the next block is free (no train present).
The chain signal will be open (green/blue), provided the next block is free and the next signal after it is open.


Since a chain signal reflects the state of the next signal, they are especially helpful in preventing blockages in busy segments of track. They can be incorporated easily by using the Golden Rule; Chain Signal In, Rail Signal Out.

The colours of the signals are
Green-Next block is free
Red- Next block is not free
Yellow- Next block is reserved for that train (all other tracks that cross, their signals turn red)
Blue (only chain signal)- Some blocks are available for the train, but some are not. Train will continue on it's route, provided the next signal on it's route is open.

A flashing signal indicates it is unable to divide the track. Either the track needs another signal somewhere, or the signal needs repositioned.
Track Designs and Junctions
There are pros and cons of each track type, one way vs two way, and different track designs.

Two Way Track
Uses less resources to set up, and can be helpful at the start of a game when space, or problematic biters might be an issue. However, it is harder to incorporate multiple trains on it, and to scale it up for future expansion. Plus two locomotives are needed to power the train, one facing each way.


One Way Track
Takes more resources to set up, as two lanes of track are required. It also takes up more space. However, one way track is far easier to scale up, when more trains are included within the network. For this reason, a one way track system is generally seen as superior.


It is useful to include electric poles within track designs, as electricity will be needed to power buildings at outposts and resource patches.

Track

Junction

Roundabout
Stations and Train Designs
In order to transport resources, two stations are needed. One that will load resources on to a train, and a station to unload them at the factory. When a station is placed onto the track, the space for each locomotive or wagon is shown by a white outline. This helps determine if there is enough space for the station, and the placing of the necessary infrastructure of inserters, boxes and belts.


Two way track, requires a train to have two locomotives; one at the front and the other at the back. It will travel into the station, loads/unload, then travel back out along the same track.


One way track, requires a train to have a single locomotive at the front. It travels into the station, loads/unloads, then the track is looped back onto the main rail system.


Ideally stack inserters are used when loading and unloading trains, as they are efficient at moving large amounts of items. Locomotives require refuelling too.


The default game setting is 1-4 (one locomotive and 4 wagons), however faster trains can be created using more locomotives, or more wagons could be included for greater capacity. Higher grade fuels can also be used to boost locomotive speed and performance.
Stackers
Stackers are basically a rail design that enable trains to "park". They are useful for areas that could have several trains waiting for track to clear eg a train station.



The design uses a chain signal to determine if there is space within the required parking slot without blocking the junction. Each parking space has a standard signal at the entrance, and a chain signal at the exit.

Note the chain signal at the exit, is one of the few times where the golden rule is not applied in the same way as before, especially if multiple stations are used. When a train is in a stacker, the idea is that it will only leave when there is space available down the line. The required rail signal(s) will be inserted further ahead, and will open up (when a space becomes available), and relay it's status to the chain signal within the stacker. So the exit for a stacker is a chain signal, until the end position, which will then be a rail signal.

One Way Station with Stacker

In this example, the golden rule has been applied, by placing a chain signal for every entrance into a junction, and a rail signal for every exit.
Station Outposts
A station outpost ideally should be connected off the main track and include a small stacker. This is good practise as it will help prevent blockages from occurring. An outpost that is close to enemy nests may need some defence, to protect it from biter attacks, should the pollution cloud spread.



It is also useful to include "Belt Balancers" whenever loading or unloading trains. These will evenly distribute resources amongst all the belts, removing the risk of costly time delays that can arise through bottlenecks.

Wagon Inventory Filter
It is possible to designate wagons to only accept specific items. This is done by selecting a wagon and using the middle mouse button on a storage location and selecting the item that is to be accepted. This is especially useful for resupplying outposts with defence materials.

Station Names and Limits
By giving stations the same name, this enables multiple trains to visit them all, provided the name appears within their route. This is useful, as it makes your train network more efficient and easier to manage. For example by giving all stations that load copper ore from resource patches the same name, this means several trains can collect copper ore from multiple patches.


The game facilitates this feature further by allowing limits to be placed on the number of trains that can visit individual stations. For example, by giving a train limit of 2 for a specific station, this means only 2 trains can be accommodated there at any one time. So if there are 7 trains in total that have the same route, 2 will visit that station and the other 5 will go to other stations. This makes full use of the network and their capacity.

The limit feature is a very useful tool within Factorio, as without it trains will always go to the nearest station within their route.
Wait Conditions and Circuit Network
Aside from the standard "Full Cargo" and "Empty Cargo", there is a large range of wait conditions that can be used to control trains. A specific time could be used as a condition, a number of items within the cargo could be used, or even a combination of several conditions.

Several separate conditions could be used using "OR", or multiple conditions together using "AND". For example, the train only leaves the station when there is at least 1,000 iron plate "AND" 50,000 sulphuric acid present. The train leaves when both of these conditions are met, as shown in the picture.


More complex conditions can be set up using circuit network conditions. Connect a station to the circuit network by selecting either the green/red wire, and hooking it up to signals. Stations can also be turned on and off using the circuit network. This could be useful for stations that are resupplying specific items to locations eg defence or energy requirements. For example station turns on when solid fuel is less than 300.
Depots
Train limits and stackers are a great way at managing the rail network and making the best use of trains and resources, however there is a future risk of potentially too many trains. If a train does not have a destination to go to after unloading, it can block the station causing a traffic jam. A depot is a great feature that can allow trains to visit and park if there are no load/unload stations available. It is also a good place to refuel trains.


Each individual station at the depot has a train limit of 1. A time passed/inactivity wait condition provides the opportunity for refuelling.
Rail Network Overview
Press the O button to bring up all trains and stations that are within the rail network. This is a good overview that can help locate trains, pinpoint problems or identify improvements within the rail system.


Remember to change a train's route fast, on a locomotive, "Shift+Right Click" copies a train route, "Shift+Left Click" pastes a route to a train. This is a time efficient way for changing many train routes efficiently.

It is also possible to set up temporary stations, to direct trains to certain parts of rail, by using the command "Ctrl+Left Click" on the map screen. This can be helpful, as it enables the player to use a train, to taxi them automatically to a specified destination (saves time).
Dynamic Stations (Beyond Beginner)
The railway network can be further optimised by the inclusion of dynamic stations. Dynamic stations make use of the circuit network to control the train limit, allowing for more or less trains to visit, depending on how much resource is available. For example, if there are more resources at a station, more trains can visit, if there are less resources, less trains can visit. This increases efficiency of the network and decreases the amount of player oversight needed for trains to run smoothly.


The easiest way to set this up is to link up all the boxes at the station to the circuit network, and connect them as input to decider combinators. The decider combinators will monitor the levels within the boxes and output a signal (L), when a certain amount has been reached. This output signal will be the "dynamic train limit" for the station, and will vary depending on the levels of resources present.




It takes 2K ore to fill one train wagon. So when there is enough resource available to fill one train with four wagons (8K), one decider combinator will output L, resulting in a train limit of 1 for the station. Since signals add up on the circuit network, when the 16K level is reached, another combinator will output L, so L is now 2. The more resources that are available at the station the higher L will be.

The train limit will never be more than 3 in this example as L can never be more than 3.



It is essential when using dynamic stations, that there is a depot present within the train system. If resources run low, there is the possibility of traffic jams occurring, as trains may not have a destination to go to after unloading their resources.

More Efficient Unloading of Trains
It may be necessary to improve how trains are unloaded to prevent blockages and costly delays. Inserters always pick the item that is closest to them, and this can create imbalances on the belts resulting in less optimal train unloading. Extra balancing can be included to reduce this issue, additionally the circuit network can be utilised to finely tune train unloads.





By hooking up the inserters that unload the train to the circuit network, then adding up all the station box contents and obtaining the average; it is possible for extremely efficient train unloading, as the inserters can be told to only operate if their box is equal to or below the average.
Final Thoughts
I hope this guide has given some light to those who are confused over railways, and provided a solid grounding in the basics of how to use trains. The range of options and possibilities is endless, and this is only just a brief summary, of what can be achieved within Factorio. Thanks for reading this guide. GL
31 Comments
EmeraldKittn Jul 24 @ 1:37am 
Absolute god-send. Never thought of using roundabouts, so take some Steam points as a lesson fee.
qwrosu Dec 16, 2024 @ 6:56pm 
Loved the guide.

Small point: a two-way track doesn't necessarily mean a bi-directional train. That only depends on if the endpoint stations have a loop or not. I designed all my early-game stations with a two-way track but a loop at each station, so it works as long as there's only one train on the two-way track and the others are waiting at stations or bypasses.
Exodus永 Oct 24, 2024 @ 9:34pm 
My fellow brother in Christ, my stupid ass would like to request an update to this banger guide
Jyawa Oct 7, 2024 @ 1:18pm 
Most useful resource I’ve found on this, thank you!
piper.spirit  [author] Apr 17, 2024 @ 4:00am 
Thanks for that! I don't actually have a bp for that one. I created it just for the guide. Excellent work!
doomgiver Apr 16, 2024 @ 2:54am 
Starfoth, here you go:
https://pastebin.com/v1Sq5YX5 (version A, same as whats shown in the guide, for 1-4 trains)
https://pastebin.com/0HFhZfLS (version B, flipped/mirrored version A, everything else is exactly the same)

feel free to share/improve/edit :)
Starfoth The Burgundy Silk Rug Mar 8, 2024 @ 9:22am 
Please pleeeease can I have the BP for one way station with stacker its so hot!
Gunnar Nov 19, 2023 @ 1:25pm 
@Kerry Filter inserters linked to chests, set to only activate when quantities in that chest fall below your desired threshold might work.
Tercero Nov 17, 2023 @ 6:41pm 
Thanks a lot for the detailed guide, it helped me a lot planning out my train system 😃
lelelelelelelelelelelelelelele Mar 3, 2023 @ 1:31am 
Do you have a BP book string for the railways in the screenshots? (Those roundabouts in wait condition section look awesome)