Phase 3e: live texturing + serial receive-latency fixes for the RIO

Texturing (validated live -- game-live-textured.png, the ravine's brown dirt
terrain): the wire model is Division's intensity+ramp scheme. action 26
uploads 8-bit intensity texels ([node][nbytes][w][h] + rows; type 13 =
texture); texmap (12) references the texture; material (11) references its
texmap and a ramp (14: lo/hi RGB); texel color = lerp(lo, hi, i/255). The
backend bakes RGBA per material, uploads to GL, maps with wire UVs
(stride-5: floats 3-4; stride-8/9: floats 6-7).

Serial (directserial fork options, tracked in vpx-device/serialport/):
- rxpollus:<us> -- receive poll tick (stock 1ms); 100us discovers inbound
  bytes ~10x sooner. Validated: sim advanced, camera moved with real RIO.
- rxburst:<n>  -- stock DOSBox re-serializes received bytes at emulated wire
  speed (~1ms/byte at 9600) though they already paid wire time on the real
  cable; a 15-byte analog reply gained ~14ms, blowing the RIO's few-ms ACK
  window and dropping the game into its 15-second retry fallback
  (L4CTRL.CPP limit=15.0 //0.2). rxburst:16 delivers buffered bytes 16x
  faster. game_rio.conf: realport:COM1 rxpollus:100 rxburst:16.

Crash-on-advance fixed: *_TSHD.BGF terrain shadows live only in arena
subdirs the search path misses; null shadow renderable was dereferenced once
the sim moved. All 11 copied into VIDEO/GEO in the working image; game now
runs sustained (560+ frames, textured, no crash). Details in RIO-NOTES.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-03 16:43:21 -05:00
co-authored by Claude Opus 4.8
parent 99652d894b
commit 0bb493dd5f
9 changed files with 741 additions and 32 deletions
+21 -3
View File
@@ -156,9 +156,27 @@ 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.
### 3e. Texturing (DONE) — the texture chain
![live textured terrain](game-live-textured.png)
The wire texture model is Division's intensity+ramp scheme (no palette ever
crosses the link):
- **action 26** uploads texels: header `[node][nbytes][w][h]` then 8-bit
intensity rows (64×64…128×128; node type 13 = texture).
- **texmap (type 12)** flush references its texture node; **material (type
11)** flush references its texmap *and* a **ramp (type 14)**: two RGBs
(lo/hi), e.g. dark red-brown → light tan for mech hulls.
- Final texel color = `lerp(ramp_lo, ramp_hi, intensity/255)`.
The live backend bakes each textured material's RGBA once (texture × ramp),
uploads it to GL keyed by material, and maps it with the wire UVs (stride-5
verts: floats 34; stride-8/9: floats 67). Result: the arena renders with
the ravine's actual brown dirt textures, live (`game-live-textured.png`).
Still to come: lighting from the wire normals, per-frame articulation once
the RIO holds sync, LOD selection by distance.
## 3c. The full game runs through the live renderer (sync abort fixed)