Assets and Models¶
A mod can replace the game's textures, sounds and disc files, and add .glb models and props.
Asset overrides¶
Files in an active mod replace game assets and add new ones. Paths are relative to the folder that holds mod.json, and use /. When several active mods have the same path, the one lowest in the load order wins; when none has it, the game uses the disc.
| Path in the mod | What it replaces or provides |
|---|---|
assets/textures/<scene>/<texture id>.png |
A texture of one scene, by its texture id in decimal. <scene> is the scene file's base name in lower case, such as m05_main. |
assets/textures/hash/<hash>.png |
A texture in any scene, by its content hash as 8 lower-case hex digits. The scene path is tried first. |
assets/sounds/<scene>/<offset>.wav |
A sound of one scene, by the offset of its wave header as 6 lower-case hex digits; <scene> as for textures |
assets/sounds/global/<offset>.wav |
The same sound in every scene, tried after the scene path |
raw/<disc path> |
A whole disc file, read by the game in place of the file on the disc. <disc path> is the path the game opens, without the device prefix and the ;1 version, with / separators. |
| any other path | Files the API reads by path: .wav for obm.audio and obm.dialogue, .png for obm.hud.load_image, .glb for obm.models, obm.props and obm.projectiles, .json for obm.level.load_json, .spv and .msl for obm.shader.load_custom. The examples keep these under assets/ and levels/. |
A raw/ file whose disc path the disc does not have adds that file to the disc: the port's CD layer (port/engine/system/_sdl/cdreadsdl.cpp) gives it virtual sectors above every real one, so the code that reads files by sector, such as the scene archive mount (ZSysFile::AddBig, FsZip_t), reads it like a disc file. This is how a mod adds a new scene: it ships raw/SCENES/<DIR>/<NAME>.ZIP and the .WAV/.WHD beside it under their 8.3 disc names (raw/SCENES/NEWROOM/NEWROOM_.ZIP for the scene NewRoom/NewRoom_main), and a levels entry whose base_scene names the scene. A raw/ file never replaces a disc file through this path; for files the disc has, only the name-based reads above use it. Building a scene builds such a mod.
Texture ids and hashes can be found with the texture pack dump described in textures.md. Paths given to the API go through the same lookup: a mod can read files of any active mod, and a later mod's file with the same path is the one used.
Models¶
The port reads binary glTF 2.0 (.glb) files with POSITION, NORMAL, TEXCOORD_0, COLOR_0 and indices of 8, 16 or 32 bits, PNG images embedded in the file, and JOINTS_0/WEIGHTS_0 skinning. They are used three ways:
obm.models.replacedraws a.glbin place of the meshes of scene objects. Skinned.glbfiles can replace character meshes.obm.props.spawnplaces a.glbin the world as a prop, optionally solid: 47 cannot walk into its bounding box.obm.projectiles.spawnwith aglbfield draws the projectile with the model.
World units are centimetres and Y is up. 47 is about 175 units tall.
tools/port/export_model.py writes test models and checks files:
python3 tools/port/export_model.py generate-crate my_crate.glb --size 35 --textured
python3 tools/port/export_model.py generate-crate my_char.glb --textured --skinned
python3 tools/port/export_model.py inspect my_crate.glb
From Blender, export with File, Export, glTF 2.0, format glTF Binary.