lietzsche;ito
Pages

updated 2026-11-26·4 min read

Overview

Low-latency web rhythm game engine for mania combining single-draw-call WebGL2, SharedArrayBuffer clock sync, Rust headless replay crates, and Cloudflare edge contracts.

Back in school I played rhythm-plus a lot because any browser game without an installer actually ran on school PCs. It lagged pretty badly though, and you couldn’t even adjust an audio offset or anything (Itô still lacks an offset setting too, I’m busy with other projects). That annoyance sparked one stubborn goal: hit native desktop (osu!) speed inside a browser, pulling a ridiculous number of engineering tricks just to get around browser limits. Naming it Itô kept my math/physics naming streak going while landing a short three-letter handle like osu!.

Why Browser Rhythm Games Break (and What Runs Today)

Browsers fight vertical-scrolling rhythm games on three fronts at once: AudioContext.currentTime only steps once per 128-sample quantum (2.667 ms at 48 kHz), calling performance.now() inside input callbacks stalls behind V8 garbage collection (5 to 35 ms), and strict COEP: require-corp headers break external .osz mirrors unless you use COEP: credentialless.

To be upfront about the current boundary between crates and browser runtime: the Rust workspace (ito-core, ito-parser, ito-audio, ito-wasm) and server contracts (tickets.ts, statistical.ts, D1 schema) are built and unit-tested, albeit in the live browser client today only ito_pulse.wasm (PulseAnalyzer.ts) is wired up for the menu beat-pulse visualizer. Live gameplay, chart parsing, judgement, and the AudioWorklet currently run TypeScript implementations (GameEngine.ts, ChartParser.ts, Judgement.ts, ItoAudioProcessor.ts), gameplay hitsounds were stripped during the HUD redesign, and the Hono HTTP router, Better-Auth, R2 replay blobs, and live Worker deployment are still on paper.

How the Architecture Splits

  1. Compile Charts into .itobin v2

    crates/ito-parser provides zero-allocation memchr scanners in Rust (25k .osu notes in 3.2 ms), while the live browser client runs ChartParser.ts and OPFS + Web Locks 2PC staging.

  2. Capture Hardware Timestamps at 1000 Hz

    Passive keyboard listeners read monotonic DOM event.timeStamp directly and push events into a cache-isolated SharedArrayBuffer SPSC queue.

  3. Sync Song Time and Audio

    A 2-state Kalman filter + Page-Hinkley CUSUM detector smooths AudioContext.getOutputTimestamp() jitter; crates/ito-audio implements a 32-voice WASM SIMD mixer in Rust tests while live gameplay uses ItoAudioProcessor.ts (gameplay hitsounds stripped).

  4. Render in a Single Instanced Draw Call

    PlayfieldRenderer uploads 64-byte instance quads and a 144-byte std140 ModifiersUBO, tessellating hold ribbons into 16 px slices for smooth modcharts.

  5. Verify Replays Headlessly (Contract Ready)

    crates/ito-core replays .irep tapes in integer microseconds and server/src/ holds D1 schema, HMAC-SHA256 play tickets, and 4 statistical checks, pending Hono/Better-Auth/R2 wiring.

Documentation Sections

Continue to Engine Architecture & Anti-Cheat or Phased Implementation Roadmap.

Search wiki and portfolio

type to search across all entries.