Skip to content

Perf-5: Switch game loop to requestAnimationFrame#7

Draft
snackman wants to merge 1 commit intomainfrom
worktree-agent-a3701417
Draft

Perf-5: Switch game loop to requestAnimationFrame#7
snackman wants to merge 1 commit intomainfrom
worktree-agent-a3701417

Conversation

@snackman
Copy link
Owner

@snackman snackman commented Mar 2, 2026

Summary

  • Replace setInterval with requestAnimationFrame + fixed-timestep accumulator
  • Game logic still ticks at 50ms, synced with display refresh
  • Clean tab-switch behavior (pause instead of throttled ticks)
  • Zero changes to game logic subsystems — only constants.ts and useGameLogic.ts modified

Test plan

  • Entity movement speed identical to before
  • Tab switching pauses/resumes cleanly
  • Pause/resume works
  • Oven timers function correctly
  • Game over animation works

🤖 Generated with Claude Code

… accumulator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant