# Rebuilding RPL4.RES `RPL4.RES` is Red Planet's resource file — every vehicle, map, model, damage zone, control mapping and audio stream the game loads. It is *compiled* from authored sources by `RPL4TOOL -b`, the original 1996 resource tool, which still builds in this tree as `Release\RPL4TOOL.exe` (see `BUILD.md`). Until now that pipeline did not work. `RPL4TOOL -b` aborted on the very first model, so `assets/RP411/RPL4.RES` could only be consumed, never regenerated. This folder makes it build again. ```powershell # rebuild exactly what RP411 ships (minus the maps, see below) powershell -ExecutionPolicy Bypass -File tools\resbuild\build-res.ps1 # ...plus the three vehicles that were cut after 4.10 powershell -ExecutionPolicy Bypass -File tools\resbuild\build-res.ps1 -RestoreCutVehicles ``` Output lands in `%TEMP%\rp412-resbuild\rpl4.res`. Inspect any resource file with `Release\RPL4TOOL.exe -l `; that listing is the acceptance test for anything built here. **The result is not yet a drop-in replacement for `assets/RP411/RPL4.RES`** — see *What is still missing*. ## Why it was broken `RPL4TOOL -b` died in `PlugStream_FindEntryAndWriteObjectID` while building `player.mod`'s audio stream, resolving `resource=Translocation01` from `AUDIO/PLYINT.SCP`. That name is defined in no file in `CONTENT/RP`. The first guess — that it needed the AWE32 soundbanks through `AudioCard::LoadSBK`, which the Win32 port stubbed to `return 1` — was wrong. Supplying the banks changes nothing, because nothing reads them at build time. The real answer is `L4AudioResourceManager::CreateStaticAudioStreamResource` (`MUNGA_L4/L4AUDRES.cpp`), which opens **`audio\static.scp`**. That file declares all 154 of RP's patch resources as plain text: ``` [PatchLevelOfDetail] bank_ID=2 patch_ID=29 name=Translocation01LOD1 ... [PatchResource] audio_level_of_detail=0.0, Translocation01LOD1 name=Translocation01 ``` Every model's audio script resolves its `resource=` names against those, so without `static.scp` the first model aborts and no `.res` is ever written. `CONTENT/RP/AUDIO` does not have it — but the sda4 developer drive does. No engine change was needed. The pipeline was missing content, not code. ## What the build tree is made of `build-res.ps1` assembles three sources, and never overwrites an authored file with a shipped one — archival content stays authoritative where it exists. | source | provides | |---|---| | `TeslaRel410\CONTENT\RP` | models, solids, gauge art, audio scripts, `RPL4.BLD` | | `recovered\` (this folder) | `STATIC.SCP`, `VTVINT.SCP`, `VTVEXT.SCP` | | `assets\RP411\` | `AUDIO1/2.RES` soundbanks, ~547 `VIDEO` files | The three recovered scripts came from `TeslaRel410\sda4\RPDAVE\AUDIO` (identical to `RPLIVE`) and are kept here because they are the keystone and are small. `VTVINT.SCP` and `VTVEXT.SCP` are `[include]`d by 27 vehicle audio scripts and are absent from `CONTENT/RP` as well. The `VIDEO` gap is mostly `.SKL` skeletons — `MAN.SKL`, `BAN.SKL`, `BUN.SKL`, `DUN.SKL` and their `S` variants. A model missing one logs `video\.skl is empty or missing!`, then ` has no Segments!`, and is **silently dropped from the build** — the tool does not fail, it just produces a resource file with fewer models. Always check the model count. ## What is still missing **Eleven maps have no source in any tree.** The build reports each one and carries on: | map | source | |---|---| | `wise`, `yip`, `pain`, `blade`, `lyzlane` | only in `sda4\RPDAVE\MAPS` (1996 dev state, older than retail) | | `otto`, `frstrm`, `burnt`, `brewers`, `headoff`, `headmf` | **nowhere** | `CONTENT/RP/MAPS` has the `.CAM` camera files and `SOLIDS` has the `.XST` existence boxes, but the `.MAP` files themselves are gone. So a build from here produces 45 GameModels and **zero maps**, against RP411's 9. Until those are recovered, this pipeline can rebuild vehicles but cannot replace the shipped resource file. ## The three cut vehicles `-RestoreCutVehicles` uncomments three lines in `RPL4.BLD` that were commented out after 4.10 shipped, with their model IDs left in place: ``` //Armadillo Class model=puck.mod /id:19 //model=dark.mod /id:56 <- dark puck //Experimental Vehicles //model=blktrn.mod /id:47 <- black tornado //model=blkspk.mod /id:48 <- black speck ``` All three build clean, taking the model count from 42 to 45 — exactly retail's count. Each gets its full resource set: GameModel, Model List, VideoModel, Subsystems, Segments, DamageZones, ControlsMappings and GaugeImage. Two caveats. `blktrn` has no audio script anywhere (`BLKTRN.SCP` is absent from every tree) and no gauge block in `L4GAUGE.CFG`, so its cockpit panel has no layout to select — `dark` and `blkspk` still have theirs. And nothing has been verified in-game; building is not the same as playable. See `docs/CONTROL-PRESETS.md` for what these vehicles carry and the preset tables they shipped with.