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

Railway

From Official Factorio Wiki
Revision as of 23:02, 10 December 2016 by Gangsir (talk | contribs) (Massive overhaul and cleanup)
Jump to navigation Jump to search


For the research see Railway (research)

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

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

For some tutorials on railway use, see: Railway/Tutorials

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.

Switches

  • There is no visual representation of a working switch. Using the rail planner, the player must place a rail overlapping an existing rail to form a switch. Switches are forks in tracks that allow a train to pick between two directional options.
  • The crossing of two straight tracks is not usable as switch, as trains have a limited turning radius. They do, however, connect signal blocks which helps prevent collisions.
  • Parallel tracks do not interact with each other 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)

Crossing tracks

An example of a safe railway crossing.

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

A checklist of proper track crossing etiquette:

  1. Zoom out, so that you can see a train coming.
  2. Look left, then right.
  3. Check for signals nearby: If a rail signal suddenly jumps from green to red or green to yellow, a train is coming. Do not cross.
  4. Avoid walking near the tracks, as you do not need to be fully on the tracks to get hit.
  5. While it is possible to get into/out of a train while it is moving, a miss can cost your life. The sides of the train can still deal damage.
  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.
  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.
  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.

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.

Trains

Train components:

Diesel locomotive Cargo wagon |-
File:Railway-locomotive-gui.png
Locomotive screen: 1: switch to schedule screen; 2: Fuel inventory;
Placing a Cargo wagon so it is attached to the train.
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 wagons to transport resources with the train.
  • 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 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.
  • A train needs fuel to drive. Fuel can be added by inserters.

The locomotives' inventory is only used for Fuel. To transport items Cargo wagons 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.

Stations

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 wagons, load fuel into the locomotive(s), or repair trains.

High-performance train station for short trains. Highest possible unload rate, waiting spots, refueling, defended, multi-train capable, modular, extend-able.

Don't mix up train stations with train stops. A train station is a concept, whereas a train stop is an item.

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

Signals

The two types of signals in Factorio:

Rail signal Rail chain signal |-

Understanding rail signals can be difficult. Several terms critical to understanding them are below:

  • 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.
  • 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 this forum post for a good explanation about blocks.

Basic Signalling Rules

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

Deadlocks

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 unresolvable signal conflict. There are a few different types of deadlocks:

  1. 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.
  2. 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.
  3. 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.

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 circles to create junctions.
  • Use better 3-way junctions. See A Detailed Look at a Bidirectional Three-way Train Intersection
  • Use circles 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

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.

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

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

Train schedule

The player can set up a list of train 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 popup appears with a list of all train stops. If you select one, another popup appears where you have to select a wait condition.

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

  • Time passed - the only one available until version 0.12.
  • Inventory full - All inventories of the train are full.
  • Inventory empty - Same as above, but empty.
  • Item count - The train (all cargoes summed) contains a specific amount of a certain item.
  • Circuit condition - The train stop is connectible 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.

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 you have multiple terms connected with AND and OR in your list, the train checks will calculate the conditions in order.

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

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

  • Train is 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 segment or 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?

No path

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

  • Can the train reach every station 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?
  • If you use rail signals, check that the signals are all allowing traffic in the correct direction.


Relationship to OpenTTD

Factorio's railway system works basically exactly like 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

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

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.

Videos

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