v0.1.0: software map renderer + SDL3 window viewer

This commit is contained in:
EnderTheCoder
2026-09-12 01:02:49 +08:00
parent 3ad380c81e
commit b35372da52
13 changed files with 659 additions and 31 deletions
+30 -2
View File
@@ -20,8 +20,8 @@ Ghidra.
OpenRA3 is at **v0.0.1**. The engine compiles and runs headless, and a **minimal
skirmish** is playable: it reads a real multiplayer map out of your install,
recovers the player start waypoints, and simulates two sides earning credits,
training units and fighting until one base falls. There is no renderer yet, so
the match is observed as a deterministic headless result.
training units and fighting until one base falls. The map and match state can be
**rendered** to a window (SDL3) or to an image.
```text
$ openra3 skirmish --game-dir "/game" --map map_mp_2_feasel4
@@ -66,6 +66,8 @@ built-in test map so the project still builds and runs in CI.
| `src/fs/ra3.fs.cppm` | `BIG4` archives, RefPack codec, local install locator |
| `src/map/ra3.map.cppm` | map catalog, `EAR`/RefPack unwrap, start waypoints |
| `src/skirmish/ra3.skirmish.cppm` | units, economy, AI, combat, win condition |
| `src/render/ra3.render.cppm` | ARGB framebuffer, TGA decode, BMP encode, map compositing |
| `src/ui/ra3.ui.*.cppm` | SDL3 window viewer (null backend when SDL3 is absent) |
| `src/ra3.cppm` | umbrella module re-exporting the SDK |
| `apps/openra3/main.cpp` | `maps` / `skirmish` CLI |
| `tests/ra3_tests.cpp` | smoke tests (run via `ctest`) |
@@ -103,6 +105,32 @@ docker run --rm -v "/path/to/Red Alert 3:/game:ro" openra3-dev:local \
`--frames N` caps the simulation length (default 15 minutes of game time at
30 Hz). The result is deterministic for a given map and seed.
## Rendering the map
The renderer draws the map's own overview art, a world grid and the match state
(start markers in yellow, player 0 in blue, player 1 in red).
**Offscreen image** (works anywhere, no display needed):
```bash
docker run --rm -v "/path/to/Red Alert 3:/game:ro" -v "$PWD/out:/out" openra3-dev:local \
/work/build/bin/openra3 render --game-dir /game --map map_mp_2_feasel4 --out /out/map.bmp
```
**Interactive window** (SDL3; drag to pan, wheel to zoom, Esc to quit). In a
container you need an X server on the host — on Windows run
[VcXsrv](https://sourceforge.net/projects/vcxsrv/) and launch it with "Disable
access control", then:
```bash
docker run --rm -v "/path/to/Red Alert 3:/game:ro" -e DISPLAY=host.docker.internal:0.0 \
openra3-dev:local /work/build/bin/openra3 render --game-dir /game --map map_mp_2_feasel4
```
If no display is available the viewer falls back to writing `openra3_view.bmp`.
The unit overlay uses an approximate world scale (`--world-size`, default
5120); exact calibration from the map's heightmap is on the roadmap.
## Reverse engineering
The reconstruction is driven by Ghidra against the retail binary. See