Phase 3d: game world decodes and renders -- offline and LIVE

The full DPL hierarchy the game uses (vs flyk's flat scene) is now decoded
and rendered:
- stride-aware set_geom_verts (header word 3 = floats/vertex: 3/4/5/8/9;
  mech meshes carry normals + UVs)
- instances are list_add children of DCS nodes; instance flush field 4 ->
  object; object->lod->geogroup->geometry; dcs_link builds the articulation
  tree of 4x4s (payload floats 4..19, row-major, row 3 = translation)
- game world is y-down (DCS matrices carry a reflection); projection flips
  x (Division mirror) and y

render_game.py reconstructs a captured game stream offline: the mission
arena (10km, 246 instances, 330 geometries), the player's Thor at the
camera, six enemy mechs 1.5km north -- game-mech-decoded.png shows one with
real hull/armor/glass materials; game-cockpit-decoded.png the cockpit view.

The live backend (vpxlog.cpp) gained the same traversal and now draws the
game's out-the-window view in real time (game-live-gl.png): sky, arena
floor to the horizon, own gun barrels at frame bottom.

Next: texturing (action-26 texel maps + UVs), lighting from wire normals,
per-frame articulation once the RIO drives the sim.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-03 16:22:35 -05:00
co-authored by Claude Opus 4.8
parent 47fe174c6e
commit 99652d894b
7 changed files with 512 additions and 40 deletions
+48
View File
@@ -112,6 +112,54 @@ before its first receive, which the POLL_THRESHOLD gating stalls. This is not
a 3b issue (the `flyk` clean-launch path renders fine); it is the same
production-sync item still open from Phase 2.
## 3d. The game's own world decodes and renders — LIVE
![live GL window: BattleTech cockpit view](game-live-gl.png)
The live backend now draws the game's actual out-the-window view in real
time: sky, the arena floor receding to the horizon, and the player's own gun
barrels at frame bottom (static scene — without a RIO the sim doesn't
advance). Same frame decoded offline below.
![decoded BattleTech mech from the game's wire stream](game-mech-decoded.png)
That is an enemy mech (object 1048, 488 verts) standing in the mission arena —
reconstructed **entirely from the game's captured FIFO stream** by
`render_game.py` (real hull/armor/cockpit-glass materials from the wire; the
half-buried look is the offline painter's-algorithm artifact, which the live
GL depth buffer doesn't have). `game-cockpit-decoded.png` is the actual
cockpit camera: the arena floor to the horizon with the player's own gun
barrels rising at frame bottom.
What the game adds over flyk's flat scene (all now handled, offline +
live backend):
- **Stride-aware vertices.** `set_geom_verts` header word 3 = floats per
vertex: 3 (xyz), 4, 5 (xyz+uv), 8 (xyz+normal+uv), 9. Mech meshes carry
normals and texture coordinates — lighting/texturing data is on the wire.
- **Full DPL hierarchy.** Instances are `list_add` children of DCS nodes
(dcs→instance); instance flush field 4 references the object (type 7);
object→lod→geogroup→geometry via list_add. `dcs_link` (action 7) builds the
articulation tree (mech torso/arms/legs), each DCS a 4×4 at payload floats
419 (row-major, row 3 = translation).
- **The world is y-down** (the DCS matrices carry a y reflection; game coords
vs Division's). The renderer flips both x (Division mirror) and y.
- **Mission scene scale**: 10 km arena of 1000-unit ground tiles, 246 placed
instances, 330 geometries, 280 materials; the player's Thor (644 verts,
articulated sub-parts as sibling instances) sits exactly at the camera;
six enemy mechs stand ~1.5 km north.
- Camera: action 31 (rotation + eye at the cockpit position); with the sim
stalled (no RIO) it arrives once and the scene is static.
Offline tool: `render_game.py <fifodump>` (near-plane clipping, hierarchy
traversal). Fixture: a 954-frame capture. The live backend (`vpxlog.cpp`)
gained the same traversal: stride-aware geometry, dcs/instance/object link
decode, cached world transforms per DCS, y-down projection.
Still to come: texturing (stride-8 UVs + action-26 texel maps), lighting from
the wire normals, per-frame articulation once the RIO drives the sim, LOD
selection by distance.
## 3c. The full game runs through the live renderer (sync abort fixed)
**The production `vr_sync` abort is fixed, and BattleTech v4.10 now runs