Rhythm Fruit Shop gameplay — notes descending toward the judgment line in a fruit-shop themed rhythm game

Rhythm Fruit Shop — Native C++ Core


Context

A rhythm game is a real-time system with an unforgiving spec: judgment windows are tens of milliseconds wide, so every layer between the audio hardware and the player's input must be accounted for. I built this native C++20 core to work through timing, determinism, and memory discipline from first principles — without an engine doing the hard parts for me.

Decision

Song time derives from the audio backend's PCM cursor through an EMA-smoothed, re-anchoring clock — never from frame deltas. Input events carry host-monotonic timestamps reverse-mapped into song time, treating input-to-judgment as a clock-domain-crossing problem. The session core is fully headless, which makes determinism testable: CI replays a recorded run and asserts agreement with a reference Q16 fixed-point scoring implementation. Memory discipline is asserted via a custom operator-new AllocationGuard on the steady-state hot path, and CMake dependency guards make architectural layering provable (the core links no windowing or audio libraries).

Outcome

Deterministic record & replay validated in CI against a reference scoring implementation; zero-allocation gameplay hot path asserted by a custom allocation guard, and architectural layering verified by headless CI.