DEV Community

Nivando Soares
Nivando Soares

Posted on

Restoring gameplay scanline depth in the TD2 SDL port

Restoring gameplay scanline depth in the TD2 SDL port

This checkpoint closed a very specific visual bug in the SDL reimplementation of The Duel: Test Drive II.

The promoted gameplay rail gameplay_live_race_mid was still rendering from a flat end-of-frame ppu_state, which made the road swallow the shoulders and the horizon. That was good enough for early archaeology, but not for a faithful SNES-mimetic port.

The fix was to stop treating that gameplay seed as one global presentation state. I attached the measured visible-scanline profile from tools/out/lane3_live_race_mid_scanline_full/td2_scanline_step_test.json directly to the promoted rail and fed these fields into the native SDL renderer:

  • main_layers
  • bg1_hscroll/bg1_vscroll
  • bg2_hscroll/bg2_vscroll
  • bg3_hscroll/bg3_vscroll

That immediately restored the first-order depth cues on the live-race frame: the horizon comes back, BG3 only re-enters on the measured strip, and BG2 uses the real per-scanline staircase instead of one global VOFS.

The useful part is that this did not require inventing a new gameplay heuristic. The scheduler rail stayed intact; the improvement came from consuming the trace we already had in a more faithful way.

I also kept the guardrails cheap:

  • make -C port test still passes end to end
  • test_scheduler.sh now proves that the scanline profile is loaded for gameplay_live_race_mid
  • the same smoke also checks a few framebuffer pixels so the restored sky/mountain/grass split does not silently regress

There is still a clear boundary here: only the promoted live-race rail is scanline-aware today. The next step is to move this attachment into versioned contract data and promote another gameplay phase on the same path instead of letting later bundles fall back to flat presentation.

Top comments (0)