Production skeleton for a large co-op browser game:
- Frontend: Vite + React + Tailwind + TanStack Router
- Auth: Clerk
- Game client: Rust + Bevy (WASM)
- Shared simulation math: Rust
sim-core - Multiplayer backend: Rust Cloudflare Worker + Rust Durable Object + SQLite
- Transport: WebSockets
- Domain:
will.ralph-island.com
- Room-based multiplayer (
/room/:roomCode) - Rust Durable Object room authority with SQLite persistence
- Server-authoritative movement, build objects, and projectiles
- Fixed-step simulation (
60Hz) and snapshots (20Hz) - Client prediction + server reconciliation for local player movement
- Snapshot interpolation for smooth remote rendering
- Protocol v2 envelopes with command ack and ping/pong
- Clerk-backed websocket identity (token + user id validation in Rust)
- Entry point:
worker/src/lib.rs - One room code => one
RoomDurableObject - SQLite tables for presence, movement, builds, and projectiles
- Protocol command handling and snapshot broadcast
- Clerk session verification in the websocket connect path
src/routes/room-route.tsx: session bootstrap and HUDsrc/game/network-client.ts: websocket protocol transportsrc/game/netcode/replication.ts: interpolation and render snapshotssrc/game/bridge.ts: JS <-> Bevy WASM bridge
game-client/src/lib.rs- Local fixed-step simulation and sequenced input emission
- Reconciliation against authoritative snapshots
- Rendering of players, structures, and projectiles
- Node.js 20+
- Rust toolchain
wasm-packwasm32-unknown-unknowntarget- Cloudflare account +
wrangler login
Install once:
rustup target add wasm32-unknown-unknown
cargo install wasm-packFrontend:
.env.developmentshould includeVITE_CLERK_PUBLISHABLE_KEY
Worker (local dev):
worker/.dev.varsshould includeCLERK_SECRET_KEY
Install dependencies:
npm installStart frontend:
npm run devStart worker:
npm run worker:devnpm run buildGenerate/update the animated player spritesheet:
npm run sprite:generatePipeline docs and API key location:
retro-diffusion/README.md
worker/wrangler.toml is configured for:
- Durable Object namespace
ROOMS - SQLite DO migrations
- Static assets binding from
dist/ - Custom domain route
will.ralph-island.com
Ensure production secret exists:
wrangler secret put CLERK_SECRET_KEY --config worker/wrangler.tomlDeploy:
npm run deployThis repo includes an autonomous Ralph harness tailored for Codex.
Files:
ralph/prd.json: structured roadmap + acceptance criteria (passesgates)ralph/prompt.md: per-iteration operating instructionsralph/progress.txt: rolling memory between iterationsscripts/ralph-once.sh: one HITL iterationscripts/afk-ralph.sh: bounded AFK loop
./scripts/ralph-once.sh --iteration 1./scripts/afk-ralph.sh 10./scripts/ralph-once.sh --dry-run
./scripts/afk-ralph.sh 3 --dry-runNotes:
- Model defaults to
gpt-5.3-codex(RALPH_MODELto override). - This Codex CLI version does not expose a literal
--yoloflag, so scripts use the YOLO-equivalent:--dangerously-bypass-approvals-and-sandbox(auto-detected fallback logic is built in).