# Game Assets & Runtime Layout

A complete working copy of the shipped game lives under [`assets/RP411/`](../assets/RP411/).
Together with the executables built from source (see [BUILD.md](../BUILD.md)) this
makes the repository self-contained: buildable **and** runnable.

The build produces `rpl4opt.exe`; this folder supplies everything that exe loads
at runtime (data, audio, gauges, config), plus the third-party runtime binaries.

---

## 1. How to run it

The game is designed to run from `\games\rp411` (see the launch scripts). It is
an **arcade pod-cabinet** build — it expects RIO/serial controls and cabinet
lighting hardware, but will start on a desktop for inspection.

```bat
cd \games\rp411
rpl4opt.exe -net 1501
```

Launch scripts included in `assets/RP411/`:

| Script | Command | Purpose |
|--------|---------|---------|
| `startrp.bat`   | `rpl4opt.exe -net 1501`      | Normal start |
| `startRPlc.bat` | `rpl4opt.exe -net 1501 -lc`  | Start with gauges suppressed (`-lc`) |
| `startRPmr.bat` | `rpl4opt.exe -net 1501 -mr`  | Mission-review mode (`-mr`) |
| `RPLoop.bat`    | loop `rpl4opt -net 1501` + `sleep` | Attract/restart loop for a cabinet |
| `OnStart.bat`   | `del last.spl`               | Clears the previous spool on boot |

First-time setup also needs the OpenAL runtime installed:
`oalinst.exe /s` (silent) — this is what `assets/postinstall.bat` does.
`libsndfile-1.dll` must sit next to the exe (it already does here).

Command-line flags understood by the app (from `MUNGA_L4/L4APP.cpp`):
`-egg <file>`, `-spool <file>`, `-net <addr>`, `-r <file>` (record),
`-p <file>` (playback), `-solids`, `-res <w> <h>`, `-windowed`,
`-lc`, `-mr`, `-h`/`-help`.

---

## 2. Runtime configuration chain

1. **`environ.ini`** — top-level environment. Sets controls, target FPS, gauge
   mode, the cabinet plasma/lighting COM port, and — crucially — points at the
   DPL config:
   ```
   L4CONTROLS=RIO;KEYBOARD
   L4DPLCFG=RPDPL.INI
   L4GAUGE=640x480x16
   L4PLASMA=COM2
   TARGETFPS=25
   ```
2. **`RPDPL.INI`** — the DPL (renderer/scene) configuration. Resolves day/night
   and weather via `compare`/`branch` pages, defines lighting/fog/particle
   effects, and sets the asset search paths:
   ```
   objectpath   = .\video
   materialpath = .\video
   texmappath   = .\video
   ```
3. **`TEST.EGG`** — an "egg notation" mission script (mission/pilots/vehicle/
   colors/badges). Loaded via `-egg`, or used as the default test mission.

---

## 3. Asset directories

| Dir | Size | Contents |
|-----|------|----------|
| `AUDIO/`  | ~97 MB | 223 `.wav` sound effects + `AUDIO.INI`, `AUDIO.RES`, `AUDIOMR.INI`, `CTMIX.CFG` |
| `VIDEO/`  | ~10 MB | 3D + material data: `.X` DirectX meshes, `.SKL` skeletons, `.det` detail meshes, `.sph` collision spheres, `.met` materials, `.pcc`/`.png`/`.pcx` textures, `.vsh`/`.psh` shaders, `.sky`, and `.tbl` material-replacement tables |
| `GAUGE/`  | ~0.8 MB | HUD: `.GIM` gauge images, `.PCC`/`.PCX` bitmaps/fonts, `GAUGE.GAT`, `L4GAUGE.CFG`, `L4GAUGE.INI`, `VCS.CFG` |
| `SPOOLS/` | — | Empty at rest; the game writes replay/spool streams here at play time (`.gitkeep` retains the folder) |

---

## 4. Binaries in the working copy

| File | Role |
|------|------|
| `rpl4opt.exe`      | The game. **Also built from source** — this is the shipped reference binary (Jan 2012). The source build output goes to `Release\rpl4opt.exe`. |
| `libsndfile-1.dll` | Runtime sound-file library (DLL counterpart of `lib/libsndfile-1.lib`) |
| `oalinst.exe`      | OpenAL redistributable installer (run once via `postinstall.bat`) |
| `sleep.exe`        | Small delay utility used by `RPLoop.bat` |

---

## 5. Notes & caveats

- The root-level `RPL4.RES`, `TEST.EGG`, and `JOYSTICK.INI` here **differ** from
  the same-named files under `RP_L4/` in the source tree — the copies in
  `assets/RP411/` are the deployed/runtime versions; the `RP_L4/` copies are what
  the build compiles/links.
- Assets are committed directly to git (not LFS). The bundle is ~110 MB, the
  bulk being `AUDIO/`. Largest single file is ~2.2 MB.
- `assets/RP411/VIDEO/Thumbs.db` (a Windows thumbnail cache) is intentionally
  git-ignored, as are runtime `*.spl` spool files.
