Level recipes¶
A level mod holds only the modder's own work: a model, pictures, sounds and a recipe
that says how to put them together with a mission from the player's disc. This page is
the recipe format as the reference builder (tools/port/scene/build_level.py) reads it.
architecture.md has the reasons; front-end-scenes.md
how the briefing, debriefing and newspaper are made; Building a scene
the build steps and the Blender conventions the model follows.
The mod folder¶
gallery_contract/
mod.json the manifest; one "levels" entry per level
levels/gallery_contract/
level.json the recipe
gallery_contract.glb the model (rooms, portals, geometry, textures, lights,
navigation, 47's start, actors, routes, object places)
photos/*.png target photos (any size; shown 79 x 85 in the briefing)
sounds/*.wav 16-bit PCM, mono or stereo, resampled to 22,050 Hz
map.png the pause map, north up, over the level's footprint
news/*.png the newspaper page and its pictures (optional)
debriefing/*.png materials for the debriefing's backdrop (optional)
mission.lua Lua mission logic, see "Mission logic"
Nothing in it comes from the disc. The example, The Gallery Contract, is written by
tools/port/scene/examples/gallery_contract/make_recipe.py: mod.json and level.json
are files in that folder, and the generator draws the model (the showcase level with a
third target, a sound emitter and an alarm speaker added), the three photos, the map, the
newspaper art and the two sounds.
python3 -I tools/port/scene/examples/gallery_contract/make_recipe.py build/gallery-recipe
python3 -I tools/port/scene/build_level.py build/gallery-recipe --out build/test-mods/gallery_contract
Run these commands from the repository root with the PAL ISO there, or pass its path to the builder with --iso. To check that the mod is visible to the launcher, run:
build/port/cmake/openbloodmoney --user-dir build/scratch/user --mods-dir build/test-mods \
--only-mods --enable-mod openblood.gallery_contract --list-missions
The output lists gallery_contract under Active mod levels.
--out receives what the port will later build into its level cache: raw/SCENES/<code>/…
(four scene archives with their .WAV/.WHD), levels/<id>/mission.lua and the sounds
the mission plays (levels/<id>/sounds/), mod.json with each level entry's "mission"
added, and build/<level id>/ with the reports (level.json, mission.json, build.log). Install that folder as a playable mod.
mod.json¶
The port reads mod.json before anything is built, so the level entry names the scenes:
| Key | Meaning |
|---|---|
id, title, briefing |
as for every custom level |
recipe |
the recipe, relative to the mod |
scene_code |
1 to 5 upper-case letters or digits: the level's row in the level table, and its scene folder (SCENES/<code>/) |
mission_slot |
must match the recipe’s base preset. The campaign slot it plays in (M01): loadout, statistics, the profile's level number |
base_scene |
<code>/<code>_main; the builder checks that it agrees with the recipe |
mission |
Written by the builder into the output manifest from the recipe’s mission.script |
level.json¶
| Key | Meaning |
|---|---|
format |
1 |
id, title |
the level id (as in mod.json) and the title the menus show (AllLevels/Interface/LevelNames/<code>) |
scene_code |
as in mod.json |
base |
a base preset, tools/port/scene/bases/<base>.json (M01, A Vintage Year) |
model |
the .glb, relative to the level folder |
ambient, light_scale, texture_format, max_texture_size, geom_control, start_from |
as in the glTF spec keys of new-scene.md |
actor_types |
what an actor_ empty's type names: template (a base preset template name), role, script ({"imports": {…}}, {"name", "imports"}, or a preset script name such as "target"), properties, route |
objects |
name, template (a preset name), properties; placed by object_<name> empties |
mission |
below |
map |
image (the pause map) and title (its name in the map list) |
news |
below |
debriefing |
backdrop: images for the debriefing backdrop's materials by role (wall, stone, floor, wood, barrel, plaster); the base preset lists the disc textures of each role |
mission¶
| Key | Meaning |
|---|---|
script |
the Lua mission, mission.lua (required, relative to the level folder) |
targets |
1 to 4 on the M01 preset, which supplies two target pictures and two spare graphics: actor (an actor's name in the model), photo, who, objective, detail, age, height, weight, hair; for the newspaper also short (Mr. Kane) and title (art dealer). Target n is objective n and picture <n>Picture |
exit_list, exit_objective |
the exits' list object (required by the recipe reader, unused by the Lua runtime), and the last objective's who, objective, detail |
briefing, location, hints, strings |
the briefing paragraphs, brief/detail/time, hints, any other LOC key |
sounds |
Name and source WAV. Emitters can specify a Sound template and fields. A sound without emitters is copied to levels/<id>/sounds/<name>.wav for the mission to play. An at marker must name an object placed in the model. |
news¶
| Key | Meaning |
|---|---|
page |
the newspaper page behind the text, drawn at 1280 x 1850; the stories print over the blank columns at x 70–315, 335–905 and 920–1165 |
pictures |
TargetPic (the headline photo), StoryPic, FillerPicA, FillerPicB |
mission_data |
the facts the headline story uses: city, date, hospital, location, location_prefix, police, police_article, time_of_murder, innocent(s), police_chief_comment, target1_picture_text (the photo's caption), target1_background (up to six paragraphs about target 1), and target1_name, target1_short, target1_short_article and target1_title, with the same four keys for target2 |
articles |
Story, FillerLongA, FillerLongB, FillerShortA: headline, byline, paragraphs, caption. The page layout prints a fixed number of lines: Story 3 paragraphs, FillerLongA 6, FillerLongB 4, FillerShortA 3; the builder says so when the count differs |
The builder derives the newspaper names from the first two targets. Only the first target has a background paragraph list.
A mission can provide extra_objectives between its target objectives and the exit. Each entry has type, who, objective and detail. The original disc uses R for required tasks, O for optional objectives and P for protection. These entries appear in both the mission and its front-end scenes. The mission script completes their numbered slots and controls when the exit becomes available. Targets, additional objectives and the exit share eight slots.
Set exit.objective in Lua to the resulting exit index. Its default is one past the last target, which would complete the first extra objective. Use complete_objective for tasks completed by mission logic.
See Patrol stop actions for waypoint properties.
Base presets¶
tools/port/scene/bases/M01.json holds everything that names the disc: the base scene
and its loose sound bank, the removal rules, 47's start groups, the level control and
escape sequence, the template names a recipe may use (guard_rifle, guard_smg,
worker, target_older, target_younger, target_agent, guard_quarters, exit,
exit_list, sound_emitter, map_group), preset scripts,
the spare briefing graphics, and the front-end scenes. Paths are references into the
player's disc, never its data.
Mission logic¶
The recipe names its Lua mission (mission.script, levels/<id>/mission.lua).
build_level.level_script hands it to the spec as {"lua": ...}, so mission.py passes
the scene to mission_script.py: the level control runs the shared
alllevels\levelcontrol, the mission file and the sounds it plays without an emitter go
to levels/<id>/ in the built mod, and the level entry in its mod.json gets
"mission". The port runs the file while the level is loaded
(Mission scripts). The recipe supplies the initial LOC entries. Lua can update objective text during play.
What the builder checks¶
mod.json's entry agrees with the recipe (id,scene_code,base_scene,mission_slot).- Every file the recipe names is inside the level folder and exists.
- The scene code is 1 to 5 upper-case letters or digits: the port cuts each scene's file
name to 8 characters (
DiscFileName), and up to 5 characters<code>_PREM… and<code>_POST… stay distinct. - The model's own checks (gltf_level.py): rooms, navigation, actors on the navigation.
- Article line counts match the newspaper's layout.
The builder requires format 1, checks the eight-objective limit, validates extra objective types (R, O or P), and requires a briefing picture slot for each target.