Skip to content

New levels

The port can play levels that are not on the disc: new geometry, rooms, collision, navigation, characters on routes, targets, a mission with its own script, text and sounds. This folder is the home of that work. It explains what exists, why it is built the way it is, and where it is going.

Page What it holds
knowledge-base.md What we learned: the decisions and why, the dead ends, every non-obvious rule of the engine, the open questions, and how the work is tested. Read this before changing anything.
architecture.md Where this is going: level mods as recipes that the port builds from the player's own disc, the data-driven mission script, and the level editor.
mission-script.md Mission logic in Lua: how a level declares its mission.lua, what the scene needs, the mission library (obm.mission.define: targets, exits, objectives, events), the engine's limits and an example.
recipe-format.md The level mod layout and level.json, the recipe a modder writes; the base presets; the example and how to build it.
front-end-scenes.md How a custom level gets its own briefing, debriefing and newspaper: the level table row, menu pictures, text, the pause map, and what is still the base mission's.
blender-addon.md 3D Level Editor: Blender 4.2+ Extension (tools/port/blender_addon/) for editing all 14 PS2 campaign missions (including building shells & stock guard routes), building custom multi-story levels, and porting external 3D maps (e.g. de_dust2).
Building a new scene How the current builder makes a level, step by step, with the spec format, the Blender conventions and the example missions.
Scene archives The scene archive: its members, load order and cross-references, and what a new scene needs. One page per member type follows from it.

The state of things

Built and played so far, each step checked in the game:

  1. Formats. Every member of a scene archive (SCENES/<mission>/<scene>.ZIP) is documented, and the Python modules in tools/port/scene/ parse and rewrite all 71 scenes on the disc byte for byte (extract the corpus first, then run python3 -I tools/port/scene/roundtrip.py --corpus build/scene-corpus).
  2. An empty room that 47 walks in (specs/new_room.json, hideout base).
  3. A mission: two rooms joined by a doorway, guards and a worker on routes, two targets, the stock exit and completion screen (specs/two_rooms.json, A Vintage Year base).
  4. Our mission logic: three targets, our objectives, target names and briefing text, and two sounds of ours (specs/contract.json). First a level script compiled with the script SDK; since phase B a Lua mission (levels/contract/mission.lua) that the port runs, with no compiled module (mission-script.md). The compiled route was retired on 24 November 2026, when the port began running the scene scripts as native code and stopped loading script modules from mods.
  5. Levels modelled in Blender: a .glb with rooms, portals, stairs to a gallery, ten textures, props, actors and routes, and navigation generated from walkable meshes (specs/showcase.json, tools/port/scene/gltf_level.py).
  6. A level as a recipe (phase A): The Gallery Contract, a mod holding only our content (model, level.json, mission.lua, photos, sounds, map, newspaper art; tools/port/scene/examples/gallery_contract/), built from the player's disc by tools/port/scene/build_level.py into the level and its own briefing, debriefing and newspaper scenes, played from Quick Play through to the newspaper.
  7. Blender Level Editor Extension (tools/port/blender_addon/, blender-addon.md): Blender 4.2+ Extension supporting all 14 PS2 campaign missions (M00–M13 + HIDEOUT), direct PS2 building-shell/door/prop/guard/patrol-route editing and safe per-instance deletion, custom multi-story levels with multi-graph Pathfinder4 navmeshes, external 3D map porting with Recast-style multi-layer navmesh generation, stealth sandbox entities (disguises, CCTV, containers, climbables, devices, accidents, elevators), per-room security zones, Mission Studio, live GPU stealth preview, and 1-click Build & Playtest.

Built levels go to a mod folder (mod.json plus raw/SCENES/...). The port's disc overlay serves files the disc lacks, so the level shows in the launcher's Quick Play list.

Tools

Tool Purpose
tools/port/scene/<type>.py Reader and writer for one scene member: gms, buf, prp (+ prp_schema), oct, rooms, sgp, prm, tex, anm, snd, loc, small
tools/port/scene/roundtrip.py Rewrites every scene on the disc with every module and reports N/M identical
tools/port/scene/build_scene.py Builds a level mod from a JSON spec and the player's ISO
tools/port/scene/gltf_level.py, glb.py, navmesh.py The Blender path: a .glb plus a short spec
tools/port/scene/mission.py, mission_script.py, synth.py Mission text and sounds; mission_script.py prepares the scene for a Lua mission and puts the file in the mod
tools/port/scene/levels/contract/mission.lua The contract spec's Lua mission
tools/port/scene/make_showcase_glb.py Writes the showcase level's .glb (our own content)
tools/port/scene/build_level.py, frontend.py, paint.py, bases/ The recipe builder: a level mod's recipes into the level and its front-end scenes
tools/port/scene/examples/gallery_contract/make_recipe.py Writes the example recipe mod (our model, photos, sounds, map, newspaper art)
Extracting scene archives Copy scene members and the loose sound bank from a disc image into a local corpus

Playing a built level

A recipe mod:

python -I tools/port/scene/examples/gallery_contract/make_recipe.py <recipe dir>
python -I tools/port/scene/build_level.py <recipe dir> --out <mods>/gallery_contract
OPENBLOOD_MODS_DIR=<mods> OPENBLOOD_ONLY_MODS=1 OPENBLOOD_ENABLE_MOD=openblood.gallery_contract openbloodmoney

The quick start of a level with a scene_code opens its briefing first. The specs:

python -I tools/port/scene/gltf_level.py tools/port/scene/specs/showcase.json --out <mods>/showcase
python -I tools/port/scene/build_scene.py tools/port/scene/specs/contract.json --out <mods>/contract
OPENBLOOD_MODS_DIR=<mods> OPENBLOOD_ONLY_MODS=1 OPENBLOOD_ENABLE_MOD=openblood.showcase,openblood.contract openbloodmoney

Start the port without a disc argument, so the launcher opens: a disc path on the command line skips it. Then pick the level at the end of MISSIONS. Start missions through the launcher; a DefaultScene= start crashes after the escape (see the knowledge base).