openOMSI GitHub Discord

Docs / Making content

Modding beyond OMSI 2

The limits openOMSI lifts, and the keywords that go with them.

14 min readEdit this pagedocs/MODDING.md

On this page
  1. Interior lights: more than four per mesh
  2. Textures of any resolution
  3. PBR materials
  4. Lights
  5. Screens: static cameras
  6. Models
  7. Passenger doors: sixteen entries and sixteen exits
  8. Passenger places switched by the script
  9. Ticket validators: one by every door
  10. Scripts and plugins
  11. Radio: a map's stations and a bus's display
  12. Weather of a real place
  13. Trolleybuses: poles, drive and a wire
  14. What stays as in OMSI 2

openOMSI reads OMSI 2 content as it is: a bus, a map or an object made for OMSI 2 works without changes. It also lifts limits OMSI 2 put on modders. Everything on this page is an addition. A file that uses it still loads in OMSI 2, which ignores what it does not know.

Interior lights: more than four per mesh#

OMSI 2 lights a mesh with at most four [interiorlight] lamps, the four numbers of its [illumination_interior]. openOMSI takes as many as you list, up to 63 per mesh. Write the extra lamp numbers on the lines right after the first four; a blank line ends the list:

OMSI file
[mesh]
saloon.o3d

[illumination_interior]
0
1
2
3
4
5
6
7

[matl]
...

OMSI 2 reads the first four and skips the rest. A model may declare any number of [interiorlight] lamps, and each mesh names the ones that light it. The same goes for [illumination_interior] in passengercabin.cfg.

Textures of any resolution#

  • Textures up to 16384 × 16384 pixels load. Where the graphics card cannot take that size, the texture is halved until it fits.
  • Every picture format of today's tools is read, by its content whatever its name says:
    • DDS with the DX10 header (BC4, BC5, BC6H, BC7 as texconv, Substance and the engines write them; R10G10B10A2, R11G11B10 float, R9G9B9E5, 16- and 32-bit float and 16-bit channels, B5G6R5 / B5G5R5A1 / B4G4R4A4, R8G8, R8, A8; DX10 cube maps), ATI1 / ATI2 / BC4U / BC5U (the z of a two-channel normal map is made from x and y), RXGB, Direct3D's float formats, and OMSI's DXT1-5 and uncompressed DDS;
    • KTX 1 and KTX 2 (not supercompressed) with RGBA8, BC1-BC7, ETC1, ETC2 / EAC and ASTC;
    • PNG (also 16 bits per channel), JPEG (also progressive and CMYK), BMP, TGA, WebP, GIF, TIFF, QOI, OpenEXR, Radiance HDR, ICO, PNM and farbfeld.
  • A texture named in a model (bus.bmp) is found as bus.dds first, then under its own name, then as .bmp, .tga, .jpg, .png, .jpeg, .webp, .tif, .tiff, .gif, .ktx2, .ktx, .qoi, .hdr, .exr and .pnm.
  • There is no 2 GB address-space limit: openOMSI is a 64-bit program.
  • A texture keeps its full resolution within 150 m of the camera, so a bus's own 4K textures always stay sharp. Far scenery gives up detail only when the texture budget (OMSI_TEXTURE_MEMORY, in MB) or the video memory (video_memory in the settings, all the game holds on the card) runs out, as with OMSI's [texmemlimit].
  • [scripttexture], [htmltexture] and [texttexture] / [texttexture_enh] can be any size the card takes.

PBR materials#

Normal, roughness, metalness and occlusion maps beside a texture, up to 4096 × 4096. See PBR materials.

Lights#

  • Each 25 m square of the world draws up to 32 point and spot lights at once (the nearest first), so depots, stations and lit interiors keep their lamps.

  • Interior lamps of vehicles are drawn per pixel, with no count limit per vehicle.

  • [spotlight_2] in the model.cfg is a spotlight of its own: low beam, main beam, fog lamps or a lamp over a door can light the road at the same time, each switched by its variable, beside the one [spotlight] that Spot_Select picks.

    It takes the twelve numbers of a [spotlight] (position, direction, red, green, blue, range, inner and outer cone angle), then the variable (0 off, 1 full, in between dimmed; a number is a constant) and a flag:

    OMSI file
    [spotlight_2]
    0.95
    5.95
    0.652
    0
    1
    -0.3
    255
    255
    233
    200
    30
    80
    lights_fern
    0

    With the flag 0 (or left out) the lamp is where it says and a twin of it stands on the other side of the vehicle, mirrored across its axis (x and the x of the direction turned round): put the position on one headlamp. With 1 there is just the one lamp, for a light over a door or a cornering lamp.

    A pair is as bright as a [spotlight] of the same colour, shared between its two lamps. The position is used as written: unlike a [spotlight]'s, it is not moved onto the vehicle's front. A rear section's model may have its own; their variables are the bus's.

  • [spotlight_cookie] in the model.cfg is a lamp whose beam is a picture: what it would show on a wall in front of it, its brightness and colour every way the lamp shines.

    One value a line: position (x, y, z), direction (x, y, z), red, green, blue, range, the angle the picture covers across and the one up and down (degrees), the picture, the switching variable; then, if you want them, the fade time in seconds, a variable that turns the lamp to the right (degrees) and one that turns it up (degrees):

    OMSI file
    [spotlight_cookie]
    0.9
    5.85
    0.75
    0
    1
    -0.04
    255
    250
    235
    80
    70
    30
    lowbeam_right.png
    lights_main
    0.15
    cornering_yaw

    The picture's right is the lamp's right as seen from behind it. White is as bright as a headlamp's beam at its strongest, black is no light. The enhanced graphics draw up to eight different pictures at once; the classic graphics, and a lamp whose picture is missing, light a plain cone round the picture's field instead.

  • With shadows on, the player's headlamps cast shadows too (Enhanced): the lamps on the front that light the road share one shadow map, taken from between them.

Screens: static cameras#

[add_camera_reflexion_static] in the .bus adds a camera for a screen - a CCTV monitor of the doors, a reversing camera - to the mirrors. It takes the numbers of an [add_camera_reflexion] (x, y, z, distance, field of view, yaw, pitch) and counts with the mirrors: camera N draws into the texture reflexionN.bmp.

Unlike a mirror's, its picture does not move with the driver's head: it looks along its yaw (degrees clockwise from the vehicle's forward) and pitch (up), as a driver camera does. Its picture is what it sees, not a mirror image, so map the screen's texture the right way round.

The reflection cameras of an articulated bus's rear sections count on from those of the section in front: with mirrors 0 to 3 in the front section's .bus, a camera in the rear section's .bus is number 4, and a screen in the cab showing reflexion4.bmp shows what that camera sees from the rear section.

Models#

  • A [mesh] (and every other place OMSI reads a mesh) may name a glTF / GLB, FBX or OBJ file besides .o3d and .x; the format is told by the file's content. The model is read in the frame the modelling tool shows it in - exported from Blender with the vehicle's front along +Y, as for an .o3d - in metres (FBX in any unit), with every node's transform applied:
    • materials keep their base colour and their colour texture. A texture beside the model (or in a texture folder beside it) is found there, one packed into a .glb or .fbx is read from the file; the material is named after the picture's file name, so a [matl] <picture> <n> of the model's .cfg acts on it as on an .o3d's material;
    • skins (bone names and weights) and blend shapes come along; an FBX may be ASCII or binary of any version, an OBJ has its .mtl (Kd, d, map_Kd) and any polygons;
    • cargo run -p omsi-o3d --example mesh_info <file> shows what openOMSI reads of a model.
  • [led_glow_effect] after a [matl] (a number from 0 to 1) says how much an LED panel's dots glow in the enhanced picture: 1 the full LED glow setting, 0.5 half of it, 0 not at all (the slot is no LED panel). Without it openOMSI guesses: a slot with a \S:n script mask and a white light map is taken for an LED panel. See file formats.
  • A mesh may carry several visibility conditions - no script needed for a mesh shown by two variables at once:
    • [visible_range] with a variable, the lowest and the highest value shows the mesh while the variable is between them (both included): [visible_range] gear 1 4;
    • once a mesh has a [visible_range], a ! or a ||, every condition of a group must hold; plain [visible] blocks alone keep OMSI 2's rule (the last one counts), so a mesh shown by two variables at once writes one of them as a range round its value:
      OMSI file
      [visible_range]
      door_open
      0.5
      1.5
      
      [visible]
      lights_on
      1
    • a ! after the variable's name turns a condition round: door_open ! then 1 shows the mesh while the door is not open (with [visible_range] outside the range);
    • a line || between two blocks starts another group of conditions: the mesh shows when all of the conditions before it hold, or all of those after it, as || reads in a script. A variable the vehicle does not have reads 0, as with OMSI 2's single [visible].
  • .o3d files with 32-bit indices (the long-index flag) are drawn with their full vertex and face count; everything is drawn with 32-bit indices.
  • There is no limit on the number of meshes, materials, [matl_change] items, [CTC] entries, cameras, doors, passenger places, wheels or axles.

Passenger doors: sixteen entries and sixteen exits#

OMSI 2 has the door variables of eight [entry] and eight [exit] paths a vehicle has (PAX_Entry0_Open to PAX_Entry7_Open, the same with _Req and for PAX_Exit). openOMSI has them for sixteen of each: PAX_Entry8_Open ... PAX_Entry15_Open, PAX_Entry8_Req ... and the same for the exits.

An entry or exit past the eighth is a door of its own once the script sets its _Open variable (or lists it in a varlist); then its passengers wait for that variable and ask for the door through its own _Req. Without it, it opens with the eighth, as in OMSI 2.

Its passengers' requests then go through the eighth's _Req in openOMSI, while OMSI 2 loses them (its request arrays have eight slots).

openOMSI also tells the script who stands in a doorway: PAX_Entry<n>_Busy and PAX_Exit<n>_Busy (n 0 to 15) are 1 while somebody is on the door's threshold or in the opening between it and the step outside - what a door's light barrier sees - and 0 otherwise;

the people queueing outside a shut door, in the aisle or on the deck above do not count. A door script can keep a door open or open it again while its _Busy is set.

Like the _Req, they are written before the scripts run every frame and cleared after them; a door past the eighth without variables of its own reports through the eighth's. OMSI 2 does not have them.

Passenger places switched by the script#

OMSI 2's [passpos] places are all there all the time. In openOMSI a [passpos] may name a script variable on the line straight after its five values: while that variable is 0 no passenger takes the place (whoever sits there already stays until they get off), so a bus can have two seating layouts and switch between them with a setvar.

A second name on the line after that is a variable the engine sets to 1 while somebody is on the place and to 0 while nobody is - a tip-up seat can fold down for the person on it - without the seat numbers GetHumanCountOnSeat needs:

OMSI file
[passpos]
0.94
0.04
0.92
0.43
0
layout_transverse
seat_12_taken

Both are ordinary variables of the bus's varlists. A place without the lines, or with a name the scripts do not have, is always there; a blank line or the next block ends the list, and OMSI 2 passes over the lines.

Ticket validators: one by every door#

OMSI 2 uses one [stamper] of a passengercabin.cfg, the last one written. openOMSI keeps every [stamper] of every section, and a passenger with a ticket to stamp uses the one nearest the door they came in by. Write one [stamper] block per validator (path point, then x, y, z of the device, as usual); OMSI 2 still takes the last of them.

The validators count from 0 in the order the cabin file writes them. A stamp fires the sound trigger ev_Stamper (as in OMSI 2) and also ev_StamperN for validator N, so each one can have its own placed sound, and the script triggers PAX_Stamper_Used and PAX_StamperN_Used (for animations or ticket systems).

OMSI 2 fires only ev_Stamper; a bus that gives each validator its own sound can mute the ev_Stamper one by a variable the PAX_Stamper_Used trigger sets.

Scripts and plugins#

  • Script variables and string variables have no count limit.
  • Lua plugins can read and write script variables, fire triggers and react to game events: see Plugins.
  • (M.V.GetRadioName) and (M.V.GetRadioSong) put what the bus radio plays on the string stack: the station's name (as the stream gives it in icy-name, else as the station list names it) and the title it gives (StreamTitle); both empty while the radio is off or the station says nothing. Not in OMSI 2: check for an empty string.
  • The developer tools (Ctrl+Shift+D, see the user guide) show and hold the variables, draw the paths, places, boxes, axles, lights, mirrors and views over the bus, and read its paths.cfg, [passengercabin], sound.cfg, .bus, model.cfg and constfiles again while it drives.

Radio: a map's stations and a bus's display#

What a player sees and hears is in the user guide; here is what a map or a bus can add. Omsi.exe reads none of it, so a map or bus made for both games loses nothing in OMSI 2.

A map's own stations. radio.cfg beside the map's global.cfg, written like the player's (name = address a line). Its stations come first on the station buttons while the map is driven, the player's follow (one with the same address as a map's is left out). Its volume line is not read: loudness stays the player's business. The file is read again when another map is loaded.

Frequencies. Behind the address may stand the frequencies the station is on, for radios that show one: | 94.6 is the station's frequency everywhere, | 94.6 @ x, y the one near that place of the map. A station may have as many as it has transmitters along the route:

# name = address | frequency @ x, y | ...
Radiozurnal = https://rozhlas.stream/radiozurnal.mp3 | 94.6 @ 25500, 20000 | 90.9 @ 2307, -717
Regional    = https://example.org/regional.mp3 | 97.9

x, y are the game's metres: the tile's column and row times 300 m plus the place within the tile.

The easiest way to get them is the log: spawned at entry point 38 "Chlum,hl.sil." (12810.6, 3735.5, 60.3) when a bus is put on the map, or an entry point's own numbers in global.cfg ([entrypoints]: the place in the tile, then the tile's index into [map]).

The place nearest to the bus decides which frequency is shown; there is no blending, so one place per town along the route is enough. A map's places are map positions, not coordinates on the globe: many maps shorten and bend their routes.

A bus's display. A radio script that wants the station and the song in its display declares the string variable Snd_Radio_Text (in a [stringvarnamelist] file of the bus) and shows it in a text texture: openOMSI writes the text there, ten characters, a longer text running through, while the radio plays.

The variables the radio itself sets are those of OMSI's radio plugins - Snd_Radio (1 while a cassette or the radio plays: the first station), or SndExt_Radio (the station button, 0 = off) with SndVol_Radio (the volume, 0..1, up to 2).

Dmitrij's "Magnitola" is served as it comes: while it shows its track, its magnitola_1 (frequency@station, @ the line break) gets the map's frequency for the place in its first line and the station and song in its second.

Weather of a real place#

A map can have live weather from Tomorrow.io: add an openomsi_weather.cfg beside its global.cfg. See weather areas for the format, the player's setup and the community config editor.

A map can also give its climate statistics in an openomsi_climate.cfg file.

The [temperature] section of the file should contain 12 monthly mean temperatures (January to December) in °C (one per line), and the optional (currently unused) [precipitation] section should have the same 12 values, but for the precipitation in millimetres. These values will be used as baseline for natural weather preset.

Trolleybuses: poles, drive and a wire#

OMSI 2 has no overhead wire of its own; its trolleybus add-ons ship a plugin DLL that reads the bus's place out of Omsi.exe and cannot run here. openOMSI simulates the wire itself, and a trolleybus add-on needs two things to use it:

  • in the vehicle's .bus, a [trolley_pole] for each pole (the hinge on the roof, the boom's length, spring force, mass, retriever and motor) and a drive: [trolley_rheostat] or [trolley_async]. A vehicle that keeps its own scripted drive just adds the poles: its driving torque then works on a wire and stops without one.

    A model with poles of its own says visible 0 and rotates them by the game's Trolley_Pole<k>_Elev and _Azim variables;

  • for a map, a trolley.txt beside its global.cfg (or in a mod's maps/<name>/ folder for a map that has none): the wire's spans with their sag, the sections and where they are dead, the insulators and the switches.

Every key and variable is in TROLLEYBUS.md; the map's masts and hangers stay the map's own objects.

What stays as in OMSI 2#

The following behave as in OMSI 2 so that existing content works unchanged:

  • the script stack (8 values) and registers (l0-l9, s0-s9);
  • one [spotlight] lit at a time per vehicle (the one Spot_Select picks; [spotlight_2], above, adds more);
  • 100 particles per emitter.

In a LAN session, other players see up to 7 doors, 15 wheels and 127 lamps of a vehicle.

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

↑↓ to move↵ to open