openOMSI GitHub Discord
Content formats

Docs / Reference / Content formats

Vehicles (.bus/.ovh)

7 min readEdit this pagedocs/FORMATS.md

On this page
  1. Vehicle variables
  2. Collisions
  3. Engine callbacks
  4. The vehicle list and coupled parts
  5. Passenger cabin
  6. Doors and stops
  7. Mirrors and shadows
  8. Depot files (.hof)

A vehicle is a folder under Vehicles\ with one or more .bus (player-drivable) or .ovh (other vehicles) files, plus model\, script\, sound\ and texture\.

[friendlyname]
SD200

[model]
model\model.cfg

[script]
script\scriptlist.cfg

[sound]
sound\sound.cfg

[passengercabin]
model\passengercabin.cfg

[newachse]
...
Keyword What it is
[type] 2 rail vehicle, 3 aircraft (street traffic only uses type 0)
[friendlyname], [friendlyname_inv] Name in the vehicle list
[ai_veh_type], [rowdy_factor], [ai_brakeperformance], [ai_deltaheight] AI behaviour
[coupling_back], [coupling_front], [couple_back], [couple_front], [coupling_front_character] Coupling
[control_cable_back], [control_cable_front] Control cables between cars
[boogies], [sinus], [rail_body_osc], [contact_shoe] Rail running gear
[add_camera_driver], [add_camera_pax], [set_camera_std], [set_camera_outside_center] Cameras
[view_schedule], [view_ticketselling] Camera views
[add_camera_reflexion], [add_camera_reflexion_2] Mirror cameras
[schwerpunkt], [rollwiderstand], [rot_pnt_long], [inv_min_turnradius] Physics
[newachse] + [achse_long], [achse_maxwidth], [achse_minwidth], [achse_raddurchmesser], [achse_feder], [achse_maxforce], [achse_daempfer], [achse_antrieb], [achse_inertia_inv] An axle
[number], [registration_automatic], [registration_list], [registration_free] Fleet number and plates
[kmcounter_init] Start odometer
[model], [script], [sound], [paths], [passengercabin] The vehicle's other files
[spotlight] Headlight beam (below)

openOMSI adds [add_camera_reflexion_static], [spotlight_2], [spotlight_cookie], [suspension], [vehicle_script], the [trolley_*] blocks and the [rail_*] blocks. See Modding overview, Suspension types, Trolleybuses and Trams, metros and trains.

Vehicle variables#

Built-in variables are listed in program\varlist_roadvehicle.txt, callbacks in program\callbacklist_*.txt. Generated per axle, for {n}_{L|R}: Wheel_Rotation_, Wheel_RotationSpeed_, Axle_Steering_, Axle_Suspension_, Axle_Springfactor_, Axle_Brakeforce_, Axle_SurfaceID_. Also PAX_Entry{n}_Open/_Req, PAX_Exit{n}_... and Debug_0..5.

  • Wheel_Rotation_* and Axle_Steering_* are radians (the stock model.cfg multiplies a wheel by 180/π). Positive steering is to the right.
  • n_Wheel is rpm (antrieb.osc computes power as M_Wheel · n_Wheel · π / 30000 kW).
  • wearlifespan is set by the engine and must be 1. At 0 every random part lifetime is 0, and the SD200's rear door reopens by itself for ever.
  • Weather_Temperature is known before a vehicle's {init} runs: engine and heater scripts start from it.
  • PrecipRate is signed. rain.osc adds Timegap * PrecipRate to the window wetness variables, so a positive rate soaks the glass and a negative one dries it. wiper.osc clears the wiped area as the blade sweeps.
  • DirtRate is how fast the windscreen soils now (dirt.osc adds it into Dirt_Wiped); Dirt_Norm is how dirty the body is. Both are the [alphascale] of a dirt overlay. veh_wash clears them.

openOMSI adds PAX_Entry8..15, PAX_Exit8..15 and PAX_Entry{n}_Busy/PAX_Exit{n}_Busy (see Modding overview).

Collisions#

The engine fires {trigger:collision} on the vehicle after a crash. coll_energy is that crash's energy in kJ and reads the same however often the script asks. coll_pos_* is where the bodies met (vehicle frame, metres), down at the bumpers. The SD200/SD202/NL202 scripts add the energy to the engine's account only for a hit behind coll_pos_y < -4.70 and below coll_pos_z < 1.10.

Engine callbacks#

  • (M.V.GetHeightAbovePoint) takes x y z in the vehicle frame and returns how high that point stands over the first face a ray meets coming down from 3 m above it: -3 at least, 1000 with nothing there. The NL/NG lift and the Urbino's kneeling sensor use it.
  • (M.V.GetHumanCountOnPathLink) takes a paths.cfg link index and returns how many passengers stand on it (the NL/NG fare gate swings out of their way).
  • GetTTTerminusIndex spells "TT" with two T's.

The vehicle list and coupled parts#

OMSI offers the .bus/.ovh files that have a [friendlyname]. The GN92's rear section, most _KI AI variants and the AI cars have none.

  • A rear section has [coupling_front] and usually [scriptshare]: no scripts of its own, the front's variables drive it. It is named by the front's [couple_back] file reversed, resolved from the front's folder in whichever content root has it.
  • With [scriptshare] the rear section's \S:n materials are the front's script textures, and its [texttexture]s read the front's string variables.
  • Trains\*.zug lists the cars of a train: pairs of lines, a vehicle file (or pool group name) and a reverse flag (1 = coupled rear end forward). The first entry leads.

openOMSI also keeps a coupled part with a copied [friendlyname] out of the list, spawns the front section when a rear one is asked for, and refuses a rear section nothing couples. A vehicle folder without any vehicle file (a repaint for a bus that is not installed) is not offered.

Articulation. The joint is reported to the front section's scripts as articulation_<n>_alpha (about the vertical axis, clockwise degrees) and articulation_<n>_beta (about the transverse axis); n is the coupled part's position in the train. The stock jackknife protection brakes over 47° while reversing.

The bellows are [smoothskin] meshes whose [setbone] ids are the bone mesh's position in the model's first LOD; the modelled pose is the straight one.

Passenger cabin#

passengercabin.cfg (named by [passengercabin]):

Keyword What it is
[entry] n, [exit] n A door, by path point; {noticketsale} and {withbutton} lines mark it
[linkToNextVeh], [linkToPrevVeh] Path points that join two coupled cabins
[stamper] Ticket validator
[ticket_sale], [ticket_sale_money_point], [ticket_sale_change_point] (and _2) Cash desk
[passpos] x y z seat-height rot A place
[drivpos] The driver's place
[illumination_interior] Interior lamps
  • [passpos] x, y, z is the hip when the seat height is above zero, the foot when it is zero (a standing place). openOMSI accepts one or two script variable names on the lines after it (see Modding overview).
  • {noticketsale}: passengers using that door walk straight to a seat. {noticketsale} and {withbutton} are lines of their own that mark the entry read last, wherever they stand.
  • Coupled sections: the rear section's seats and exits are numbered after the front's. OMSI joins two cabins only where both give link points. openOMSI also crosses a bus joint without them, between the ends of the aisles, but not a trailer on a lorry's hitch ([coupling_front_character] type 0): such a trailer is a cabin of its own.

Walking paths (paths.cfg, named by [paths]): [pathpnt] x y z (vehicle frame) with [next_roomheight] and [next_stepsound], [pathlink] a b, [pathlink_oneway] a b, [stepsoundpack]. Passengers walk entry → cash desk → seat, and seat → nearest exit.

Doors and stops#

Entries and exits are numbered in file order; that number is how engine and script talk.

  1. The engine writes PAX_Entry<i>_Req while someone at the kerb wants in through entry i, and PAX_Exit<i>_Req while a rider wants out through exit i.
  2. The script answers with PAX_Entry<i>_Open / PAX_Exit<i>_Open. Only then does anyone move.
  3. Writes to an index the cabin does not declare are ignored, so one script serves the two-door and three-door variants of a bus.
  4. Pressing an outside opener fires the trigger door_aussenoeffner.

The AI door scripts keep the rear door open only while a PAX_Exit<i>_Req stands, so every rider on the way out keeps asking.

AI_Scheduled_AtStation is a handshake with an AI vehicle's script:

  1. The engine writes 1 at a stop; the script opens the doors.
  2. The engine writes -1 when the bus is to leave; the script closes the doors, releases the stop brake and writes 0 back.
  3. The bus pulls away once it reads the 0.

Mirrors and shadows#

  • [add_camera_reflexion] x y z dist fov yaw pitch (_2 adds one number) is a mirror camera. Yaw is clockwise from forward (201 = back, turned towards the flank). Camera N draws into the texture reflexionN.bmp on the mirror mesh, whose UVs are already mirrored. A rear section's cameras are numbered after the front's.
  • An [isshadow] mesh (D_schatten.o3d with Shadow.tga) is the shadow blob at model z = 0. A vehicle's z = 0 is where its tyres touch with the springs unloaded, so at rest it is 10-16 cm under the road. openOMSI lays the blob on the plane the wheels stand on and leaves it out of the sun shadow map.

Depot files (.hof)#

A .hof in the vehicle folder holds a map's destinations and stops for the displays and IBIS.

Keyword What it is
[name] Depot name ($.yard in scripts)
[global_strings] Global strings; string 0 is the announcement folder
[servicetrip] Out-of-service destination
[stringcount_terminus], [stringcount_busstop] Strings per record
[addterminus], [addterminus_allexit], [addterminus_list] Destination: code, ident, then the strings
[addbusstop], [addbusstop_list] Stop
[infosystem_trip], [infosystem_busstop_list] Routes for the IBIS

Depot callbacks: GetRouteIndex(code) (code = line × 100 + route), GetRouteTerminusIndex, GetTerminusCode, GetTerminusIndex, GetTerminusString(idx, n), GetBusstopCount, GetRouteBusstopIdent, GetBusstopIndex("ident"), GetBusstopString(idx, n), GetDepotStringGlobal(n).

Called with index -1 (what a lookup answers for an unknown code) they return "" or -1, never entry 0. openOMSI adds GetRadioName and GetRadioSong.

  • AI buses get their destination the original way: string SetLineTo + AI_target_index and the ai_scheduled_settarget trigger. This also happens when the depot file has no row for the trip's terminus (AI_target_index then stays as it was).
  • When the bus folder lacks the depot file the map's ailists.cfg wants, openOMSI takes it from another vehicle folder. A bus of a plain [aigroup_2] pool takes the map's depot of its folder, else the folder's first.
  • The FloFix "Atron" IBIS starts in a PIN mode (IBIS_mode 10): type the PIN constant of its constfile and confirm before the other keys work.

Announcements. IBIS-2 builds ..\..\Announcements\<folder>\<stop ident>[_#terminus].wav (relative to the sound folder; <folder> is the hof's global string 0) and fires (T.F.ev_IBIS_Ansagen), a trigger that takes the file from the string stack. A sound.cfg [sound] N entry (a number instead of a file) listening to that trigger plays it.

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

↑↓ to move↵ to open