In other languages: Deutsch Español Français 日本語 Polski Русский Українська Tiếng Việt Nam 简体中文

Railway: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Changed links going to redirect to direct links.)
(Added interrupts, elevated rails, updated images)
 
(57 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
{{cleanup|2.0 changes. Train interrupts, overhauled rail placement, and elevated rails.}}
[[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)]]''
:''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 [[Belt transport system|belts]] and [[Logistic network|robot logistics]], especially over large distances.
'''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 resources and space, it is faster and more efficient than [[Belt transport system|belts]] and [[Logistic network|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.
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 the upkeep of a larger train network takes time and experience. Rails can be built on the ground, or can be - with the [[Space Age]] expansion - elevated with the help of a [[rail ramp]] and [[rail support]]s so that trains can travel over obstacles.


== Infrastructure ==
== 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 can rails are placed on a two-tile grid, so you cannot move a rail by only one tile.
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 ===
=== Minimum manually operated railway ===
As a minimum a manually operated railway has to consist of:
As a minimum, a manually operated railway has to consist of:
* [[Rail]]s (tracks)
* [[Rail]]s (tracks)
* [[Locomotive]]s
* [[Locomotive]]s


Locomotives can be entered and then manually operated by standing next to them and pressing the {{Key|RETURN}} button.
Locomotives can be entered and then manually operated by standing next to them and pressing the {{Key|ENTER}} button.


=== Switches ===
=== 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.
* 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.
* The crossing of two straight tracks is not usable as a 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 and generally have no problems. 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)
* 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.gif|thumb|An example of a safe railway crossing.]]
[[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 ===
=== 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.'''
'''Be careful when crossing train 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:
A checklist of proper track-crossing etiquette:


# Zoom out, so that you can see a train coming.
# Zoom out, so that you can see a train coming.
Line 34: Line 36:
# Avoid walking near the tracks, as you do not need to be fully on the tracks to get hit.
# 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.
# 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.
# 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!
# 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.
# 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.
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}}
{{clear}}
Line 46: Line 48:


{| class="wikitable"
{| class="wikitable"
|{{imagelink|diesel-locomotive|Diesel locomotive}} || {{imagelink|cargo-wagon|Cargo wagon}} || {{imagelink|Fluid_wagon|Fluid wagon}} |-
|{{Imagelink|Locomotive}} || {{Imagelink|Cargo wagon}} || {{Imagelink|Fluid wagon}} || {{Imagelink|Artillery wagon}}
|}
|}


Line 52: Line 54:


* A train consists of at least one locomotive.
* A train consists of at least one locomotive.
* Trains can have more than one locomotive, and any number of [[Wagon]]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.
* 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.
* 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. Despite being called Diesel Locomotives, they will take anything with a fuel value. 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.
* 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 in automatic mode.
* A common way to refuel trains is using a [[requester chest]] that requests [[fuel]], and then having a [[burner inserter]] loading the fuel into the locomotive.


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, where a green graphic will show the player that the cargo wagon 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 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 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 is placed far away from a train. Rolling stock can likewise be disconnected with the rolling stock disconnect key.
 
* [[Railway/Train path finding]] - How trains find their path.


{{clear}}
{{clear}}
Line 66: Line 65:
== Stations ==
== Stations ==
[[File:station-example-1.png|thumb|right|256px|A very minimal train station.]]
[[File:station-example-1.png|thumb|right|256px|A very minimal train station.]]
[[File:station-example-2.png|thumb|400px|High-performance train station for short trains. Highest possible unload rate, waiting spots, refueling, defended, multi-train capable, modular, extend-able.]]
Station Components:
{| class="wikitable"
|{{imagelink|train-stop|Train stop}} || {{imagelink|straight-rail|Rail|Rails}} || {{imagelink|Inserter-icon|Inserters}}
|}
A '''train station''' is a combination of at least one [[train stop]] plus a [[storage]] and/or distribution system, used to fill or empty [[Cargo wagon]]s, load [[fuel]] into the [[Locomotive|locomotive(s)]], or repair trains.


'''Don't mix up ''train stations'' with ''train stops''.''' A train station is a concept, whereas a [[train stop]] is an item.
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.


[[Inserter]]s placed next to train tracks are used to load/unload trains at train stops. Inserters are the only way to get items off and onto cargo wagons.
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}}
{{clear}}


== Signals ==
== Signals ==
The two types of signals in Factorio:
{| class="wikitable"
{| class="wikitable"
| {{imagelink|rail-signal|Rail signal}} || {{imagelink|rail-chain-signal|Rail chain signal}} |-
| {{Imagelink|Rail signal}} || {{Imagelink|Rail chain signal}}
|}
|}


Understanding rail signals can be difficult. Several terms critical to understanding them are below:
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.
*Rail segment
: A piece of track (one item).
*Segment
: A single path of continuous track without intersections or switches. This becomes important when signals are employed. The player may mouse over a segment to see its number. It's number is unique within the world, however does not start from 0 or 1.
*Block
: 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 (e.g. at a switch, both segments of the switch belong to the same block). The player can see the current block numbers of a rail piece in the info section on mouse-over.
 
Rail signals are used to employ multiple trains automatically. Note that driving a train manually ignores most of the rules described here; other automatic trains will follow signaling indicted by the player's movement dynamically, however it will sometimes be not possible to avoid a collision for automatic trains if the player ignores red/yellow signals. Always beware automatic trains and give them the right of way.


'''See [https://forums.factorio.com/viewtopic.php?f=18&t=3811#p28310 this forum post]''' for a good explanation about blocks.
The [[Tutorial:Train signals|train signals tutorial]] contains an in-depth explanation of rail signals, blocks and deadlocks.


=== Basic Signaling Rules ===
=== Basic signaling rules ===
* There is at most one Train in a block at any time. A train spanning multiple blocks occupies them all.
* 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 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.
* 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, blue - one of the paths is blocked
* [[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 [[Rail signal]]
* [[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.
* 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.


{{clear}}
== Automated transport ==
[[File:locomotive_gui.png|thumb|300px|The wait condition tab in the locomotive's GUI.]]


== Deadlocks ==
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.
A deadlock or gridlock can happen when every train is locked by another. In nearly every case two or more trains are standing so that every train blocks (by minimum) one other train.
 
=== Deadlock occurrence ===
Deadlocks occur when two+ trains are prevented from continuing through an intersection, due to an unsolvable signal conflict. There are a few different types of deadlocks:
 
# Temporary - These are caused by a Temporary hiccup in a train's path, such as a loading train being in the way, or created by closing a signal with the [[circuit network]]. These often resolve themselves.
# Semi-Permanent - These are the result of a problem with pathing, often created by a fuel-less train or broken rail, and may require player interaction in order to free.
# Permanent - This type is the worst, and cannot be resolved automatically, often requiring the player to manually drive several trains to get them out of the intersection. These often are caused by incorrect signal placement or unreachable stations.
 
It's important to remember that deadlocks can happen by chance, and by mistake of the player. Sometimes even perfectly signaled rails have issues. The rate of deadlocks is inversely proportional to the quality of Signaling, however.
 
=== Factors that influence the deadlock chance ===
* Train length (shorter trains will have a lower chance with the same rail/signal layout, due to having less effect on the rails they're on.)
* Size of the blocks: More space for the blocks means lower chance of deadlock.
* Track layout: Some layouts have a higher chance of locking, than others.
* Quantity of trains - More trains trying to use an intersection will result in higher chance of deadlock.
* The chance is also much higher if trains need to wait often in areas with rail-crossings.
 
Knowing the factors, how can deadlocks be reduced?
 
* Don't use 4-way junctions or roundabouts (circles) to create junctions.
* Use better 3-way junctions. See [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=9044 A Detailed Look at a Bidirectional Three-way Train Intersection]
* Use roundabouts only for changing direction of train, and never for high traffic intersections.
* Build more tracks around junctions. Don't have one junction be the only way to reach a place, add redundancy. This keeps a small problem a small problem.
 
== Automated transport ==
[[File:train-schedule-gui.png|thumb|300px|The new train GUI since 0.13 (schedule tab): 1 - switch between automatic and manual driving mode; 2 - add new train stop; 3 - delete selected train stop; 4 - send train to selected train stop; 5 - add wait condition for selected train stop; 6 - delete selected wait condition; 7 - change logical mode of selected wait condition]]


This section covers items used to make trains automatically transport items between stations. The player should be familiar with creating a rail system.
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).
First, the player has to set up a rail system with at least two train stops, which are placed on 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, and 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.
When you set up the train schedule (see below) and fuel the train, you can start the train on its schedule by switching from manual to automatic driving mode.


=== Train schedule ===
=== Train schedule ===
The player can set up a list of train stops in the upper window. The train will run to the stops in the given order, if it's at the end it will continue with the first. Currently, it's not possible to make a one-time schedule. Stops can be added by clicking button 2 (see picture). A pop-up appears with a list of all train stops. If you select one, another pop-up appears where you have to select a wait condition.
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 selecting 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. These actions can also be performed on the world map when the player is sitting inside the train.


Wait conditions are used to tell the train when to leave the station. There are 6 types of wait conditions:
Wait conditions are used to tell the train when to leave the station. There are 15 types of wait conditions:
* '''Time passed''' - the only one available until version 0.12.
* '''Circuit condition''' – The train stop is connectable to the [[circuit network]], so the signals can used for wait conditions.
* '''Inventory full''' - All inventories of the train are full.
* '''Empty cargo''' – All inventories of the train are empty. Does not include fuel inventories.
* '''Inventory empty''' - Same as above, but empty.
* '''Fluid count''' – The train (all fluid wagons summed) contains a specific amount of a certain fluid.
* '''Item count''' - The train (all cargoes summed) contains a specific amount of a certain item.
* '''Fuel (all locomotives)''' - All locomotives in the train collectively contain a specific amount of fuel
* '''Circuit condition''' - The train stop is connectable to the [[Circuit network]], so the signals can used for wait conditions.
* '''Fuel (any locomotive)''' - Any one locomotive contains a specific amount of fuel
* '''Inactivity''' - No items were added or removed for the specified amount of seconds.
* '''Full cargo''' - All inventories of the train are full. Does not include fuel inventories
* '''Full fuel''' - All fuel inventories are full. Does not include cargo or fluid inventories
* '''Has cargo''' - Cargo or fluid inventories contain items.
* '''Inactivity''' – No items were added or removed for the specified amount of seconds.
* '''Item count''' The train (all cargoes summed) contains a specific amount of a certain item. Does not include fuel inventories.
* '''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.
* '''Station is full''' - A specified stop is full, according to its set train limit. If the stop has no train limit set, this condition will ''not'' be met.
* '''Station is not full''' - A specified stop is not full, according to its set train limit. If the stop has no train limit set, this condition ''will'' be met.
* '''Time passed'''
 
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).
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 you add more than one term, you can change the connection of those using the logical operators AND and OR (button 7). 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.
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.
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 ====
==== Examples ====
[[File:Traingroup gui.png|thumb|300px|The train group GUI. There are 2 trains in "Group A" and 1 train in "Group B"]]
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
Expand for examples
Expand for examples
Line 203: Line 172:
<pre>((Cargo: Iron ore < 500 OR Cargo: Copper ore < 500) AND 30 seconds passed)</pre>
<pre>((Cargo: Iron ore < 500 OR Cargo: Copper ore < 500) AND 30 seconds passed)</pre>


Unfortunately, there is '''no''' way to write that shorter form in the current UI.
Unfortunately, there is no way to write that shorter form in the current UI.
</div></div>
</div></div>
=== Train Groups ===
Trains are able to be assigned to a group. Selecting the small edit icon next to "no group assigned" will bring up the existing groups in the current world. One can select a group for the train to join, or create a new one. Editing the schedule of one train will change the schedules of all trains in the same group.
=== Schedule Interrupts ===
[[File:Interrupt gui.png|thumb|300px|The Edit Interrupt GUI.]]
Schedule interrupts allow a locomotive to override its current schedule when a certain condition is met. Selecting "Add interrupt" in the locomotive's GUI will bring up a list of existing interrupts in the current world. One can be selected from the list, or typing in a name will create a new one. Creating one will add it to the locomotive and all locomotives in the current locomotive group.
To work, an interrupt requires two parts: a condition and a target station. When a condition is met, the interrupt will activate and insert the target station as a temporary stop in the locomotive's schedule. The locomotive will route to the target station and wait there until the specified wait condition is met, at which point it will leave and resume its original schedule.
An interrupt can be triggered on many of the same conditions as waiting at a stop, along with some new conditions:
* '''At specified station''' -  The train is waiting at a specific stop
* '''Destination full or no path''' - The train's next stop is full, according to its train limit; or the train cannot physically reach its next station
* '''Not at specified station'''' - The train is stopped somewhere other than the specific stop
Multiple trains can have the same interrupt regardless if they are in the same locomotive group or not. Editing an interrupt will change it for all trains which have the interrupt in their system.
Interrupts can be reordered within the locomotive's GUI like normal stops. If a train has multiple interrupt conditions true at the same time, it will prioritize interrupts that are higher on the list. This is important if one wishes a train to behave a certain way when working with a particular suite of interrupts.
=== Parameterized Interrupts ===
This is an advanced feature.
When specifying an "Item Count" as a condition for a schedule interrupt, one has access to a new "Item Parameter" wildcard signal. This acts similarly to the [[circuit network#Anything|"Anything"]] logic signal from the circuit network and can be used to create a generic train system. Whichever item is first loaded into the train will replace the wildcard signal with that item. This can be used to create a train system which dynamically creates schedules based on whatever is loaded.


=== Troubleshooting ===
=== Troubleshooting ===
Line 212: Line 204:
* Is the train fueled? Ensure that the locomotive has [[fuel]] of some kind.
* 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.
* Misplaced or non-functional switches? Ensure that the train can plan a path through the switches.
* Another train on the same [[Railway#Segment|segment]] or [[Railway#Block|block]]? Make sure the path of the train is unobstructed.
* Another train on the same [[Railway#Block|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.
* 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?
* Is the train allowed to enter signals from the right direction? Are the signals set correctly?
Line 219: Line 211:
==== No path ====
==== No path ====
When trains cannot reach the target, a "no path" symbol pops up over the locomotive. Check:
When trains cannot reach the target, a "no path" symbol pops up over the locomotive. Check:
* Can the train reach it's current destination by '''only driving forward'''? Build turning slopes or place a locomotive at both ends of a train!
* 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.
* 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.''
* 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.
* 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:
If you are still having problems, consider:
Line 228: Line 220:
[http://imgur.com/a/Nq2Yk A pictorial summary of typical problems].
[http://imgur.com/a/Nq2Yk A pictorial summary of typical problems].


A vague issue exists (at least in 0.15.9) where the following steps helped:
== Elevated Rails ==
* Remove the unreachable stop from the train schedule
[[File:Elevated intersection example.png|thumb|350px|A simple bridge using elevated rails.]]
* Re-create (mine and place) the unreachable train stop
{{About/Space age}}
* Add the train stop back in the schedule.
Elevated rails come in a separate mod which can be enabled independently of Space Age. They come as two new buildings: [[rail ramp]] and [[rail support]]. Ramps and supports are the only items in the game able to be built in the oceans of [[Nauvis]]. When playing with Space Age itself, elevated rails become an important part of the game, as they are critical to bridging the oil oceans of [[Fulgora]]{{SA}} and the lava rivers of [[Vulcanus]]{{SA}}.  
 
No bug report was created because the issue was non-reproducible.
<!-- These tutorials are no longer included because they are outdated. However, this section can be put back into the article when there are newer or in-wiki tutorials


== User tips and tricks ==
Elevated rails can be built using the [[rail planner]]. Pressing {{Key|G}} will switch levels, and attempt to build a ramp up or down, if the player has one in their inventory. While holding {{Key|SHIFT}} and targeting a section of rail on the opposite level, the rail planner will automatically place any ramps and/or supports necessary to reach that destination. A rail support must be placed every 16 straight tiles. Disassembling a support or ramp will automatically disassemble any rails which rely on that support.
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. '''''Be warned that much of the info below could be outdated/incorrect.'''''


=== Tutorials ===
Players and [[enemies]] cannot walk on elevated rail. A player can enter and exit the train if it is elevated as normal, and will be teleported to the ground. If the player attempts to exit while over water or lava, nothing will happen. Both types of rail signals can be placed on elevated rail, but not train stops.  
==== Videos ====
We recommend viewing some videos of how to build a simple railway, which makes the basic steps very simple.


* [https://www.youtube.com/watch?v=mXr7y02ZG00 Rail Signaling - Easy Rules for Placing Signals]
Certain buildings are too tall to be placed underneath elevated rails:
* [http://www.factorioforums.com/forum/viewtopic.php?f=54&t=6984 Factorio Tutorial: Signals and Multi-train Networks] by Gepwin (read the whole article!)
* [[Big electric pole]]
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=5451 Factorio Traintorial, all about trains] by Gepwin.
* [[Cargo landing pad]]
* ''v0.10, English [http://www.youtube.com/watch?v=XSGYSbEPpbM Rail basics tutorial] by MangledPork Gaming.
* [[Oil refinery]]
** And the second part of the tutorial [http://www.youtube.com/watch?v=k6wxl4FdSuQ Factorio Rail Tutorial Part 2: Signals]
* [[Roboport]]
 
* [[Rocket silo]]
* ''[http://www.reddit.com/r/factorio/comments/26igal/train_signal_tutorial/ A train-signal tutorial with pictures].
* [[Agricultural tower]]{{SA}}
* v0.8, English [http://www.youtube.com/watch?v=RmyOdxi5hR4 Inzainia Plays: Factorio ver 0.8.0 EP:8 (Trains, Trains, Trains!!!)]
* [[Cargo bay]]{{SA}}
* v0.6, German [http://www.youtube.com/watch?v=idOaZpX8lnA Silver's Factorio Basic Train Tutorial]
* [[Lightning rod]]{{SA}}
 
* [[Lightning collector]]{{SA}}
-->


== Achievements ==
== Achievements ==
{{Achievement|getting-on-track}}
{{Achievement|trans-factorio-express}}
{{Achievement|trans-factorio-express}}
 
{{Achievement|watch-your-step}}
== Connection to [http://www.openttd.org/ OpenTTD] ==
{{Achievement|getting-on-track-like-a-pro}}
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.


== See also ==
== See also ==
* [[Vehicles]]
* [[Tutorial:Train signals]]
* [[Railway/Train path finding]]
* [[Locomotive]]
* [[Locomotive]]
* [[Cargo wagon]]
* [[Cargo wagon]]
* [[Fluid wagon]]
* [[Artillery wagon]]
{{C|Logistics{{!}}#Railway}} {{C|Railway{{!}}#Railway}}

Latest revision as of 07:08, 21 November 2024

Not-enough-repair-packs-icon.png
Page "Railway" has been recommended for clean-up. Reason: 2.0 changes. Train interrupts, overhauled rail placement, and elevated rails.
This may mean fixing grammar or broken links, providing better explanations, or removing incorrect/outdated info.
Further recommendations for this page's clean-up can be made at Talk:Railway.
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 resources 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 the upkeep of a larger train network takes time and experience. Rails can be built on the ground, or can be - with the Space Age expansion - elevated with the help of a rail ramp and rail supports so that trains can travel over obstacles.

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 a 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 train 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 in 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 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 is 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 set up a rail system with at least two train stops, which are placed on 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, and refueling/repair installations).

When you set up the train schedule (see below) and fuel the train, you can start the train on its 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 selecting 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. These actions can also be performed on the world map when the player is sitting inside the train.

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

  • Circuit condition – The train stop is connectable to the circuit network, so the signals can used for wait conditions.
  • Empty cargo – All inventories of the train are empty. Does not include fuel inventories.
  • Fluid count – The train (all fluid wagons summed) contains a specific amount of a certain fluid.
  • Fuel (all locomotives) - All locomotives in the train collectively contain a specific amount of fuel
  • Fuel (any locomotive) - Any one locomotive contains a specific amount of fuel
  • Full cargo - All inventories of the train are full. Does not include fuel inventories
  • Full fuel - All fuel inventories are full. Does not include cargo or fluid inventories
  • Has cargo - Cargo or fluid inventories contain items.
  • Inactivity – No items were added or removed for the specified amount of seconds.
  • Item count – The train (all cargoes summed) contains a specific amount of a certain item. Does not include fuel inventories.
  • 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.
  • Station is full - A specified stop is full, according to its set train limit. If the stop has no train limit set, this condition will not be met.
  • Station is not full - A specified stop is not full, according to its set train limit. If the stop has no train limit set, this condition will be met.
  • Time passed

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

The train group GUI. There are 2 trains in "Group A" and 1 train in "Group B"

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.

Train Groups

Trains are able to be assigned to a group. Selecting the small edit icon next to "no group assigned" will bring up the existing groups in the current world. One can select a group for the train to join, or create a new one. Editing the schedule of one train will change the schedules of all trains in the same group.

Schedule Interrupts

The Edit Interrupt GUI.

Schedule interrupts allow a locomotive to override its current schedule when a certain condition is met. Selecting "Add interrupt" in the locomotive's GUI will bring up a list of existing interrupts in the current world. One can be selected from the list, or typing in a name will create a new one. Creating one will add it to the locomotive and all locomotives in the current locomotive group.

To work, an interrupt requires two parts: a condition and a target station. When a condition is met, the interrupt will activate and insert the target station as a temporary stop in the locomotive's schedule. The locomotive will route to the target station and wait there until the specified wait condition is met, at which point it will leave and resume its original schedule.

An interrupt can be triggered on many of the same conditions as waiting at a stop, along with some new conditions:

  • At specified station - The train is waiting at a specific stop
  • Destination full or no path - The train's next stop is full, according to its train limit; or the train cannot physically reach its next station
  • Not at specified station' - The train is stopped somewhere other than the specific stop

Multiple trains can have the same interrupt regardless if they are in the same locomotive group or not. Editing an interrupt will change it for all trains which have the interrupt in their system.

Interrupts can be reordered within the locomotive's GUI like normal stops. If a train has multiple interrupt conditions true at the same time, it will prioritize interrupts that are higher on the list. This is important if one wishes a train to behave a certain way when working with a particular suite of interrupts.

Parameterized Interrupts

This is an advanced feature. When specifying an "Item Count" as a condition for a schedule interrupt, one has access to a new "Item Parameter" wildcard signal. This acts similarly to the "Anything" logic signal from the circuit network and can be used to create a generic train system. Whichever item is first loaded into the train will replace the wildcard signal with that item. This can be used to create a train system which dynamically creates schedules based on whatever is loaded.

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.

Elevated Rails

A simple bridge using elevated rails.

Space Age expansion exclusive feature.

Elevated rails come in a separate mod which can be enabled independently of Space Age. They come as two new buildings: rail ramp and rail support. Ramps and supports are the only items in the game able to be built in the oceans of Nauvis. When playing with Space Age itself, elevated rails become an important part of the game, as they are critical to bridging the oil oceans of Fulgora and the lava rivers of Vulcanus.

Elevated rails can be built using the rail planner. Pressing G will switch levels, and attempt to build a ramp up or down, if the player has one in their inventory. While holding SHIFT and targeting a section of rail on the opposite level, the rail planner will automatically place any ramps and/or supports necessary to reach that destination. A rail support must be placed every 16 straight tiles. Disassembling a support or ramp will automatically disassemble any rails which rely on that support.

Players and enemies cannot walk on elevated rail. A player can enter and exit the train if it is elevated as normal, and will be teleported to the ground. If the player attempts to exit while over water or lava, nothing will happen. Both types of rail signals can be placed on elevated rail, but not train stops.

Certain buildings are too tall to be placed underneath elevated rails:

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 1,000 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