Skip to content
Connected RailsConnected Rails

Lines

lines/*.ron is a LineSource — nodes, edges with geometry (straight/curve/clothoid), gradient, cant, permitted speed, trackside equipment, sections, signals and routes. The format is the same one the OSM/DGM importer writes, so cargo run -p content --bin import-line produces a file you can drop into a mod unchanged. mods/example/lines/beispielstrecke.ron is a short hand-written example.

The route editor (trainsim-route-editor) edits a line over aerial imagery, with the track tools of Train Simulator Classic’s World Editor: lay track by pressing and dragging the standing end (arc-to-point per click, a straight under Ctrl, snapping onto open ends, optionally as clothoid – arc – clothoid with the rulebook’s cant), start a lay on a track’s middle to make a turnout of it (drag along the track = facing, against it = trailing — split and wired automatically), split, join (a stake-out calculator after Zusi’s: transitions – arc – compensating straight, or a double arc with an intermediate straight; speed, radius, transitions and cant configurable), offset a parallel, build a crossover between two parallel tracks, set gradient break points, and bend existing track by dragging the round support-point handles of a selected edge. The throw time of a turnout is edited on the tracks that meet at it. A Checks panel lists wiring that compiles but fails on the line — a distant signal without its 1000 Hz magnet, a device beyond its track, a boundary on a node that is no buffer.

PZB magnets have typed Construction, Frequency and Linked signal fields. The Link PZB magnet tool connects a clicked magnet to a clicked signal, with visible link lines. Siemens and GWT/GTB housings render in both editor and game, with 2K/4K PBR materials and three distance LODs. A device payload can be (frequency:Hz1000_2000,build:Gwt,signal:Some(0),activation:WhenStop); signal addresses the signal table, not the device table. Hz500, Hz1000 and Hz2000 remain supported; omitted build defaults to Siemens for old routes. Double magnets evaluate their two circuits independently. See the prototype record and showcase.

The interlocking tables are edited there as well, so none of them has to be typed as RON: a placed Signal device gets its signal table entry in the selection panel (designation, controlling interlocking, kind, system, the signal it announces, guarded sections, whether it needs a route, diverging speed, signal type, 3D model and optional Zs fittings) together with the routes that start at it — where each one ends and what it locks, and Find routes, which runs out over the track and offers one route per leg of every turnout ahead, each ending at the next signal on it. Routes already in the file stay as they are, so finding again after a change adds what is new and touches nothing else. The Interlocking panel holds the sections (a section is the set of tracks that count as occupied together) and the routes (entry and exit signal, the sections and the overlap they lock, the switch positions they require). Derive path follows the track from the entry to the exit signal and fills the sections, the switch positions and the overlap in by itself. The overlap comes out at the regular length of the German rulebook for the speed the route ends at — 50 m up to 30 km/h, 100 m up to 60, 200 m up to 100, 300 m above that, and a diverging route counts with the entry signal’s diverging speed. Switch regular length off to walk out a length of your own; either way the sections it reaches stay editable afterwards. Pointing at a section or a route draws it on the map — its tracks in green, the overlap in orange, the flank protection in violet — so the index lists can be checked against the line.

Flank protection (flank on a route) is what keeps a vehicle off the path where a track joins it. Two kinds, both enforced by the interlocking: a protecting turnout (Switch(node, position)) is set and locked with the route like one in the path, and a protecting signal (Signal(index)) is held at stop for as long as the route is set — no route can be cleared from it meanwhile, and a signal another route already runs from cannot be taken as protection in the first place. The derivation fills both in wherever a route trails a turnout, which is where the leg it does not use joins the path; a turnout the route runs into facing needs none, because it already lies in the position that leads a flank movement away.

A track lock (Gleissperre) is a signal, not a device of its own: give the signal table entry kind: TrackLock and it has two states — stop is laid on, proceed is laid off. The interlocking lays it off for a route running over it and holds it on where a route names it as flank protection; no route ends at one, and none starts there. Everything visible is yours: mods/example/signals/gleissperre.ron is the two-rule signal type, and a signal_models/*.ron binds its "sperre_auf"/"sperre_ab" strings to the shoe — as a motions entry it swings between the two positions over its travel time instead of jumping. Without a model the app draws a plain shoe in the colour of the aspect.

Start a line with cargo run -p app -- --line example:beispielstrecke.

A LineConductor device marks a line conductor section — the cable, not what it transmits:

(kind: LineConductor, edge: 1, s: 0.0, payload: "(length:4000.0,cir_elke:false,end:false)"),

length is how far the section transmits, cir_elke: true marks a CIR-ELKE section (steeper braking curve, 5 km/h speed steps, speed rises effective at the head of the train instead of at its rear), end: true marks the last section of an LZB area, where the end procedure runs. The last two may be left out.

A Balise device carries the data points of the GNT, the speed supervision of a tilting unit. Inside a GNT area the on-board unit supervises a higher profile than the regular one — but only while the tilting technology works:

(kind: Balise, edge: 1, s: 0.0, payload: "(profile_speed:160.0,length:2400.0)"),
(kind: Balise, edge: 1, s: 2400.0, payload: "(profile_speed:0.0,target_speed:0.0,target_distance:0.0,length:0.0,end:true)"),

profile_speed is the GNT speed from that data point [km/h] — 0 releases nothing and leaves the regular profile in force. target_speed and target_distance name the point the braking curve leads down to; leave target_distance at 0 and the profile speed applies over the whole section. length is how far the data point is good for [m], measured to the rear of the train, and end: true is the sign-off at the end of the GNT area. Everything but profile_speed may be left out. A balise whose payload is not a GNT data point is ignored, so the same device kind stays free for ETCS later.

The movement authority is not written into the line: the LZB centre builds it every step from the block division and the state of the interlocking. The block division is a line datum of its own — BlockMarker devices naming the section behind them:

(kind: BlockMarker, edge: 2, s: 0.0, payload: "(section:2)"),

A platform is a device too — the stop board of a timetable stop and the ground the waiting passengers stand on (see People): it sits at the platform’s start and runs on for length, on the side the sign of its lateral_offset says (positive = left of increasing arc length), and height is the platform surface above the railhead. A line whose platforms are not modelled leaves the height out and the people stand on the ground:

(kind: Platform, edge: 0, s: 1770.0, facing: Both, lateral_offset: 5.0,
payload: "(name:\"Beispielstadt\",length:210.0,height:0.76)"),

An authority runs to the first boundary that is not clear: a block marker whose section is occupied, or a main signal at stop. v-target is the most restrictive point ahead — a speed step of the line counts as much as a stop, so a slow section needs no device of its own. Whether the block mode ends up as full or partial block mode falls out of the line data too — a line with block markers of its own divides the authority itself, a line without them leaves the main signals as the only boundaries, and the signals stay binding together with their PZB magnets.

A track type (track_types/*.ron) describes the superstructure — what the track is built like, not where it runs. Every dimension in it is a real one; the renderer extrudes what it says and invents nothing:

(
name: "Hauptbahn B 90 (Granit)",
texture: Some("example/assets/track/ballast-granite.jpg"), // ballast colour
normal_map: Some("example/assets/track/ballast-granite_nor.png"), // ballast normals (authored linear)
depth_map: Some("example/assets/track/ballast-granite_disp.png"), // height map -> parallax relief
occlusion_map: Some("example/assets/track/ballast-granite_ao.png"),// ambient occlusion between the stones
roughness_map: Some("example/assets/track/ballast-granite_orm.png"),// roughness in G, metallic in B
texture_scale: 1.6, // metres one repeat of those five covers, along and across
color: (0.46, 0.46, 0.47), // colour of a type that names no texture; the editor tints sections its own way
roughness: 1.0, // scales the rolling noise; jointed track > 1, slab track < 1
reverb: 0.0, // how much the surroundings ring: 0 = open line, 1 = tunnel
max_speed: 250.0, // superstructure limit [km/h], caps the line's speed profile
lzb: false, // true: the LZB line conductor is drawn in the track (and the rule check wants a conductor device)
// The physical build, in real dimensions. Defaults are the DB Regeloberbau
// (60E1 rail on B 70 at 60 cm, 30 cm ballast, fastening W 14).
oberbau: (
rail: R60, // R49 = 49E1/S 49, R54 = 54E3/S 54, R60 = 60E1/UIC 60
rail_condition: Polished,// New | Polished | Light | Rusty — what the traffic leaves on the head
sleeper: Concrete, // Concrete | Wood | SteelTrough | SteelY | TwoBlock | Slab (bare plate)
slab: None, // Some(Rheda2000 | RhedaClassic | Zueblin | Boegl | Atd): Feste Fahrbahn
sleeper_age: 0.15, // 0 = just laid … 1 = due for renewal; tints, sinks and skews the row
sleeper_length: 2.6, // across the track [m]; DB standard 2.6 m, B 58 2.4, Y sleeper 2.0
sleeper_width: 0.32, // at the underside, along the track [m] (B 70: 0.30, wood: 0.26, Y bar: 0.10)
sleeper_top_width: Some(0.24), // cast sleepers come out of the mould with draft
sleeper_height: 0.20, // under the rail seat [m] (B 70: 0.214, B 90: 0.20, wood: 0.16, trough: 0.09)
sleeper_mid_height: Some(0.165), // and shallower between the seats (B 70: 0.175)
sleeper_waist: Some(0.82), // plan width in the middle over the seat's (B 70: 0.75, B 58: 1.0)
block_length: None, // TwoBlock: one block across the track [m] (B 355: 0.70)
sleeper_spacing: 0.60, // between seats along a rail [m]; 0.60 = 1667 per km, slab 0.65
rail_pad: 0.010, // Zwischenlage under the rail foot [m]; Oberbau K plate + pad: 0.019, W 300: 0.030
fastening: Some(W14), // W14 | W300 (slab) | K (ribbed plate + clamp plates) | Ks (plate + Skl 12) | None
ballast_overhang: 0.50, // shoulder beyond the sleeper end [m]; Ril 820.2010 main-line examples: 0.40, 0.50 > 160 km/h; Y example: 0.30
ballast_depth: 0.30, // ballast under the sleeper [m]; 0.20 on a branch line
ballast_slope: 1.5, // shoulder falls 1:1.5 — run per unit of fall
crib_drop: 0.035, // how far under the sleeper top the crib ballast lies [m]
slab_width: None, // Feste Fahrbahn: slab width [m], None = the system's own
slab_thickness: None, // and its thickness under the sleeper tops
sleeper_texture: Some("example/assets/track/sleeper-concrete.jpg"),
sleeper_normal_map: Some("example/assets/track/sleeper-concrete_nor.png"),
sleeper_roughness_map: Some("example/assets/track/sleeper-concrete_orm.png"),
sleeper_occlusion_map: Some("example/assets/track/sleeper-concrete_ao.png"),
sleeper_texture_scale: Some(1.0), // metres one repeat covers; timber wants the plank (2.6)
),
tags: ["main-line", "welded", "b90", "granite"], // optional, for the library's search and filters (see Tags)
)

Everything but name is optional; a type that says nothing about its build is laid like the Regeloberbau. sleeper_top_width, sleeper_mid_height, sleeper_waist, fastening, block_length, slab_width, slab_thickness and sleeper_texture_scale follow the sleeper kind and the slab system when they are left out — cast concrete gets the draft, the shallower waist and W 14, timber gets a plain beam and Oberbau K, steel gets KS, a slab gets W 300 and the system’s own width and thickness.

The vertical datum is SO (Schienenoberkante, the top of rail), and the build stacks down from it: 172 mm of 60E1, a 10 mm pad, a 214 mm sleeper, 300 mm of ballast — so the Planum lies 696 mm under the rail, which is where the terrain pulls the ground beside the track down to.

The renderer builds what the oberbau says:

  • the rails from the rolled section (EN 13674): the R 300 running surface with its R 80 shoulders and R 13 gauge corners, the head, web and foot with their fillets. The section is checked against the profile’s own kilograms per metre, so an envelope that looks right but weighs wrong is a failing test. Both rails are rotated 1:40 about the inner head face, not sheared — the running surface leans in with them, which is why a rail head carries a moving line of sun instead of one flat white band. Curves are sampled by their radius, and past 320 m a plain envelope takes over. What the steel looks like is rail_condition: Polished is the mirror band of daily traffic over rust, Light a narrower, patchier band with rust creeping in from the edges, Rusty the uniform orange head of a siding nobody has used for a month, New the blue-grey mill scale of a rail rolled this year.
  • the sleepers as the form they are — Concrete as the tapered, waisted beam of a B 70 (a B 58 is a straight bar: sleeper_waist: 1.0, a B 90 the wider, flatter one); Wood as the sawn beam, which sleeper_age takes from black creosote to split silver-grey: the older the row, the wider the spread of shades and the more fresh black replacements stand among the grey; the rail seats remain aligned; SteelTrough as the open channel of a St 82 with its ends bent down into the bed; SteelY as the fork of a St 98 — one profile straight across the track, the second lying against it under one rail as the stem and bending off diagonally to its own seat a spacing along the other rail, every second fork turned 180° (one every 1.245 m at 0.60 m seat spacing, three seats each); TwoBlock as two blocks with the steel bars between them. Every sleeper carries its own tint, hashed from where it is, so a row is never one sleeper copied.
  • the fastenings use separate K, KS and W geometry. K has interrupted dovetail ribs, a 70 × 65 mm bridge clamp, M22 hook bolt, bevelled hex nut and double-coil spring ring. KS uses its own 170 mm Skl12 shape on the ribbed plate, with a flat washer under the nut. W uses a 151 mm spring over a black guide plate with recessed arm channels, a coated rectangular sleeper-screw drive and circular collar. Slab types retain the W300 elastic support stack; steel sleepers omit timber screws. Oxidised spring steel, rusted plate iron, zinc-coated drives and polymer use separate materials. The catalogue tags fastening-k, fastening-ks and fastening-w make each family searchable. See dimensions, photographs and reconstruction limits. Detailed fastenings are drawn to 160 m, sleepers to 400 m. Each rail seat is an instance of one mesh set per track type, carrying its local cant and grade in its transform, and seats exist only near the camera — so detail costs no memory with the length of a line.
  • the ballast bed on the DB Regelquerschnitt: the crest level with the sleeper tops (crib_drop under them), out to ballast_overhang beyond the sleeper ends, then falling ballast_slope (1:1.5) to the Planum. A bed whose surface lay at the sleeper underside would leave the sleepers standing on a plate, which is what makes track look like a ladder on a road. The example mod ships six beds — fresh granite, basalt/diabase, a pale limestone-coloured stone, an old main-line bed under a crust of fines, and a fouled brown branch-line bed, plus an earth-dominated siding bed — and a type picks one by naming its maps.
  • the change of type: material changes preserve the support grid. A new pitch continues after the last support with a transition bay, avoiding overlapping rows; a ballast bed runs its shoulders over six metres into the next bed’s section (a B 90’s 0.50 m shoulder tapering to a B 70’s 0.40, a branch line’s thin bed climbing to the main line’s), and ends in a wall down to the formation where a slab follows or the line ends, so nothing looks into an open bed.
  • the LZB line conductor where lzb is true: the 13 mm black cable clipped to every second sleeper down the track centre, its partner lying on the gauge-side foot of the same rail. Both conductors exchange lanes every 100 m, with separate sheaths at the crossing; the return never switches to the opposite rail.

Numeric track maps ship as lossless PNG and receive actual mip chains, including height maps. The running rail carries transverse position independently from section depth, allowing fine derivative-filtered oxide and longitudinal wheel marks without stretched rust blotches. Reference sources, dimensions and known modelling limits: tools/track/REFERENCES.md.

Feste Fahrbahn. slab: Some(...) replaces the bed with the slab of one of the DB’s systems, and the sleepers of sleeper stand in it as far as the system shows them: Rheda2000 (B 355 two-block sleepers a few centimetres proud of a 2.8 m monolithic slab — the bulk of German slab track), RhedaClassic (B 70 in infill concrete inside a trough whose walls stand up beside the track), Zueblin (monoblock sleepers vibrated into the slab, only their tops showing), Boegl (prefabricated plates 6.45 m long on a 6.50 m system pitch, with the rail seats cast in as pedestals and a joint between plates — sleeper: Slab, no sleepers), and Atd (concrete sleepers standing on a black asphalt layer, a stop block in every crib). The slab stands on its bearing layer, which shows as a ledge either side; the ballast fields are unused, rail_pad is the 30 mm stack of a Vossloh 300 seat (Zwp pad, Grp plate, Zw pad), and the seats run at sleeper_spacing (0.65 m on the cast systems). sleeper: Slab on its own is the Bögl plate.

Get texture_scale right. It is how many metres one repeat of the bed’s four maps covers, and it is the difference between ballast and asphalt: DB Gleisschotter is 31,5/63 mm, so a scan laid down twice too small reads as a paved surface and twice too large as riprap. Use the physical size the scan was taken at — most ambientCG gravel is 1.5 to 2.2 m. The same goes for sleeper_texture_scale: the sleeper is mapped isotropically, u along its length and v around its section, so a timber plank set wants the whole sleeper (2.6 m) and a concrete scan wants its own metre.

Normal, height, occlusion and roughness maps are numbers, not colours — author and export them linear; the loader is told so and does not gamma-decode them. The roughness map is packed the glTF way, roughness in the green channel and metallic in the blue, so a steel sleeper’s scan carries its own metalness. A type that names no textures is skinned in its color. tools/track/build_textures.py is how the example mod’s sets are made from CC0 scans, and the pattern to copy for a mod’s own.

A line assigns types per edge as steps over the arc length, so one edge changes its superstructure section by section:

track_type: [(0.0, "example:b70"), (3000.0, "example:holz")],

Every track has to name one. There is no built-in type and no reserved "default" name: what a track is built of is part of the module, not of the engine, and a module that leaves it out does not compile — the compiler reports MissingTrackType(<edge>) and the route editor’s rule check says the same thing before the run. A type from another mod is a dependency like any other; name that mod in depends:. This is deliberate: a silent fallback is how a line ends up on untextured grey ballast without anybody being told.

max_speed merges into the speed profile every consumer already reads (AI, LZB, HUD, scoring); roughness reaches the sound table as the Roughness quantity (the default rolling entries carry a volume factor on it, see Sounds); reverb drives the reverb the simulator mixes under everything the player hears — a tunnel type sets 1.0, a station hall or a deep cutting sits around 0.3 … 0.6. Modelling the room on the track type rather than on the terrain is the same trade roughness makes: a line says where its tunnels are by assigning the type, and nothing has to trace geometry at run time. The route editor edits the sections in the selection panel (a color chip per section, the map tints the track ribbon to match) and its rule check flags tracks that name no type at all, names no installed mod has, and LZB types on a line that places no line conductor. The lay tool arms itself with the first installed type, so track drawn in the editor carries one from the start.

What hangs over the track is a property of the track, not an assumption of the vehicle. Every edge states its own wire, section by section, in the same shape as the other profiles:

electrification: [(0.0, "ac-15kv"), (1200.0, "none"), (1260.0, "dc-1.5kv")],

The ids are "ac-15kv" (15 kV 16.7 Hz), "ac-25kv" (25 kV 50 Hz), "dc-3kv", "dc-1.5kv", "third-rail" (750 V DC) and "none" for track under no wire at all. An edge that says nothing carries no wire.

That example is a system boundary: sixty metres with nothing over them, because the wire of two systems must not be bridged by a pantograph. A siding under no wire is the same thing with one entry.

A vehicle states what it is built for — its pantograph blocks, one per system, and the main switch closes only where the line carries one of them. The volts alone do not decide: 25 kV is plenty of volts for a 15 kV locomotive and still the wrong system, and the switch stays open. Running off the end of the wire drops it, exactly like a neutral section.

The route editor edits the wire in the selection panel, on the track that is selected — there is no line-wide switch. A line file written before the wire moved onto the track may still carry a line-wide electrification: "ac-15kv"; it keeps applying where an edge says nothing, and is kept on save, but nothing writes it any more.

Step profiles per property are right for a compiler and wrong for a person. A 40 km/h restriction through a station means editing the speed steps of every track it touches, and changing it again means finding them all a second time.

A track area is that job the way a builder thinks about it: mark the stretch, name it, and set the properties on it.

areas: [
(
name: "Bahnhof Musterstadt",
color: (0.95, 0.72, 0.25),
width: 2.5, // half-width of the stroke it is painted with [m]
spans: [
(edge: 3, from: 0.0, to: 850.0),
(edge: 4, from: 0.0, to: 850.0),
(edge: 7, from: 120.0, to: 640.0),
],
speed: Some(40.0),
track_type: Some("example:bahnhofsgleis"),
// cant, grade and electrification are left unset: what the area does not
// state, it does not touch.
),
]

A span is [from, to) along one track. What an area does not set it leaves alone — which is what lets a speed restriction run across an electrification boundary without disturbing the wire. Areas are laid over the tracks’ own profiles in file order, so a later area wins where two overlap: that is what “drawn on top” means on the map.

Nothing in the simulation knows about them. Loading bakes them down into the same step profiles the tracks have always carried, so an area is an authoring convenience with no run-time cost and no new concept downstream.

Property Sets
speed permitted speed [km/h]
cant cant [mm]
grade longitudinal gradient [‰]
track_type superstructure — rail section, sleepers, ballast, texture, roughness, reverb, speed limit, LZB flag
electrification what hangs over it (see Electrification), or "none"

In the route editor the areas are painted: pick Mark area, press on a track and drag along it. The stroke follows that track until the button goes up — it never jumps to a neighbouring track halfway through a station — and what it leaves behind is a wide coloured stroke over the rails, half transparent so the track still reads underneath. With an area selected the next stroke joins it, which is how one area comes to cover a whole station, one track at a time. The stroke width is a property of the area, so a wide marking stays wide when the file is opened again; the brush setting is the width new areas get. The selected area keeps its colour and wears the editor accent as an outline. The Track areas panel lists them, and the selection panel edits the properties — each a checkbox and a value, so “set” and “left alone” are the same two states the file has. The rule check flags an area that covers nothing, sets nothing, lies off its track or names a type no installed mod defines; the track panel says when an area lies over the track being edited, so a value edited there that never reaches the line does not go unnoticed.

Areas follow the track they are marked on: splitting a track splits a stretch that straddles the cut, and deleting a track takes its stretches with it.