Skip to content
Connected RailsConnected Rails

Modding

Connected Rails is built for mods: your own locomotives, your own signals, your own lines. The shipped content — the example line and its trains, the signals, the trees, the people — comes as mods itself, so what it does, your mod can do too.

A mod is a directory below mods/. Most of it is declaration in RON: masses, brake equipment, track geometry, aspect tables, timetables — validated while loading, diffable and editable without programming. Lua covers only real behaviour, the things a table cannot express: tap changer logic, a signal aspect that depends on time, the story of a scenario. Nothing is fatal: a broken file is a warning, everything else still loads.

mods/example/ is a complete, working reference mod — copying from it is the fastest way to start.

Read the guides in this order; each one builds on the mod made in the first.

  1. Your first mod — the folder, mod.ron, loading it and seeing it in the menu.
  2. Adding a vehicle — base data, model, cab, sounds and behaviour.
  3. Building a line — track over aerial imagery, signals, interlocking, terrain.
  4. Adding a signal — signal types, models and kits.
  5. Writing a scenario — events, timetables, the Lua director and operating days.
  6. Placing scenery — objects, buildings, vegetation, roads and power lines.
  7. Packaging and publishing — testing, versions, .crails packages and licences.

When something does not show up as expected, see Troubleshooting.

Three desktop programs do the work that would be tedious in a text editor. Each one writes the same RON files described in the reference, so a file can always be finished by hand.

Program Edits Page
route-editor lines: track, equipment, interlocking, terrain, scenery Route editor
vehicle-editor vehicles: base data, block diagram, model, cab, displays, sounds Vehicle editor
signal-editor signal kits: modules, parts, mount points, lamp bindings Signal editor

The route editor also imports track from OpenStreetMap and heights from DGM and can detect cars and trees in the aerial imagery.

Terminal window
cargo run -p route-editor
cargo run -p vehicle-editor
cargo run -p signal-editor

Everything is addressed as "<mod>:<file stem>" — mods/example/vehicles/br101_afb.ron is example:br101_afb — so two mods may use the same file names.

In the mod What it is Reference
mod.ron manifest: id, name, version, dependencies, library Mod structure
vehicles/*.ron, blocks/*.ron, displays/*.html locomotives and coaches, block presets, cab displays Vehicles
signals/*.ron, signal_models/*.ron, signal_kits/ aspect tables, 3D signal models, kits Signals
lines/*.ron, track_types/*.ron track, equipment, interlocking, superstructure Lines
objects/*.ron track objects, buildings, walkways Track objects and buildings
stabling roads, portals, jobs/*.ron where trains wait and enter, AI shunt jobs Stabling roads and shunt jobs
vegetation, fields stands of trees, crops Vegetation and fields
roads, overhead lines, wind turbines infrastructure beside the line Roads, overhead lines and wind turbines
heights/, terrain brush, markers height data and terrain Height data and terrain, Terrain rendering
compositions/*.ron, scenarios/*.ron, timetable/*.ron, days/*.ron modules chained into lines, scenarios, timetables, operating days Modules, scenarios and operating days
scripts/*.lua scenario director, vehicle and signal hooks Scenario scripting, Lua sandbox
characters/*.ron people: the walker and the passengers People
baked light in models sky occlusion and interior light Baked light
.crails packages testing, packaging, licensing Testing and distribution

RON data, assets and Lua scripts of a mod are not derivative works of the game and may be distributed under any licence — see the mod exception in LICENSE and Testing and distribution.