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
No edit summary
m (UK -> US english)
(80 intermediate revisions by 33 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
[[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)]]''


{{cleanup|Lots of outdated info, should be updated to completely reflect V0.13. The large amount of links at the bottom should also be dealt with.}}
'''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.


<i>For the research see [[Railway (research)]]</i>
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.


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.
== Infrastructure ==


Railway construction, however, is not understood 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 takes time and experience.
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.


; [[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:
* [[Rail]]s (tracks)
* [[Locomotive]]s


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


[[File:rail_planner_starter.jpg|thumb|right|200px|The small green arrow used to start the planner.]]
Rails are placed using the rail planner. Place a single rail, then mouse over the rail while still holding rails in hand. A green arrow will appear on the rail indicating the direction the new rail will be placed. Click or shift-click on the triangle to start the manual or ghost planner.
Bear in mind that rails can rails are placed on a two-tile grid, so you cannot move a rail by only one tile.
[[File:Manual_rail_planner.jpg|thumb|left|200px|The rail planner operating in manual mode.]]
[[File:Ghost_rail_planner.jpg|thumb|200px|right|The rail planner operating in ghost mode.]]
===Manual Planner===
The manual planner can be used to place rails at close range, around 10 rails at a time. The rails will path towards the cursor. Move the cursor until you get the desired path, then left-click to place the rails. This process will repeat until you press <code>Esc</code> to release the planner.
===Ghost Planner===
The ghost planner can be used to place long stretches of rail at once, by creating ghosts of rails that can be placed by [[construction robots]], either from [[roboport]]s or a [[personal roboport]]. Move the cursor to the position you want the rail to terminate, press <code>R</code> to rotate the last rail to the desired orientation, then left-click to place the ghost rails. The rails will be placed using the shortest route from the origin to the destination avoiding obstacles. You can shift-click to use the shortest route; trees and stone rocks in the way will be marked for destruction. Use <code>Esc</code> or <code>Q</code> to release the planner.
[[File:rail-switch-example-1.png|thumb|left|256px|Composition of rails to form switches, straight and diagonal.]]
[[File:Railway-parallel-example.png|thumb|right|256px|Switching between rails with and without adequate spacing.]]
=== Switches ===
=== Switches ===
* There is no visual representation of a working switch. Using the rail planner, the player must place a [[straight rail|rail]] overlapping an existing rail to form a switch.
* 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 [[Railway/Signal/Block 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.
* 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)
 
<br style="clear:both" />


[[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 ===


[[File:fff-140-controlled-gates.gif|thumb|An example of a safe railway crossing.]]
'''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.'''
 
'''Be careful when crossing tracks!'''
 
Trains travel extremely quickly, and deal large amounts of damage when they impact a target. If no precautions are taken, crossing the track can result in a swift death.  
 
==== Avoiding unwanted contact with trains ====


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.
# Look left, then right.  
# Look left, then right.
# Check for signals nearby: If a [[rail signal]] suddenly jumps from <span style="color:#00FF00">green</span> to <span style="color:#FF0000">red</span> or <span style="color:#00FF00">green</span> to <span style="color:#BFBA0A">yellow</span>, a train is coming. Do not cross.
# 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.
# 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.
# 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.  
# 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.
# 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 travelling 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 travelling slower.
# 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.


==== Cross the tracks safely ====
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.


Since version 0.13, 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.
{{clear}}


== Trains ==
== Trains ==
Train components:
{| class="wikitable"
{| class="wikitable"
|{{imagelink|diesel-locomotive|Diesel locomotive}} || {{imagelink|cargo-wagon|Cargo wagon}} |-
|{{Imagelink|Locomotive}} || {{Imagelink|Cargo wagon}} || {{Imagelink|Fluid wagon}} || {{Imagelink|Artillery wagon}}
|}
|}


[[File:Railway-locomotive-gui.png|thumb|left|256px|Locomotive screen: 1: switch to schedule screen; 2: [[Fuel]] inventory;]]
[[File:Railway-assemble-train.png|thumb|left|300px|Placing a [[Cargo wagon]] so it is attached to the train.]]
[[File:Railway-assemble-train.png|thumb|right|256px|Placing a [[Cargo wagon]] so it is attached to the train.]]
[[File:station-example-1.png|thumb|left|256px|A very minimal station.]]


* A train consists of at least one locomotive, but the player may add additional locomotives to keep the train moving at maximum speed, allow it to move in both directions automatically, or they may add [[Cargo wagon]]s to transport resources with the train.
* A train consists of at least one locomotive.
* Locomotives may be '''manually''' driven forwards or backwards, however, locomotives are generally slower going backwards. The left and right movement keys are used to change direction at switches.
* Trains can have more than one locomotive and any number of [[wagon]]s.
* Trains can only drive forwards automatically; there must be a forward path from to the destination station. This can be solved by placing a locomotive at either end of a train (facing opposite directions), or adding a loop in the rail. Note that signals in a loop can misbehave due to detecting trains before they arrive.
* 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.
* A train needs [[fuel]] to drive. Fuel can be added by inserters.
* 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 [[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.


<br style="clear:both" />
{{clear}}


== Stations ==
== Stations ==
[[File:Wagon-lengths.png|thumb|400px|[[Railway network/Train station/Positions|Inserter positions]] for the locomotive and first three wagons.]]
[[File:station-example-1.png|thumb|right|256px|A very minimal train station.]]
A '''train station''' is a combination of at least one [[train stop]] plus a [[Storages|storage]] and/or distribution system, used to
* fill or empty [[Cargo wagon]]s, or
* [[Vehicle/Train/Refueling|load fuel]] into the [[Diesel Locomotive|locomotive(s)]], or
* repair trains.
[[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 extendable.]]
'''Don't mix up ''train stations'' with ''train stops''.'''
: A train station is a concept, whereas a [[train stop]] is an item.


=== Position of the inserters ===
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. For detailed information on where to place train stop inserters, see [[Railway/Train station/Inserter positions|Inserter positions]].
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.


== Using roboports and logistic bots as station integrated storage ==
{{clear}}


Logistic chests can be used to load or unload from a train, allowing a train station to operate completely within the logistic system. [[Requester chest]]s and [[Provider chest]]s are used for loading and unloading respectively. Note that trains cannot be loaded or unloaded by logistic robots directly: use inserters and logistic chests.
== Signals ==
{| class="wikitable"
| {{Imagelink|Rail signal}} || {{Imagelink|Rail chain signal}}
|}


==== Examples ====
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.
* [http://www.factorioforums.com/forum/viewtopic.php?f=16&t=1773&start=10#p15125 Example#1]: Second pic.
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=1253#p13691 Example#2]: Last pic on the page.
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=4511 Trains and robots.]


=== Other ===
The [[Tutorial:Train signals|train signals tutorial]] contains an in-depth explanation of rail signals, blocks and deadlocks.
* Trains can only be filled or emptied when they are fully stopped.
* In automatic mode, trains will usually stop only at [[train stop]]s.  Exceptions are destruction of the tracks and running out of fuel, both of which will stop the train.
* If you [[Vehicle/Train/Driving|drive the train yourself]], you can stop the train anywhere.
* See [[Railway network/The renaming-of-train-stop-trick]]: Trains find all train stops with the same name.
* If you have multiple unloading stations and want to distribute the trains equally you can use a [http://www.reddit.com/r/factorio/comments/3bz9m8/eli5_train_stations_as_presignals/csqwkd1 stacker station.]


== Signals ==
=== Basic signaling rules ===
{| class="wikitable"
* There can only be one train in a block at any time. A train spanning multiple blocks occupies them all.
| {{imagelink|rail-signal|Rail signal}} || {{imagelink|rail-chain-signal|Rail chain signal}} |-
* 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.
[[File:Railway-signals-1.png|thumb|left|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.]]
* [[Rail signal]]s separate a new block and reflect its state: green - free, yellow - reserved, red - occupied
[[File:station-example-3.png|thumb|right|256px|Train Station with multiple [[Train stop]]s and [[Rail signal]]s to allow operation of multiple trains on single track.]]
* [[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
[[File:Railway-signals-2.png|thumb|left|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.]]
* 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.
[[File:Railway-test-setup.png|thumb|right|256px|A simple test setup to start with. Containing [[Train stop]]s for schedules, and [[Rail signal]]s to watch their behaviour.]]


Understanding rail signals can be difficult. Several terms critical to understanding them are below:
== Automated transport ==
*Rail segment
[[File:locomotive_gui.png|thumb|300px|The wait condition tab in the locomotive's GUI.]]
: 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.
*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 mouseover. '''See also [https://forums.factorio.com/viewtopic.php?f=18&t=3811#p28310 this forum post]''' for a good explanation about blocks.


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.
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.


=== Basic Signalling Rules ===
This section covers items used to make trains automatically transport items between stations. The player should be familiar with creating a rail system.
*There is at most 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 [[Rail signal]]
*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.


<br style="clear:both" />
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).


== Deadlocks ==
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.


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.
=== 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 {{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.


=== How can a deadlock happen? ===
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.


See [http://www.factorioforums.com/forum/viewtopic.php?f=54&t=6984&p=54689#p54689 this article].
It is also possible to set no wait condition, this causes the train to simply pass by the station without stopping.


=== Factors that influence the deadlock chance ===
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).


* It depends on train length (shorter trains will have a lower chance with the same rail/signal layout)
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.
* Depends also on size of the blocks: More space for the blocks means lower chance of deadlock.
* Depends on track layout: Some layouts have a higher chance of locking, than others.
* The more trains you have, the bigger the chance.
* The chance is also much higher, if the trains need to wait often in areas with rail-crossings.


=== A deadlock can happen only by chance ===
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.


Deadlocks will happen by chance only!
==== 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:


It is possible, that you use a quite volunerable layout, but with short trains and low traffic you never achive a deadlock in a game. The same can happen the other way around.
<pre>
Full cargo inventory
OR 30 seconds passed
</pre>


There is no simple mechanism to forecast, if and when a deadlock can happen, but with some experience and using the above ideas and the links below, this is a easy manageable problem.
Wait until cargo full, ''or'' circuit condition Oil > 3000:


<pre>
Full cargo inventory
OR Circuit condition - Oil > 3000
</pre>


=== How to reduce the chance for gridlock? ===
Wait until empty, ''and'' 30 seconds passed, ''and'' 5 seconds of inactivity:


* Don't use 4-way junctions or circles to create junctions.
<pre>
* 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]
Empty cargo inventory
* Use circles only for changing direction of train
AND 30 seconds passed
* Build more tracks around junctions. try to avoid jams around junctions. If that doesn't help, use more tracks. :)
AND 5 seconds of inactivity
</pre>


== Railway Safety ==
Wait until iron ore is low, ''or'' copper ore is low ''and'' at least 30 seconds passed:
[[File:fff-140-controlled-gates.gif|thumb|An example of a safe railway crossing.]]
Trains travel very quickly and deal great damage upon impact. Without proper railway safety, crossing an active track can result in a swift death.


Some tips for avoiding unwanted contact with trains:
<pre>
*Zoom out before crossing so you can see trains coming.
Cargo: Iron ore < 500
*Check for nearby signals; if a signal changes from green to yellow or red, this means a train is approaching.
AND 30 seconds passed
*Avoid walking near tracks; you can be hit even if you are not fully on the track.
OR Cargo: Copper ore < 500
*Do not try to enter/exit a train while it is moving.
AND 30 seconds passed
</pre>


=== Crossing Safely ===
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):
A safe railway crossing can be created by never allowing a train and the player on the track at the same time. When a train has the segment reserved, the gates close to the player, restricting access to tracks. When the player is on the tracks, the signals are reserved by the [[circuit network]], and trains must wait for the player to clear the tracks before continuing. The gates onto the rest of the track also close, preventing the player from getting to the tracks outside the crossing.


== Defence of rail systems ==
<pre>((Cargo: Iron ore < 500 AND 30 seconds passed) OR (Cargo: Copper ore < 500 AND 30 seconds passed))</pre>
As trains are a priority target of [[Enemies]], any place where trains can stop should be (more or less) [[Defense|defended]]. This is of course more important at train stops/stations. When a train moves it is more or less invincible and destroys nearly everything in the way, especially Enemies and players.


== Relationship to [http://www.openttd.org/ OpenTTD] ==
Which is the same as this:
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.


== User tips and tricks ==
<pre>((Cargo: Iron ore < 500 OR Cargo: Copper ore < 500) AND 30 seconds passed)</pre>
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 ===
Unfortunately, there is no way to write that shorter form in the current UI.
Factorio is an alpha version and you need to lay the rail-sections piece by piece. It's not as hard as you might think but railway can currently not be explained in simple words and even pictures don't describe it well.  
</div></div>


==== Videos ====
=== Troubleshooting ===
We recommend viewing some videos of how to build a simple railway, which makes the basic steps very simple.


* [http://www.factorioforums.com/forum/viewtopic.php?f=54&t=6984 Factorio Tutorial: Signals and Multi-train Networks] by Gepwin (read the whole article!)
Below are some things to verify if a rail system or train is not working.
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=5451 Factorio Traintorial, all about trains] by Gepwin.
* ''v0.10, english [http://www.youtube.com/watch?v=XSGYSbEPpbM Rail basics tutorial] by MangledPork Gaming.
** And the second part of the tutorial [http://www.youtube.com/watch?v=k6wxl4FdSuQ Factorio Rail Tutorial Part 2: Signals]
* ''[[Let's play]]: Have a look into the list of known let's play videos!
* ''[http://www.reddit.com/r/factorio/comments/26igal/train_signal_tutorial/ A train-signal tutorial with pictures].
* v0.8, english [http://www.youtube.com/watch?v=RmyOdxi5hR4 Inzainia Plays: Factorio ver 0.8.0 EP:8 (Trains, Trains, Trains!!!)]
* v0.6, german [http://www.youtube.com/watch?v=idOaZpX8lnA Silver's Factorio Basic Train Tutorial]
* Or look some [http://www.youtube.com/results?search_query=lets%20play%20factorio%20trains Let's play factorio] :)


==== General Beginner Strategy ====
* Is the train fueled? Ensure that the locomotive has [[fuel]] of some kind.
Do not immediately begin to build a railway, fully running. Try to make a circle first and expand it. Play around with all items.
* Misplaced or non-functional switches? Ensure that the train can plan a path through the switches.
* 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.
* 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.


A general strategy to begin:
==== No path ====
* At first you need tracks. You can craft the tracks of course yourself, but we recommend to [[Crafting network|automate crafting]] for that, because you need many.
When trains cannot reach the target, a "no path" symbol pops up over the locomotive. Check:
* Build an [[Iron stick|iron stick assembly]], feed with this one assembly for [[Straight rail]] and [[Curved rail]].
* Can the train reach its current destination by '''only driving forward'''? Build turning slopes or place a locomotive at both ends of a train!
* For the beginning you need about 100-200 straight and 10-20 curved rails, about ten times more straight rails than curves.
* 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.
* Place some rails and built a small track.
* If you use rail signals, check that the signals are all allowing traffic in the correct direction.
* Craft a [[Diesel locomotive]] and a [[Cargo wagon]].
* 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.
* Place both on the built tracks, so that they connect to a train.
* Put [[Fuel]] into the loco.
* Enter the locomotive (press enter while standing besides) and drive around. :)


=== About Trains ===
If you are still having problems, consider:
* [[Vehicle/Train]] - the handling of loco and wagon
* 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.
* [[Railway/Train path finding]] - how the trains find their path.
[http://imgur.com/a/Nq2Yk A pictorial summary of typical problems].


=== About train stations and stops ===
== Achievements ==
* [[Railway/Train station]]s - about the loading/unloading of trains
{{Achievement|getting-on-track}}
* [[Railway/Automated transport]] - all about automated transport.
{{Achievement|trans-factorio-express}}
{{Achievement|watch-your-step}}
{{Achievement|getting-on-track-like-a-pro}}


=== About Signalling ===
== See also ==
* [[Railway/Signal/Tutorial]]
* [[Tutorial:Train signals]]
* [[Railway/Deadlocks]]
* [[Railway/Train_path_finding]]
* [http://www.factorioforums.com/forum/viewtopic.php?f=30&t=6936&p=54469#p54469 train signal behavior]
* [[Locomotive]]
* [[Cargo wagon]]
* [[Fluid wagon]]
* [[Artillery wagon]]


=== Misc tips ===
{{C|Logistics{{!}}#Railway}} {{C|Railway{{!}}#Railway}}
* When supply trains follow the player: http://www.factorioforums.com/forum/viewtopic.php?f=5&t=6203
* The player may lay rails by sitting inside of the train.

Revision as of 18:39, 30 November 2023

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.

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 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