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
+31 -16
View File
@@ -4,22 +4,26 @@ OpenRA3 is organised as a stack of C++ modules. Each layer may import the ones
below it, never the ones above.
```
┌───────────────────────────────┐
applications │ openra3 (apps/openra3) │
└───────────────┬───────────────┘
│ import ra3
┌───────────────▼───────────────┐
umbrella │ ra3 (re-exports everything) │
└───────────────┬───────────────┘
┌───────────────┬────────┴────────┬───────────────┐
▼ ▼ ▼ ▼
ra3.skirmish ra3.client ra3.game ra3.map
match rules display/loop RA3 sides map catalog
│ │ │ │
└───────┬───────┴────────┬────────┘ │
▼ ▼ ▼
ra3.logic ra3.core ra3.fs
simulation types/math/random BIG4 + RefPack
┌───────────────────────────────────────┐
applications │ openra3 (apps/openra3) │
└───────────────────┬───────────────────┘
│ import ra3
┌───────────────────▼───────────────────┐
umbrella │ ra3 (re-exports everything) │
└───────────────────┬───────────────────┘
┌──────────────┬───────────────┼───────────────┬──────────────┐
▼ ▼ ▼ ▼ ▼
ra3.ui ra3.render ra3.skirmish ra3.client ra3.game
SDL3 window framebuffer match rules display/loop RA3 sides
│ │ │ │ │
└──────┬───────┘ └───────┬───────┘ │
▼ ▼ │
ra3.core ra3.logic │
simulation │
┌───────────────────────────────────────┬──────────────────────┘
▼ ▼
ra3.map ra3.fs
map catalog BIG4 + RefPack
```
## Module responsibilities
@@ -64,6 +68,17 @@ The minimal match: two players, unit classes (harvester/infantry/tank/base),
passive + harvester income, a simple build AI, movement and combat on a fixed
30 Hz step, and a base-destruction win condition. Fully deterministic.
### `ra3.render`
A dependency-free software renderer: an ARGB8888 `image` framebuffer with
blit/line/circle primitives, a TGA decoder for the game's map art, a 24-bit BMP
encoder for headless output, and `compose` which overlays a world grid and
markers (start positions, live units) onto the map art.
### `ra3.ui`
The windowed viewer. The SDL3 backend streams the rendered image to a texture
with pan/zoom and Esc-to-quit; when the build has no SDL3, a null backend
returns `false` so the caller writes an offscreen image instead.
## Design rules
1. **No raw owning pointers.** Ownership is `std::unique_ptr`; the partition
+9 -5
View File
@@ -11,12 +11,15 @@ that each one produces something that builds and runs.
CMake/Ninja, Docker `dev`/`deploy`, GitLab CI. Reads `BIG4`/RefPack data
from a local install, recovers map start waypoints, and runs a
deterministic headless two-player skirmish to a decision.
- [x] **v0.1.0 — map renderer + window.** Software ARGB framebuffer, TGA
decoder for the map art, BMP output, map/grid/unit compositing, and an
SDL3 window viewer (pan/zoom).
## Next
- [ ] **v0.1.0 — complete map parsing.** Parse `MPPositionList` for maps that do
not use `Player_N_Start` waypoints; recover map dimensions, terrain
heightmap and placement grid; place real starting structures/units.
- [ ] **v0.1.1 — correct world calibration.** Parse the map heightmap
dimensions (and `MPPositionList` starts) so the unit overlay lines up with
the map art instead of using an assumed world size.
- [ ] **v0.2.0 — data & file formats.** Parse compiled gameplay assets
(`GameObject`, `WeaponTemplate`, `ArmorTemplate`, `LocomotorTemplate`) so
units use the real balance numbers instead of OpenRA3's stand-ins.
@@ -25,8 +28,9 @@ that each one produces something that builds and runs.
tree, pathfinding and shroud.
- [ ] **v0.4.0 — AI.** Skirmish AI: build states, team composition, attack
waves (the reference tree's `AI*` modules).
- [ ] **v0.5.0 — renderer.** A W3D/D3D9 (or portable Vulkan/OpenGL) client
backend implementing `ra3::client::display`, plus input.
- [ ] **v0.5.0 — full renderer.** Terrain heightmap rendering, W3D models and a
D3D9/Vulkan/OpenGL client backend implementing `ra3::client::display`,
plus full input.
- [ ] **v0.6.0 — content.** Load real maps, units, powers and strings; play a
skirmish end-to-end with a UI.