Skip to content

Add native QuickJS/SDL MVP and numeric C kernel tooling - #48

Draft
SandroMaglione wants to merge 4 commits into
mainfrom
codex/native-runtime
Draft

SandroMaglione wants to merge 4 commits into
mainfrom
codex/native-runtime

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Games can now run in a native C11 application embedding QuickJS-ng and SDL3, with game-owned 2D drawing and the existing TypeScript simulation, input and fixed-loop contracts. This is the working Linux MVP from #47, with numeric C kernel compilation and mobile project tooling.

  • Add @typeonce/ritmo-native: doctor, build, dev, check, retained rectangles/PNG sprites/debug text, structural keyboard/pointer/touch adapters, lifecycle and safe-area handling.
  • Add private, versioned core numeric columns, query views and transaction journals. A TypeScript 6 analyzer emits deterministic C11 for supported numeric systems, retains interpreted fallbacks, reports unsupported constructs and enforces requireCompiled.
  • Add streaming per-frame Node/native oracle checks with kernels on and off, 10,000 numeric fuzz cases, C numeric/journal tests, rendering goldens and native benchmarks.
  • Add Android Gradle/SDLActivity and iOS Xcode project generators and build/oracle launchers, plus desktop/mobile/sanitizer CI jobs.
  • Add the top-down native entry and touch controls, and an external inkline-town integration script using its real simulation with a native 2D town view. Its Three.js renderer is not ported.
  • Pin and license QuickJS-ng 0.12.0, SDL 3.2.28 and stb_image.

Local Linux verification: pnpm check (446 runtime tests plus type tests), pnpm pack:check, full core suite in numeric-column mode (272 tests), CTest and screenshot goldens. Top-down and inkline-town each match Node for 600 frames with kernels on and off. Both the 5,000-entity stress fixture and 10,000 numeric fuzz cases pass with ASan/UBSan. The fuzz run verifies actual C kernel execution.

The user approved normalizing NaN sign/payload bits because V8 and QuickJS differ even with kernels disabled. Every other IEEE-754 bit remains exact, including signed zero.

The final same-machine browser benchmark check passed, with every runtime difference within 20% and type metrics within the committed 5% tolerance. The plain benchmark check flags six cases against the shared Apple M1 baseline on this AMD Linux host; both outputs and the saved pre-change measurements are committed. At 5,000 entities, native numeric movement measured 0.0817 ms/frame versus Node JIT 0.2712 ms/frame; see packages/native/bench/results.md.

This stays a draft: the conservative compiler leaves top-down's map/validation/helper-based movement interpreted, so its planned requireCompiled gate is not met. macOS/Windows execution, actual Android/iOS builds and emulator/simulator checks still need platform CI. Mobile project generation alone has been checked locally. PLAN.md and NATIVE_CHECKPOINT.md retain the exact outstanding gates and reproduction commands.

All work remains in this single implementation PR. Do not merge this PR or #47 into main.

claude and others added 4 commits October 18, 2026 04:56
Native hosts (QuickJS-ng + SDL3) and ahead-of-time compiled systems,
written as a handoff for an implementing agent: decisions, assumptions,
core seams, the compiled subset, the oracle, phases and gates.

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

This branch has not been deployed

No deployments
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