# Native OpenQ4 baseline

The native build is a compatibility oracle and the authoritative multiplayer
server for the browser port. It is built from pinned OpenQ4/OpenQ4-game sources
with tracked local patches, while retail Quake 4 data remains ignored and
outside every public path.

## Build

Ubuntu 20.04 needs GCC 13 and the Linux development dependencies listed in
OpenQ4's `BUILDING.md`. Build and stage the native runtime with:

```bash
tools/build-native.sh --clean --jobs 4
```

The Ubuntu 20.04 baseline defaults to OpenQ4's supported native X11/GLX
backend. The default SDL3 fallback currently requires `libpipewire-0.3`, while
Ubuntu 20.04 provides only PipeWire 0.2. A host with PipeWire 0.3 development
files can request that backend with `OPENQ4_PLATFORM_BACKEND=sdl3`.

Generated source copies live under `build/native-src`, Meson output under
`build/native-release`, and the runnable package under `runtime/native`.
`runtime/native/q4base` is a local symlink to `assets-src/gog/q4base`.

## Dedicated smoke

```bash
port/native/smoke-dedicated.sh
```

The smoke starts the shipped bot-ready `mp/q4web_arena` as a 12-slot DM
server on UDP 27666, maintains eight bots, prints the engine's local `serverInfo`,
reloads the map, and requires a finalized full-state demo on both sides of the
rotation. Stock Quake 4 multiplayer maps do not include bot AAS data and are
therefore not valid bot smoke targets. Evidence is stored in
`runtime/native-smoke`. See [SERVER_DEMOS.md](SERVER_DEMOS.md) for the replay
format, controls, playback, and retention contract.

## Source pins

- OpenQ4: `975e296b80b66f63b817d16ea78b53e0685c5c55`
- OpenQ4-game: `eb26e5f3a52358c58ee00bee5602575e5b057164`
- Native engine patches: `0001`, `0002`, `0004`, `0005`, `0007`,
  `0008`, `0011`, `0015`, `0016`, `0018`, `0020`, and `0023` under
  `port/native/patches`, in that order. The WebAssembly and source-offer
  paths additionally apply the web-only `0010`, `0012`, `0013`, and
  `0014` patches before `0015`.
- Game-module patches: `0003`, `0006`, `0009`, `0017`, `0019`, `0021`, and
  `0022` under `port/native/patches`, in that order.

The authoritative patch arrays live in `tools/build-wasm.sh`,
`tools/build-native.sh`, and `tools/stage-source-offer.sh`; the
WebAssembly and source-offer arrays are identical. Patch `0020` adds bounded
per-viewer replay reliable backpressure; patch `0021` keeps ordinary replay
viewers on the full-state playback path. Patch `0023` keeps browser WebSocket
callbacks free of engine output and reports their bounded notices from normal
network polling.
