User Tools

Site Tools


Minetest Forum
Content Database
Git Repository
Bug Tracker


Interlocking System

This is an extension of advtrains that aims to provide a feature-rich implementation of an interlocking system for advtrains railways.

The information on the wiki is incomplete. For now, refer to the old interlocking manual:

There is a list of hints at the tips page, written by 56independent. It was intended for the forum, but it has been edited for the wiki.


In real-world railways, a so-called interlocking system is a set of railway signals and trackside equipment. Its purpose is to prevent conflicting train movements which otherwise could result in derailing or colliding trains.

Real-world interlocking systems perform this task by setting routes. A route is a path along a track that a train can safely pass. To set a route for a train, the signalman (the operator of a signal box) has to set switches (turnouts) to the correct position and lock them in order to make a signal for a train show “Proceed” (usually a green light). In newer systems, this is done automatically by the interlocking system. A route can not be set if switches are locked to a wrong position by another route or if any portion of the route is occupied by a train.

The interlocking system in this Minetest mod tries to follow real-world interlocking systems as far as applicable. It divides tracks into track sections and implements a route setting mechanism following the same principle.

However, for the sake of simplicity of implementation and usage, not all concepts of real-world interlocking have been taken over.


If you are looking for a place to learn how real-world interlocking systems work, have a look at “SimSig”. SimSig is a “signal box simulation” software that lets you route trains through a track network using the same view as signalmen in real signalboxes.

Sadly, this program is not free by the GNU definition, and only runs on Windows. Unfortunately there are no alternatives to it, and even SimSig is threatened because enterprises make much money with distributing professional signal box simulations for training of new signalmen.

By looking SimSig simulations, you can obtain experience on how to set up your own interlocking systems in Advtrains. The SimSig glossary is a good place to look up unknown terms.

OpenTTD and Simutrans

OpenTTD and Simutrans are two free (by the GNU definition) “Transport Tycoon” games, in which the goal is to build a transport network using a variety of vehicles, including railways. Both of those games feature railway signals, which are used for the same purpose: to prevent train collisions. They range from simple block signals to advanced “Path signals” that come closest to signals in real-world interlocking and to the ones in advtrains.

However, there is an important conceptual difference between these games and advtrains: In OpenTTD/Simutrans, each train knows the complete path to its destination, which is calculated using a shortest-path search across the track network. This is not feasible for trains in advtrains, as you can also drive trains manually and the track network can in theory span the entire world. Thus, signals in advtrains can only select a pre-defined set of paths (the routes) depending on certain rules.

If you are experienced in one of these games, you can easily apply your knowledge by thinking of all signals in advtrains as “Path signals” that reserve the track up to the next signal. The only difference is that you need to program this path manually, the trains do not calculate it automatically. Simple block signals correspond to signals with a single route that just leads into the next track section and ends at the next signal, with this route being set to Automatic Working or ARS *.


The interlocking system introduces the concept of sections. Generally speaking, only one train is allowed to occupy a track section at any time.

signals are used to enforce this rule. They prevent a train from proceeding if the train would enter a section which is already (or will be) occupied by another train, thus preventing a collision. A system called LZB prevents that a train passes a signal that shows a “danger” aspect (usually a red light).

To determine the path that a train will take after passing a signal, you program routes. A route consists of the track sections the train travels through, and the positions in which turnouts have to be set for the train to reach its destination. As a general rule, routes always end at a signal facing the same direction as the start signal, except for some special cases.

To make automatic operation possible, ARS Rules are used to automatically determine the right route for a train approaching a signal.

Ideas and missing features

The interlocking system is already pretty feature-rich, however there are some features that are wished but missing. Some of them are my initial intentions, some have evolved from use cases encountered in applications. Here's a probably incomplete list, in rough order of priority:

  • The current route programming procedure can be very cumbersome, especially for large stations, where the number of routes to be programmed is exponential in the number of tracks in the station, or if the locations of switches and TCBs are far apart from each other. A proposal for a simplification is yet to be written.
  • A “Signalbox Panel” view, like this
  • Distant Signals (already reserved in signal aspect, but nothing else done yet)
usage/interlocking/start.txt · Last modified: 2021-11-03 17:45 by 56independent