Skip to content

Yield during sim_advance so mid-advance spawns get their models - #2006

Merged
Noisemaker111 merged 3 commits into
betafrom
sim-advance-yield
Oct 20, 2026
Merged

Noisemaker111 merged 3 commits into
betafrom
sim-advance-yield

Conversation

@Noisemaker111

Copy link
Copy Markdown
Owner

After #2004, a 30 s sim_advance through Beacon Bastion's first wave spawned 18 raiders whose health bars drew but whose bodies never did. Their scene groups stayed empty even 40 s later.

  • shell/devtools/simStepper.ts: advanceSimulation is async and yields a macrotask every 200 simulated frames (10 game seconds). React can commit what the sim spawned along the way, so models mount as they would in play. It yields every 10 s rather than every 1 s because each yield can cost a full software-rendered frame (~3 s), and per-second yields made a 30 s advance outrun drive's 30 s RPC timeout.
  • sim_advance returns the promise; the agent bridge already awaits promise verbs. Tests now await and count yields. changes/sim-advance-yield.md.

Root cause, narrowed down in the live scene: the raider GLB loads in 0.5 s (6 skinned meshes, 76 clips). With time_scale and normal frames every raider mounts 12 meshes. After a single synchronous 600-frame burst, every raider group had 0 children and no errors or fallbacks.

Verification

  • bun test packages/shell/src/devtools — 36 pass, 0 fail; check-types — pass; bun run gen — ok; ship:preflight — ok
  • Live, Beacon Bastion. Left: without this PR, sim_advance 30 then a 40 s wait gives bars but no raiders. Right: with it, sim_advance 30 then a 45 s wait shows every raider rendered (with the scaled bars from Size world health bars to the entity on screen #2005):

sim-yield-ba


Generated by Claude Code

A 30 s sim_advance through Beacon Bastion's first wave spawned 18 raiders
in one synchronous burst; their model groups stayed empty (bars drew,
bodies never did) while the same wave reached with time_scale and normal
frames mounted every model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwsemkhoUGyeQkdkKFmUmw
Each yield can cost a full render frame (~3 s under software GL), so a
30 s advance with per-second yields outran drive's 30 s RPC timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwsemkhoUGyeQkdkKFmUmw

Copy link
Copy Markdown
Owner Author

test failed in one file: packages/shell/src/hudInputBoundary.test.ts. Its first browser test hit the 20 s hook timeout and the other four cascaded. This PR only changes devtools/simStepper.ts and the sim_advance verb. The same file timed out on #2000's run earlier today, and locally on this branch it passes 5/5 (bun test --timeout 20000 packages/shell/src/hudInputBoundary.test.ts). There's no newer beta to merge, and I can't re-run the job (403). Re-running test should clear it; I'm keeping the PR watched.


Generated by Claude Code

@Noisemaker111
Noisemaker111 merged commit a869a7d into beta Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants