Vehicle editor
cargo run -p vehicle-editor # new vehiclecargo run -p vehicle-editor -- mods/example/vehicles/br101_afb.roncargo run -p vehicle-editor -- mods/example/vehicles/br101_afb.ron --graph # open on the block diagramThe left panel holds the vehicle’s base data, the right one the model, the middle shows the
3D viewport with the track and a reference body of the length over buffers — so it is
immediately visible whether the model matches the LÜP. Right mouse button rotates, the
wheel zooms. Chips at the top left of the centre switch it between the 3D model and the
block diagram; the --graph flag starts on the diagram.
Base data (everything that is declaration, not script):
| Field | Meaning |
|---|---|
| Length over buffers | the official LÜP — spacing of the following vehicle. Draw the buffers 1–2 cm compressed in the model so they do not intersect in curves |
| Gauge | checked against the infrastructure, and used for the curve resistance |
| v max | highest permitted running speed, independent of the traction characteristic |
| Mass | tare mass; payload separately |
| Rotating mass | allowance for rotating parts of running gear and drive — acts on the inertia, not on the weight. Diesel-hydraulic 10–15 %, diesel-electric and electric loco 15–25 %, freight wagon 8–10 %, coach 6–9 % |
| Axle base sum | sum over all bogies (two bogies of 2.5 m → 5.0 m), not the vehicle length — the larger the value, the higher the curve resistance |
| Rolling resistance | bearing friction and rolling of the wheel; “Suggest” derives a standard value from the mass |
| Air resistance | cw·A [m²]; F = ½·ρ·cw·A·v². Without it the quadratic Davis term applies |
| Curve resistance | factor on Röckl — 1 = as the axle base sum gives it; lower it for radial steering bogies |
| Tilt angle | 0 for conventional vehicles, ~8° for German tilting units |
| Hunting | −1 no hunting, 0 standard (tuned for bogie vehicles), up to 1 more — raise it slightly for single-axle running gear |
| Max payload | e.g. about 5 t for a passenger coach, per the anscriptions for freight |
Drive, brake, equipment and behaviour are the block diagram — a blueprint-style node
editor: the vehicle is a circuit of components, and the physics follows from what is wired
to what. The palette on the left (searchable, grouped by category) carries every physical
component as a block — pantograph, transformer, tap changer, starting resistors, chopper
and series/parallel switch, traction converter, series-wound and induction motors, diesel
engine with hydraulic transmission and retarder, with a mechanical gearbox and its clutch,
with a hydrostatic drive or with generator and load regulator,
boiler, firebox, cylinders, injector and tender of a steam locomotive, the complete air
or vacuum brake from compressor to brake rigging including EP brake, angle cocks,
limiting and retaining valve, cooling systems, wheelset with its bogies and axles, cab, AFB, the
logic blocks (reading, characteristic, PID, notching, rate of change, switch, output),
Sifa, PZB, LZB, doors and the Lua script hook — plus the presets installed mods bring
(blocks/*.ron, e.g. a Voith L 620 as a preset of the hydraulic transmission). A block is
dragged out of the palette onto the canvas and lands where the pointer lets go; a click on
it appends it below the diagram instead. A right click on the canvas adds a
block, a right click on a node removes it, a drag from pin to pin wires them; pins are
colour- and shape-coded by domain (shaft, force, electrical, pneumatic, signal, fuel,
steam, water, heat), and only like connects to like. Clicking a node puts its data sheet
below the palette —
control valve and friction pairing, engine map, converter circuits, motor data; axle count
and adhesive mass sit on the wheelset block — together with the live bake findings:
the diagram is stored in the vehicle file (graph) and baked into the runtime fields
(traction, brake, safety, doors, …) on save and on load, and every error or
warning of that bake is listed, a click selecting the offending block. A vehicle file
without a diagram opens with one synthesised from its spec. The palette reference, the
wire rules and the preset format: modding guide.
Models are glTF, and the glTF’s own features are used. Levels of detail and moving parts are found in the file; the binding is stored in the vehicle RON, so nothing has to be prepared in Blender — but a prepared file needs no clicking:
| In Blender | Result |
|---|---|
Object name body_LOD0, body_LOD1, … |
“Read from node names” fills the LOD table; the distances stay editable |
Object name door_left, pant_front, sw_throttle, gauge_speed, lamp_left, wheel_1 |
suggested function plus a sensible motion |
Custom property ts_function (plus ts_motion = rotate/translate/visibility/emissive, ts_axis = "0 0 1", ts_amount) |
exported into glTF extras and beats the name |
Node name ending in _NIGHT (lit windows, glowing signs) |
switched on at dusk in every model, no binding needed |
The simulator uses the same data: a vehicle with a model gets its glTF instead of the
placeholder body, the level of detail follows the camera distance, and the bound parts follow
the simulation state (pantograph, gauges, switches, lamps). Models live in the mod and are
addressed as mods://<mod>/assets/<file> — the same string in the editor and in the game.
Cab, displays and sounds are edited in the same program. The cab panel sets the eye point
and binds glTF nodes to cab controls — each with the gesture that suits it, so a lever is
dragged, a button pressed and a rotary switch stepped with the wheel. Instruments are bound the
same way: gauge: pointers, lamp: indicators and digit: seven-segment counters. A screen is
a display rendered to texture, written either as a declarative widget list in RON, as a Lua
display(ctx) hook with menus and softkeys, or as an HTML/CSS/JS page under displays/ —
parsed, laid out and scripted in-engine by html-display, with no browser embedded. The sound
table maps quantities (speed, traction, air, roughness, rain, control clicks) to the mod’s own
samples, normally as crossfaded layers — three loops over overlapping speed windows rather
than one stretched by its playback rate. A ▶ per entry plays it through the editor’s own
output device with a slider for every quantity it depends on, so the crossfade can be dragged
through by hand instead of guessed at from a sparkline.
Details: modding guide.