Skip to content

Add a fixed-step lifecycle with native and WASM acceptance - #172

Draft
proggeramlug wants to merge 1 commit into
codex/starter-clifrom
codex/fixed-game-lifecycle
Draft

Add a fixed-step lifecycle with native and WASM acceptance#172
proggeramlug wants to merge 1 commit into
codex/starter-clifrom
codex/fixed-game-lifecycle

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Games using variable frame delta currently implement timing and hook ordering independently. Add optional runGameLifecycle and FixedStepClock APIs for constant simulation ticks, bounded catch-up, explicit dropped time, variable updates, interpolated drawing and one-time cleanup on native and web. The starter uses the shared lifecycle and interpolates its previous/current simulation state.

The actual Perry native/WASM contract exposed two compiler compatibility gaps. Use a portable noncoercing finite check, also shared by the existing scene/quality validators, and invoke stored hooks through local function references so WASM uses closure dispatch. Retain the earlier failed observations. General Perry JSON and exception propagation remain separate limitations.

Validation:

  • Actual native and WASM execution agrees on uniform/varied/long-running ticks, catch-up/drop/resume, interpolation, invalid and overflowing deltas, very small steps, optional hooks, callback order, early stop and idempotent cleanup. The runner waits for boot completion and rejects missing/duplicate results and late errors.
  • A fresh installed lifecycle fixture renders all 16,384 expected pixels on Radeon DX12 and Vulkan, recording one init, matching update/draw counts, advancing fixed ticks and one cleanup. Existing scene/direct-2D physics fixtures remain in the required native gate.
  • A fresh installed CLI creates the revised starter with its default command. The unmodified native build passes; a bounded npm start run renders the 800x450 greeting/square, loads the asset and cleans up once. The restored unmodified source completes the full web build. Installed runtime/template sources match this change.
  • Eight acceptance-control tests, repository/package/FFI contracts and the existing 23 JavaScript behavioral tests pass. A real compiled-game recording-FFI probe verifies the hooks and startup-fault control; hosted rendering now passes the exact image, eight frames, advancing fixed ticks and one cleanup. Tests run 34569572883 passes all 22 jobs.

CI now requires the pure native/WASM contract, adds the public lifecycle mode to fresh installed native rendering, and requires hook counters alongside the browser image. Local evidence and its limits are documented in docs/evidence/fixed-game-lifecycle-v1.md. Full starter asset/text browser rendering, canonical example runtime coverage, components and device-loss recovery remain open.

Stacked on #171; relates to #142, #143 and #74.

Hosted native scene/direct-2D/lifecycle captures all pass. The native package report retains its dirty-source flag; its seven reported installed runtime hashes match this PR with Windows newline conversion. Subsequent full starter execution exposed a named-void-callback conversion failure addressed by #173; this PR alone does not qualify full starter browser execution.

Published report and evidence retain local and hosted results, earlier failures, captures, source receipts and the exact patch. ZIP SHA-256: 62842982376bc923a0ed04ca2df6af49c86141119602bbf57f56a7a9afe056a2.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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