openOMSI GitHub Discord

Docs / Routes and rail

Trolleybuses

The overhead wire, poles, switches and the gear of a vehicle.

28 min readEdit this pagedocs/TROLLEYBUS.md

OMSI 2 itself has no overhead wire. Its trolleybus add-ons carry a plugin DLL that reads the bus's place out of Omsi.exe's memory and moves fake poles over wires that are only meshes on a map;

none of that can run in openOMSI. openOMSI therefore has its own trolleybus simulation, built into the game and described by two small text formats, so that a map can carry a real overhead wire and a vehicle real poles and a real drive:

  • the wire of a map: trolley.txt beside its global.cfg (section "The wire" below);
  • the gear of a vehicle: [trolley_pole] and a drive in its .bus (section "The gear").

Everything is worked out from mechanics and electrics, with the numbers a real trolleybus has; the constants are in the vehicle's file, not in the game.

Real trolleybus add-ons for OMSI 2 carry no wire logic of their own; how they are read and run here is in TROLLEY_MODS.md. A map's wire splines are read as the wire when no trolley.txt is given, and a bus with cp_SHTANGALEV/cp_SHTANGAPRAV pole meshes gets poles without a [trolley_pole] block, unless its .bus says [trolley_none].

Chapters

1What it doesTwo wires a fixed distance apart, one of each polarity. A bus is powered only while one pole is on the positive and the other on the negative wire, an…8 min
2Switch displaysA map author can use a scripted scenery object as a switch display. Declare these numeric variables in the object's [varnamelist]; the engine supplies…1 min
3The wire: trolley.txtA map's trolley.txt sits in the folder of its global.cfg; another content root (a mod) may hold maps/<name>/trolley.txt for a map that has none, and O…3 min
4The gear: blocks of a vehicle's .busInside a block every line is key value ...; keys left out keep the default. [trolley_pole] one per pole side left left | right (or -1 | 1) pos -0.3 1.…6 min
5SoundsThe gear makes six sounds of its own, from noise and decaying tones (no files): A vehicle plays its own recordings of the poles as OMSI 2 buses do the…5 min
6KeysIn the cab R and T are the gearbox's: the poles answer the cab's own switch and Ctrl+R there. The game's auto-start (Shift+U) also puts the poles on t…1 min
7Checking it offscreenOMSI_TROLLEY_FILE=trolley.txt OMSI_TROLLEY_UP=1 OMSI_DEBUG_TROLLEY=1 OMSI_AUTOPILOT=40 \ openomsi --map maps/<map>/global.cfg --bus Vehicles/<bus>.bus…1 min
8LimitsOnly the player's bus has gear simulated; AI vehicles do not run on the wire. Crossings of two wires (an overhead crossing with insulated sections) ar…1 min
9The mouse's hand on a poleA click on the cab's pole switch (a plain OMSI 2 trolleybus: cp_SHTANGALEV, cp_SHTANGAPRAV or what its model calls it) takes that pole in hand. The ti…2 min

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open