In other languages: Deutsch Español Français 日本語 Polska Русский Tiếng Việt 中文

Railway: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(added banner (from /ru))
 
(101 intermediate revisions by 37 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
<i>For the research see [[Railway (research)]]</i>
[[File:Railway_from_trailer_2020.png|thumb|right|430px|Railway in the [https://youtu.be/J8SBp4SyvLc official game trailer.]]]
:''For the research see [[Railway (research)]]''


The [[Railway]] is one of the [[Transport|main transport methods]] in Factorio. Although the installation of such an network is sometimes complicated and takes a large amount of [[items#resources|resources]] and space, it is especially [[Transport/What Transport for which case?|over large distances more efficient and faster]] than [[Belt transport system|belts]] and [[Logistic network|robot logistics]].
'''The Railway''' is one of the main transport methods in Factorio. Although the installation of such a network can be complicated, and requires a large amount of resource and space, it is faster and more efficient than [[Belt transport system|belts]] and [[Logistic network|robot logistics]], especially over large distances.


Besides the use as transportation medium it must be said here, trains can be quite enjoyable to drive!
Railway construction, however, is not understood instantly. It takes some time to learn the basics, such as automating transportation. Learning how to manage and maintain upkeep of a larger train network takes time and experience.


Railway construction, however, is not learned in an instant. It takes some time to learn the basics, such as automating transportation. Learning how to manage and upkeep a larger train network can take quite some time and a large amount of experience..
== Infrastructure ==


== Beginner ==
To build a railway, tracks (also called rails) must be built for the train to ride on. Typically, this is done via the [[rail planner]], but can also be done manually. Bear in mind that rails are placed on a two-tile grid, so a rail cannot be moved by only one tile.
This section covers how to build tracks. assemble trains, and get moving. This enables manual transportation over large distances using trains and covers the earliest iteration of railway tech.
 
; [[Railway/Tutorials]]
=== Minimum manually operated railway ===
: Sometimes a picture/video says more than a thousand words.
As a minimum a manually operated railway has to consist of:
; [[Railway/Do not cross the tracks]]
* [[Rail]]s (tracks)
: A train is very fast, take care! Entering/exiting a moving train is possible, but dangerous.
* [[Locomotive]]s
; [[Vehicle/Train/Defence]]
 
: Defend, as trains are a priority target of [[Enemies]].
Locomotives can be entered and then manually operated by standing next to them and pressing the {{Key|ENTER}} button.
 
=== Switches ===
* There is no visual representation of a working switch, however the rails will appear to merge. Using the rail planner, the player must place a [[rail]] overlapping an existing rail to form a switch. Switches are forks in tracks that allow a train to pick between two directional options.
* The crossing of two straight tracks is not usable as switch, as trains have a limited turning radius. They do, however, connect [[Rail signal| signal blocks]] which helps prevent collisions.
* Parallel tracks do not interact with each other. However, switching from one track to the other can require extra resources if they are too close together; the track must turn away from the other parallel track and then turn back to it. This can create complicated networks of signals and, as such, one should generally not build parallel tracks unless they are spaced adequately. (Generally, 2 track widths apart works well)
 
[[File:fff-140-controlled-gates_sm.gif|frame|An example of a safe railway crossing.<br />[https://wiki.factorio.com/images/Fff-140-controlled-gates.gif Click here] for the full-sized version of the image.]]
=== Crossing tracks ===
 
'''Be careful when crossing tracks! Trains are one of the highest damaging entities in the game, and will kill most players instantly on contact.'''
 
A checklist of proper track crossing etiquette:
 
# Zoom out, so that you can see a train coming.
# Look left, then right.
# Check for signals nearby: If a [[rail signal]] suddenly jumps from green to red or green to yellow, a train is coming. Do not cross.
# Avoid walking near the tracks, as you do not need to be fully on the tracks to get hit.
# While it is possible to get into/out of a train while it is moving, a miss can cost your life. The sides of the train can still deal damage, as well as the player being able to slip between two rail cars.
# Heavy [[Energy shield|shields]] can be used to reduce the damage taken. In extreme cases, it is possible to stop a train with your body. This will require several shield modules to not be instantly killed, and will drain a large amount of the suit's energy.
# All entities with health will take damage getting hit by a train, so take care not to leave a [[car]] or [[tank]] on the tracks. However, this includes hostile forces!
# Trains far from a [[train stop]] will be traveling at (near) max speed, so take extra precaution when crossing and zoom out further. Trains near a [[train stop]] or signal will slow down to stop, and will be traveling slower. Trains of different configurations will also move slower or faster.
 
A safe railroad crossing like the example shown in the picture can be built. This works by restricting access to the tracks when an oncoming train has the rails reserved. When the player is on the rails, the signals are reserved by the [[circuit network]], and the train must stop and wait until the player leaves the tracks. When a player is inside the area crossing the tracks, the train gates are closed so the player can't get on the tracks outside the crossing. This is to completely ensure a safe crossing, and is often used on servers.
 
{{clear}}
 
== Trains ==
Train components:


=== Tracks ===
[[File:curved-rail-example-1.png|thumb|256px|Composition of rails to form a 90 degree turn.]]
{| class="wikitable"
{| class="wikitable"
| {{imagelink|straight-rail|Straight rail}} || {{imagelink|curved-rail|Curved rail}} |-
|{{Imagelink|Locomotive}} || {{Imagelink|Cargo wagon}} || {{Imagelink|Fluid wagon}} || {{Imagelink|Artillery wagon}}
|}
|}
The backbone of the player's rail system has to be built out of the two basic elements (straight/curve) manually. According to FFF #113/#114 update thirteen will include a build-by-drag feature to make building tracks easier and faster.


Rails can be placed in a two-[[Tile]] area only. For the future (for example if the player makes plans for a train station, '''before''' they research trains,) it is generally a good idea to only place tracks on even tile-coordinates. The player can see the coordinates of the tile they are moving with the cursor by turning on the [[Debug mode]], selecting "show-tiles".
[[File:Railway-assemble-train.png|thumb|left|300px|Placing a [[Cargo wagon]] so it is attached to the train.]]


==== Curves ====
* A train consists of at least one locomotive.
To create a 90 degree two [[Curved rail]]s and one [[Straight rail]] are needed. The [[Straight rail]] has to be placed along the end of a curved rail to fit the gap between the two [[Curved rail]]s.
* Trains can have more than one locomotive, and any number of [[wagon]]s.
* Locomotives can be '''manually''' driven forwards or backwards, however, they are generally slower going backwards. The left and right movement keys are used to change direction at switches.
* Trains can only drive forwards automatically. An automatic train can drive forwards and backwards when two locomotives facing different directions are connected to the train.
* A train needs [[fuel]] to drive. Fuel can be added by inserters when the train is in manual mode or parked at a station, not when waiting at a signal or standing on automatic mode.


==== Switches & Signals ====
The locomotives' inventory is only used for [[fuel]]. To transport items or fluids [[cargo wagon]]s and/or [[fluid wagon]]s have to be attached to the train. To attach rolling stock, whether a wagon or a locomotive, the player may either prepare to place one near an existing train, where a green graphic will show the player that the stock will be attached, showing a connection between the train and the new stock. Alternatively, the player may manually connect rolling stock to trains with the rolling stock connect key, if the cargo wagon was placed far away from a train. Rolling stock can likewise be disconnected with the rolling stock disconnect key.
[[File:rail-switch-example-1.png|thumb|256px|Composition of rails to form switches, straight and diagonal.]]
* There is no optical sign for a working switch. The player must place a [[Curved rail]] overlapping on a [[Straight rail]] (or vice versa) to form a switch. In other words: The player can create 3-way-switches at nearly every point of their track by mixing curves with straight rails.
* The crossing of two straight tracks is not usable as switch, but they do connect [[Railway/Signal/Block signal| signal blocks]] making it possible to prevent collisions.
* Parallel tracks do not interact with each other and generally have no problem, however, switching from one track to the other can require extra resources because the track has to turn away from the other parallel track then turn back to it. This can create complicated networks of signals and as such the player may wish not to build parallel tracks unless they are permanent.


==== Other ====
{{clear}}
* Use the debug-mode (Press F6) to see and understand better, how the tracks are bound together
* FFF #113 Better Rail Building: http://www.factorio.com/blog/post/fff-113
* FFF #114 Better Train Conditions: http://www.factorio.com/blog/post/fff-114
----


=== Trains ===
== Stations ==
[[File:Railway-locomotive-gui.png|thumb|256px|Locomotive screen: 1: switch to schedule screen; 2: [[Fuel]] inventory;]]
[[File:station-example-1.png|thumb|right|256px|A very minimal train station.]]
[[File:Railway-assemble-train.png|thumb|256px|Placing a [[Cargo wagon]] so it is attached to the train.]]
 
Train stations are the only place where trains can be loaded or unloaded when they are in automatic mode. Cargo wagons can be filled or emptied by up to twelve adjacent [[inserters]] (six on each side). Inserters can also be used to insert fuel into locomotives. [[Pump]]s are used to transfer fluid into and out of fluid wagons, only three pumps can attach to one fluid wagon at once.
 
Train stations are usually created by placing a [[train stop]]. Train stops must be on the right hand side of the track. However it is also possible to create a temporary train station by opening a locomotive's GUI and using {{Keybinding|ctrl|lmb}} near a rail in the minimap in the GUI or by entering a locomotive and using {{Keybinding|ctrl|lmb}} near a rail on the world map. This will create a station without requiring a train stop. The temporary train station has a default wait condition of 5 seconds and is removed from the schedule once the train leaves the station.
 
{{clear}}
 
== Signals ==
{| class="wikitable"
{| class="wikitable"
|{{imagelink|diesel-locomotive|Diesel locomotive}} || {{imagelink|cargo-wagon|Cargo wagon}} |-
| {{Imagelink|Rail signal}} || {{Imagelink|Rail chain signal}}
|}
|}


* A train is a consist of at least one locomotive, but the player may add additional locomotives to keep the train moving at max speed or [[Cargo wagon]]s to transport goods with the train.
Rail signals are used to employ multiple trains automatically without the danger of trains crashing into each other. Rail signals split the network into blocks and ensure that only one train can be in every block at any time. Note that driving a train manually ignores all signals; so it is possible for automatic trains to crash into the player if the player ignores red/yellow signals. Always beware of automatic trains and give them the right of way.
* Locomotives may be manually driven forward or backward, however, locomotives are generally much slower going backwards. Left and Right are used to change direction at switches.
* Automatic driving is only possible when a locomotive is facing towards the station the train is moving towards. This can be counteracted by having a locomotive facing either direction on a rail, or adding a loop along the rail somewhere. Note that in a loop signals can misbehave due to detecting trains before they arrived.
* A train needs [[fuel]] to drive. Fuel can be added by inserters or by using the GUI.


The locomotives' inventory is only used for [[Fuel]]. To transport items [[Cargo wagon]]s have to be attached to the train. To attach a Cargo wagon, the player may either prepare to place one near an existing train- a green graphic will show the player that they will be attached, showing a connection between the train and the new wagon. Alternatively, the player may manually connect cargo wagons to trains with the stock connect key, if the cargo wagon was placed far away from a train. The cargo wagons can be filled manually or by adjacent inserters.
The [[Tutorial:Train signals|train signals tutorial]] contains an in-depth explanation of rail signals, blocks and deadlocks.


== Advanced ==
=== Basic signaling rules ===
This section covers items used to make trains automatically transport items between stations. The player should be familiar with the Beginner Section to fully employ these strategies.
* There can only be one train in a block at any time. A train spanning multiple blocks occupies them all.
* A red signal means that the following block is occupied by a train.
* A yellow signal means that a train is approaching and already has the approval to enter the following block.
* [[Rail signal]]s separate a new block and reflect its state: green - free, yellow - reserved, red - occupied
* [[Rail chain signal]]s separate a new block and reflect the state of the next signal(s): see above, blue - at least one of the paths is blocked, but not all
* A train can only pass a signal on the right of the track, or if there is a signal on both sides on the same rail segment. Of course, manual driving overrides this.


=== [[Automated rail transportation (research)|Automated rail transportation]] ===
== Automated transport ==
[[File:station-example-1.png|thumb|256px|A very minimal station.]]
[[File:locomotive_gui.png|thumb|300px|The wait condition tab in the locomotive's GUI.]]
[[File:station-example-3.png|thumb|256px|Train Station with multiple [[Train stop]]s and [[Rail signal]]s to allow operation of multiple trains on single track.]]
 
{| class="wikitable"
Trains set on "Automatic" choose their destination stop and route on departure, and after waiting at a chain signal for five seconds, and when their destination stop disables itself by circuit condition. They choose the shortest route using a [[Railway/Train_path_finding|path finding algorithm]] that will get them to an enabled train stop with the right name, taking penalties for any apparent-at-the-time delays into account. If no such train stop exists they will skip the stop and go on to the next.
| {{imagelink|Train-stop|Train stop}} |-
 
|}
This section covers items used to make trains automatically transport items between stations. The player should be familiar with creating a rail system.
; [[Train stop]]
 
: The item that marks the position for the locomotive to stop.
First, the player has to setup a rail system with at least two train stops, which are placed in the right-hand side of the  expected train arrival direction. By hovering over the train stop with the mouse you see the positions of the vehicles for better setting up the train station (including (un)loading machinery, refueling/repair installations).
; Train Station
 
: The complete facility around one or more [[Train stop]]s generally includes un/loading machinery, defense structures, refueling/repair installations.
When you set up the train schedule (see below) and fuel the train, you can start the train on it's schedule by switching from manual to automatic driving mode.
 
=== Train schedule ===
The player can set up a list of train stations in the left locomotive's GUI. The train will route to stops in the given order, if it's at the end it will continue with the first. Stations can be added by clicking "Add station" in the GUI. A pop-up appears with a list of all stop names. If one is selected, another button appears which allows select a wait condition from a pop-up list. Furthermore, the map in the right part of the GUI can be used to add stations to the schedule by using {{keybinding|shift|lmb}} on a station or using {{keybinding|ctrl|lmb}} near a rail in the map to create a temporary train station. This actions can also be performed on the world map when the player is sitting in the train.
 
Wait conditions are used to tell the train when to leave the station. There are 7 types of wait conditions:
* '''Time passed'''
* '''Inventory full''' – All inventories of the train are full. Does not include fuel inventories.
* '''Inventory empty''' – Same as above, but empty. Does not include fuel inventories.
* '''Item count''' – The train (all cargoes summed) contains a specific amount of a certain item. Does not include fuel inventories.
* '''Circuit condition''' – The train stop is connectable to the [[circuit network]], so the signals can used for wait conditions.
* '''Inactivity''' – No items were added or removed for the specified amount of seconds.
* '''Fluid count''' – The train (all fluid wagons summed) contains a specific amount of a certain fluid.
* '''Passenger present''' - At least one [[player]] is inside any part of the train.
* '''Passenger not present''' - No players are inside any part of the train.
 
It is also possible to set no wait condition, this causes the train to simply pass by the station without stopping.
 
Hereafter the word "term" is used to describe ''one'' type of wait condition, and the words "wait condition" are used to describe the whole set of terms (it turns a bit into maths).
 
If more than one term is added, it is possible to change the connection of those using the logical operators AND and OR. An AND condition will result in true if all terms are true. An OR condition will return true if at least one of the terms is true.
 
When mixing AND and OR terms, the logic is grouped by the OR terms. When evaluating the wait condition, the first term is evaluated along with all AND terms immediately following up to but excluding the next occurring OR term. If they all evaluate true, the wait condition evaluates true. Otherwise, evaluation continues with that next occurring OR term and all AND terms immediately following it, up to the next OR term. This continues until either an OR group evaluates true and the wait condition is satisfied, or all terms have been checked.
 
==== Examples ====
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
Expand for examples
<div class="mw-collapsible-content">
Wait until full, up to 30 seconds:
 
<pre>
Full cargo inventory
OR 30 seconds passed
</pre>
 
Wait until cargo full, ''or'' circuit condition Oil > 3000:


=== Track Layout ===
<pre>
For track layout there are 2 common options on how to operate:
Full cargo inventory
;Circular - higher efficiency in large networks
OR Circuit condition - Oil > 3000
: Trains move only in one direction driving a circle
</pre>
: requires turning loops
: extremely powerful when using a "two-track" layout, one track for each direction
: high chance of gridlocks when not signaled properly


;Linear - easier to setup, cheaper at beginning
Wait until empty, ''and'' 30 seconds passed, ''and'' 5 seconds of inactivity:
: Trains drive in two directions on the same track
: lower cost for tracks, but minimum of 2 engines per train
: high waiting times when operating multiple trains


=== Train stop ===
<pre>
* The train will search for a path to stop with the [[Train stop]] on its right hand side in driving direction
Empty cargo inventory
* At least two [[Train stop]]s are needed to make a train drive between them. Only installing a single station would result in trains being able to move in only one direction.
AND 30 seconds passed
AND 5 seconds of inactivity
</pre>


=== Schedule ===
Wait until iron ore is low, ''or'' copper ore is low ''and'' at least 30 seconds passed:
[[File:Railway-schedule-gui.png|thumb|256px|Schedule screen: 1: switch to locomotive screen; 2: [[Train stop]]s currently on route; 3: Available [[Train stop]]s; 4: enable/disable automatic driving; 5: Remove selected [[Train stop]] from route; 6: set selected [[Train stop]] as next stop; 7: Add selected [[Train stop]] to route;]]
* When right-clicking on the locomotive the player can set up a schedule:
* add the desired [[Train stop]]s to the route in correct order
* adjust the wait time for each [[Train stop]] individual
* to start the train, enable "automatic mode"


=== Troubleshooting ===
<pre>
==== Train doesn't move ====
Cargo: Iron ore < 500
* Is the train fueled?
AND 30 seconds passed
* Is the train facing the right direction?
OR Cargo: Copper ore < 500
* Is another train in the same block?
AND 30 seconds passed
</pre>


==== No path ====
Factorio's wait condition logic is read as disjunctive normal form ([https://en.wikipedia.org/wiki/Disjunctive_normal_form DNF]), and so this last example is processed as (note the parenthesis):
* Is the track working properly?
* Is the next [[Train stop]] placed on right-hand side?
* Are signals set correctly, if any?
* Is a signal reading the location of the train before it moves?
----


=== Rail signals ===
<pre>((Cargo: Iron ore < 500 AND 30 seconds passed) OR (Cargo: Copper ore < 500 AND 30 seconds passed))</pre>
[[File:Railway-test-setup.png|thumb|256px|A simple test setup to start with. Containing [[Train stop]]s for schedules, and [[Rail signal]]s to watch their behaviour.]]
{| class="wikitable"
| {{imagelink|rail-signal|Rail signal}} || {{imagelink|rail-chain-signal|Rail chain signal}} |-
|}


Understanding rail signals can be difficult. Several terms critical to understanding them are below:
Which is the same as this:
; Rail segment
: A piece of track (one item). There are just [[Straight rail]] and [[Curved rail]].
; Segment
: A single path of continuous rails, a track without intersections or switches. This becomes important when [[Railway/Signal|Signals]] are employed. The player may check the number of the current segment by mousing over a segment.
; Block
[[File:Railway-signals-1.png|thumb|256px|Block #1 is occupied, signal into that Block is red. Block #2 is approached, thus showing yellow, other blocks are free, signals showing green.]]
: A set of segments defined by rail signals. By default every connected segment belongs to one block, no matter whether a train can drive on it or not, and even if it can be driven only in one direction (for example a joining switch: the other segment of the switch belongs to the same block!). The player can see the current block numbers of a rail piece in the info section. '''See also [https://forums.factorio.com/viewtopic.php?f=18&t=3811#p28310 this forum post]''' for a good explanation about blocks.


As rail signals are used to employ multiple trains in automatic mode it is said here that driving a train manually ignores most of the rules described here. Driving a train manually on an automated network is possible and other automatic trains will follow the signaling. Sometimes it will be not possible to avoid a collision for automatic trains when the player ignores red/yellow signals, so be prepared for disaster.
<pre>((Cargo: Iron ore < 500 OR Cargo: Copper ore < 500) AND 30 seconds passed)</pre>


;The most basic rules:
Unfortunately, there is no way to write that shorter form in the current UI.
[[File:Railway-signals-2.png|thumb|256px|Block #1 occupied, signal red. Block #2 approaching, showing yellow. Chain signal #3 is reflecting block signal #2. The chain signal #4 is showing red, because the block is to be approached from another direction, thus the block is considered occupied.]]
</div></div>
#There is at maximum one Train in a block at any time.
#A red signal means that the following block is occupied by a train.
#A yellow signal means that a train is approaching, and already has the approval to enter the following block.
#[[Rail signal]]s separate a new block and reflect its state: green - free, yellow - to be occupied by approaching train, red - occupied
#[[Rail chain signal]]s separate a new block and reflect the state of the next [[Rail signal]]


== Expert ==
=== Troubleshooting ===
This section contains further links to in-depth knowledge. As a general advisory, tips given in this section detail the more intricate mechanics in the game and can be dangerous to the experience of players who wish to discover better methods on their own.


=== About Trains ===
Below are some things to verify if a rail system or train is not working.
* [[Vehicle/Train/Wagon]]: A wagon is like a rolling chest, but the inserters can insert into it from a slightly farther distance.
* [[Vehicle/Train/Driving]]: The player may manually drive a train, and enter the train by pressing Enter.
* [[Vehicle/Train/Reverse driving]]: How to drive a train in different directions while in automatic mode.
* [[Railway/Mixed transports]] - moving different items in wagons
* [[Railway/Train make-up]] - about how long trains should be.
* [[Vehicle/Train]] - the handling of loco and wagon
* [[Railway/Train path finding]] - how the trains find their path.


=== About train stations and stops ===
* Is the train fueled? Ensure that the locomotive has [[fuel]] of some kind.
* [[Railway/Train stop]]s - don't mix train stops with train stations!
* Misplaced or non-functional switches? Ensure that the train can plan a path through the switches.
* [[Railway/Train station]]s - about the loading/unloading of trains
* Another train on the same [[Railway#Block|block]]? Make sure the path of the train is unobstructed.
* [[Railway/Automated transport]] - all about automated transport.
* Train stops placed correctly? Make sure that the yellow arrows when hovering on the stop point towards the end or exit of the stop.
* [[Railway/The renaming-of-train-stop-trick]]: What happens if the player gives a train stop the same name as another train stop?
* Is the train allowed to enter signals from the right direction? Are the signals set correctly?
* [[Railway/Multiple trains/Single track]]:  It is possible to operate multiple trains on one track.
* If a track is supposed to be two-way, the rail signals should be opposite each other. You can verify they match up by hovering the cursor over one. For a matched pair, it will show the other.


=== About Signaling ===
==== No path ====
* [[Railway/Signal]]
When trains cannot reach the target, a "no path" symbol pops up over the locomotive. Check:
** [[Railway/Signal/Block signal]]
* Can the train reach its current destination by '''only driving forward'''? Build turning slopes or place a locomotive at both ends of a train!
** [[Railway/Signal/Chain signal]]
* Are the train stops standing in the right direction? Train stops must be on the right hand side of the track (from the forward-facing locomotive's perspective).  If the train is traveling south, the stop must be on the west side of the track.
* [[Railway/Multiple trains]]
* If you use rail signals, check that the signals are all allowing traffic in the correct direction.
* [[Railway/Rail info]] - hovering a rail-segment reveals some important information
* Check for interruptions in the train tracks, drive to the station manually to check there are no rail parts missing. Especially near junctions these can be hard to spot if missing.
* [[Railway/Deadlocks]]


== Tips & Tricks ==
If you are still having problems, consider:
* When supply trains follow the player: http://www.factorioforums.com/forum/viewtopic.php?f=5&t=6203
* Driving the train manually, and as you pass each switch, try switching to automatic. When it works, you will know the rough area of the problem.
* The player may lay rails by sitting inside of the train.
[http://imgur.com/a/Nq2Yk A pictorial summary of typical problems].


== Relationship to [http://www.openttd.org/ OpenTTD] ==
== Achievements ==
Factorio's railway system works basically exactly like [http://wiki.openttd.org/Signals#Block_signals≈ the block signals in Open Traffic Tycoon Deluxe]. Players who have ever played that game will find some elements of it in Factorio. If not, they can learn from the openttd documentation.
{{Achievement|getting-on-track}}
{{Achievement|trans-factorio-express}}
{{Achievement|watch-your-step}}
{{Achievement|getting-on-track-like-a-pro}}


{{Special:PrefixIndex/{{FULLPAGENAME}}/}}
== See also ==
* [[Tutorial:Train signals]]
* [[Railway/Train_path_finding]]
* [[Locomotive]]
* [[Cargo wagon]]

Latest revision as of 18:29, 13 August 2021

Railway in the official game trailer.
For the research see Railway (research)

The Railway is one of the main transport methods in Factorio. Although the installation of such a network can be complicated, and requires a large amount of resource and space, it is faster and more efficient than belts and robot logistics, especially over large distances.

Railway construction, however, is not understood instantly. It takes some time to learn the basics, such as automating transportation. Learning how to manage and maintain upkeep of a larger train network takes time and experience.

Infrastructure

To build a railway, tracks (also called rails) must be built for the train to ride on. Typically, this is done via the rail planner, but can also be done manually. Bear in mind that rails are placed on a two-tile grid, so a rail cannot be moved by only one tile.

Minimum manually operated railway

As a minimum a manually operated railway has to consist of:

Locomotives can be entered and then manually operated by standing next to them and pressing the ENTER button.

Switches

  • There is no visual representation of a working switch, however the rails will appear to merge. Using the rail planner, the player must place a rail overlapping an existing rail to form a switch. Switches are forks in tracks that allow a train to pick between two directional options.
  • The crossing of two straight tracks is not usable as switch, as trains have a limited turning radius. They do, however, connect signal blocks which helps prevent collisions.
  • Parallel tracks do not interact with each other. However, switching from one track to the other can require extra resources if they are too close together; the track must turn away from the other parallel track and then turn back to it. This can create complicated networks of signals and, as such, one should generally not build parallel tracks unless they are spaced adequately. (Generally, 2 track widths apart works well)
An example of a safe railway crossing.
Click here for the full-sized version of the image.

Crossing tracks

Be careful when crossing tracks! Trains are one of the highest damaging entities in the game, and will kill most players instantly on contact.

A checklist of proper track crossing etiquette:

  1. Zoom out, so that you can see a train coming.
  2. Look left, then right.
  3. Check for signals nearby: If a rail signal suddenly jumps from green to red or green to yellow, a train is coming. Do not cross.
  4. Avoid walking near the tracks, as you do not need to be fully on the tracks to get hit.
  5. While it is possible to get into/out of a train while it is moving, a miss can cost your life. The sides of the train can still deal damage, as well as the player being able to slip between two rail cars.
  6. Heavy shields can be used to reduce the damage taken. In extreme cases, it is possible to stop a train with your body. This will require several shield modules to not be instantly killed, and will drain a large amount of the suit's energy.
  7. All entities with health will take damage getting hit by a train, so take care not to leave a car or tank on the tracks. However, this includes hostile forces!
  8. Trains far from a train stop will be traveling at (near) max speed, so take extra precaution when crossing and zoom out further. Trains near a train stop or signal will slow down to stop, and will be traveling slower. Trains of different configurations will also move slower or faster.

A safe railroad crossing like the example shown in the picture can be built. This works by restricting access to the tracks when an oncoming train has the rails reserved. When the player is on the rails, the signals are reserved by the circuit network, and the train must stop and wait until the player leaves the tracks. When a player is inside the area crossing the tracks, the train gates are closed so the player can't get on the tracks outside the crossing. This is to completely ensure a safe crossing, and is often used on servers.

Trains

Train components:

Locomotive.png
Locomotive
Cargo wagon.png
Cargo wagon
Fluid wagon.png
Fluid wagon
Artillery wagon.png
Artillery wagon
Placing a Cargo wagon so it is attached to the train.
  • A train consists of at least one locomotive.
  • Trains can have more than one locomotive, and any number of wagons.
  • Locomotives can be manually driven forwards or backwards, however, they are generally slower going backwards. The left and right movement keys are used to change direction at switches.
  • Trains can only drive forwards automatically. An automatic train can drive forwards and backwards when two locomotives facing different directions are connected to the train.
  • A train needs fuel to drive. Fuel can be added by inserters when the train is in manual mode or parked at a station, not when waiting at a signal or standing on automatic mode.

The locomotives' inventory is only used for fuel. To transport items or fluids cargo wagons and/or fluid wagons have to be attached to the train. To attach rolling stock, whether a wagon or a locomotive, the player may either prepare to place one near an existing train, where a green graphic will show the player that the stock will be attached, showing a connection between the train and the new stock. Alternatively, the player may manually connect rolling stock to trains with the rolling stock connect key, if the cargo wagon was placed far away from a train. Rolling stock can likewise be disconnected with the rolling stock disconnect key.

Stations

A very minimal train station.

Train stations are the only place where trains can be loaded or unloaded when they are in automatic mode. Cargo wagons can be filled or emptied by up to twelve adjacent inserters (six on each side). Inserters can also be used to insert fuel into locomotives. Pumps are used to transfer fluid into and out of fluid wagons, only three pumps can attach to one fluid wagon at once.

Train stations are usually created by placing a train stop. Train stops must be on the right hand side of the track. However it is also possible to create a temporary train station by opening a locomotive's GUI and using CTRL + Left mouse button near a rail in the minimap in the GUI or by entering a locomotive and using CTRL + Left mouse button near a rail on the world map. This will create a station without requiring a train stop. The temporary train station has a default wait condition of 5 seconds and is removed from the schedule once the train leaves the station.

Signals

Rail signal.png
Rail signal
Rail chain signal.png
Rail chain signal

Rail signals are used to employ multiple trains automatically without the danger of trains crashing into each other. Rail signals split the network into blocks and ensure that only one train can be in every block at any time. Note that driving a train manually ignores all signals; so it is possible for automatic trains to crash into the player if the player ignores red/yellow signals. Always beware of automatic trains and give them the right of way.

The train signals tutorial contains an in-depth explanation of rail signals, blocks and deadlocks.

Basic signaling rules

  • There can only be one train in a block at any time. A train spanning multiple blocks occupies them all.
  • A red signal means that the following block is occupied by a train.
  • A yellow signal means that a train is approaching and already has the approval to enter the following block.
  • Rail signals separate a new block and reflect its state: green - free, yellow - reserved, red - occupied
  • Rail chain signals separate a new block and reflect the state of the next signal(s): see above, blue - at least one of the paths is blocked, but not all
  • A train can only pass a signal on the right of the track, or if there is a signal on both sides on the same rail segment. Of course, manual driving overrides this.

Automated transport

The wait condition tab in the locomotive's GUI.

Trains set on "Automatic" choose their destination stop and route on departure, and after waiting at a chain signal for five seconds, and when their destination stop disables itself by circuit condition. They choose the shortest route using a path finding algorithm that will get them to an enabled train stop with the right name, taking penalties for any apparent-at-the-time delays into account. If no such train stop exists they will skip the stop and go on to the next.

This section covers items used to make trains automatically transport items between stations. The player should be familiar with creating a rail system.

First, the player has to setup a rail system with at least two train stops, which are placed in the right-hand side of the expected train arrival direction. By hovering over the train stop with the mouse you see the positions of the vehicles for better setting up the train station (including (un)loading machinery, refueling/repair installations).

When you set up the train schedule (see below) and fuel the train, you can start the train on it's schedule by switching from manual to automatic driving mode.

Train schedule

The player can set up a list of train stations in the left locomotive's GUI. The train will route to stops in the given order, if it's at the end it will continue with the first. Stations can be added by clicking "Add station" in the GUI. A pop-up appears with a list of all stop names. If one is selected, another button appears which allows select a wait condition from a pop-up list. Furthermore, the map in the right part of the GUI can be used to add stations to the schedule by using SHIFT + Left mouse button on a station or using CTRL + Left mouse button near a rail in the map to create a temporary train station. This actions can also be performed on the world map when the player is sitting in the train.

Wait conditions are used to tell the train when to leave the station. There are 7 types of wait conditions:

  • Time passed
  • Inventory full – All inventories of the train are full. Does not include fuel inventories.
  • Inventory empty – Same as above, but empty. Does not include fuel inventories.
  • Item count – The train (all cargoes summed) contains a specific amount of a certain item. Does not include fuel inventories.
  • Circuit condition – The train stop is connectable to the circuit network, so the signals can used for wait conditions.
  • Inactivity – No items were added or removed for the specified amount of seconds.
  • Fluid count – The train (all fluid wagons summed) contains a specific amount of a certain fluid.
  • Passenger present - At least one player is inside any part of the train.
  • Passenger not present - No players are inside any part of the train.

It is also possible to set no wait condition, this causes the train to simply pass by the station without stopping.

Hereafter the word "term" is used to describe one type of wait condition, and the words "wait condition" are used to describe the whole set of terms (it turns a bit into maths).

If more than one term is added, it is possible to change the connection of those using the logical operators AND and OR. An AND condition will result in true if all terms are true. An OR condition will return true if at least one of the terms is true.

When mixing AND and OR terms, the logic is grouped by the OR terms. When evaluating the wait condition, the first term is evaluated along with all AND terms immediately following up to but excluding the next occurring OR term. If they all evaluate true, the wait condition evaluates true. Otherwise, evaluation continues with that next occurring OR term and all AND terms immediately following it, up to the next OR term. This continues until either an OR group evaluates true and the wait condition is satisfied, or all terms have been checked.

Examples

Expand for examples

Wait until full, up to 30 seconds:

Full cargo inventory
OR 30 seconds passed

Wait until cargo full, or circuit condition Oil > 3000:

Full cargo inventory
OR Circuit condition - Oil > 3000

Wait until empty, and 30 seconds passed, and 5 seconds of inactivity:

Empty cargo inventory
AND 30 seconds passed
AND 5 seconds of inactivity

Wait until iron ore is low, or copper ore is low and at least 30 seconds passed:

Cargo: Iron ore < 500
AND 30 seconds passed
OR Cargo: Copper ore < 500
AND 30 seconds passed

Factorio's wait condition logic is read as disjunctive normal form (DNF), and so this last example is processed as (note the parenthesis):

((Cargo: Iron ore < 500 AND 30 seconds passed) OR (Cargo: Copper ore < 500 AND 30 seconds passed))

Which is the same as this:

((Cargo: Iron ore < 500 OR Cargo: Copper ore < 500) AND 30 seconds passed)

Unfortunately, there is no way to write that shorter form in the current UI.

Troubleshooting

Below are some things to verify if a rail system or train is not working.

  • Is the train fueled? Ensure that the locomotive has fuel of some kind.
  • Misplaced or non-functional switches? Ensure that the train can plan a path through the switches.
  • Another train on the same block? Make sure the path of the train is unobstructed.
  • Train stops placed correctly? Make sure that the yellow arrows when hovering on the stop point towards the end or exit of the stop.
  • Is the train allowed to enter signals from the right direction? Are the signals set correctly?
  • If a track is supposed to be two-way, the rail signals should be opposite each other. You can verify they match up by hovering the cursor over one. For a matched pair, it will show the other.

No path

When trains cannot reach the target, a "no path" symbol pops up over the locomotive. Check:

  • Can the train reach its current destination by only driving forward? Build turning slopes or place a locomotive at both ends of a train!
  • Are the train stops standing in the right direction? Train stops must be on the right hand side of the track (from the forward-facing locomotive's perspective). If the train is traveling south, the stop must be on the west side of the track.
  • If you use rail signals, check that the signals are all allowing traffic in the correct direction.
  • Check for interruptions in the train tracks, drive to the station manually to check there are no rail parts missing. Especially near junctions these can be hard to spot if missing.

If you are still having problems, consider:

  • Driving the train manually, and as you pass each switch, try switching to automatic. When it works, you will know the rough area of the problem.

A pictorial summary of typical problems.

Achievements

Getting-on-track-achievement.png Getting on track

Build a locomotive.

Trans-factorio-express-achievement.png Trans-Factorio express

Have a train plan a path 1000 tiles or longer.

Watch-your-step-achievement.png Watch your step

Get killed by a moving locomotive.

Getting-on-track-like-a-pro-achievement.png Getting on track like a pro

Build a locomotive within the first 90 minutes of the game.

See also