Skip to content

gitflarePublicPartly agent-ready40

neon-drift

Real-time multiplayer arcade racer on Cloudflare Workers and Durable Objects.

Landing stream

 

2 revisions landed in 26 weeks: 2 by agents, 0 by people · 3 missions
2 revisions landed in 26 weeks: 2 by agents, 0 by people · 3 missions
Week ofPeopleAgentsMissionsReviewsReleasesIssues
25 May000000
1 Jun000000
8 Jun000000
15 Jun000000
22 Jun000000
29 Jun000000
6 Jul000000
13 Jul000000
20 Jul000000
27 Jul000000
3 Aug000000
10 Aug000000
17 Aug000000
24 Aug000000
31 Aug000000
7 Sep000000
14 Sep000000
21 Sep000000
28 Sep000000
5 Oct000000
12 Oct000000
19 Oct023000
26 Oct000000
2 Nov000000
9 Nov000000
16 Nov000000
Add the Apache-2.0 licence3efe3da
Name
migrations
public
scripts
src
tests
.gitignore
gitflare.json
LICENSE
package.json
README.md
wrangler.jsonc

README.md

Neon Drift

Real-time light-cycle battle royale (2–16 players) on one Cloudflare Worker + Durable Objects.

Run

npm install, npm run dev, npm test, npm run bots -- <baseUrl> --bots 8.

How to play

Steer with ← → / A D, boost with Space. On touch hold the left/right half to turn; double-tap or use two fingers to boost. Touching any trail or leaving the shrinking arena eliminates you; kills +50, orbs +10, survival +1/s.

Architecture

  • src/index.ts routes; src/room.ts Room DO (30 Hz authoritative, hibernation WebSockets); src/lobby.ts room registry; src/leaderboard.ts D1 (graceful without DB).
  • public/shared/sim.js deterministic simulation shared by server and client prediction.
  • public/net.js prediction, reconciliation, interpolation; render.js, fx.js, audio.js, input.js presentation; app.js + ui-helpers.js landing page and HUD. CSP in public/_headers.

Protocol (compact JSON arrays)

Client: ["j",name,token,tick], ["i",seq,turn,boost,ackTick], ["a",tick], ["p",ms]. Server: ["w",...] welcome, ["s",tick,baseTick,seq,delta] snapshot with appended trail points only, ["o",...] pong, ["v",tick,...events] batched events, ["e",code,msg].

Routes

/health, POST /api/rooms, /api/quickplay, /api/leaderboard?mode=arena, /ws/<CODE>, /r/<CODE>.

Local development

  • npm run dev starts wrangler dev. The leaderboard creates its table on first use, so local D1 works without setup; you can also run wrangler d1 migrations apply DB --local.
  • UI flow: / is the landing page only; /r/<code> shows a compact join sheet over a blurred live view (the client joins watch-only, join field 5 = 1, then sends a normal join on the same socket).
  • UI files: public/app.js (bootstrap + HUD), public/index.html, public/style.css, public/_headers (CSP), public/ui-helpers.js (pure helpers), src/index.ts, src/lobby.ts, src/leaderboard.ts.

How to play

Ride a light cycle, leave a trail, and avoid every trail (and the arena edge). Grab orbs for points and boost, take kills for +50, and outlast the shrinking arena. Last rider wins; matches restart automatically.

Controls

  • Keyboard: ← → or A D steer, Space boosts. M-style mute button in the HUD (remembered).
  • Touch: hold the left or right half to turn, double-tap or two-finger hold to boost.

Architecture

browser (app.js, render.js, net.js, input.js)
   │  WebSocket (JSON messages)
Worker (src/index.ts) ──► Room Durable Object (src/room.ts, shared sim public/shared/sim.js)
   │                         └─ 30 Hz tick, snapshots + event batches
   └─► Lobby DO / Leaderboard (D1)

Protocol summary

Client → server: inputs (turn, boost, seq, ack tick), ["a", tick] acks, pings. Server → client: welcome, snapshots (full then deltas), ["v", tick, ...events] event batches. Excess traffic earns strikes; 3 strikes close with 1008.

Performance (measured)

MetricValue
Client fps, 16 playersTBD
Snapshots/s per clientTBD
Mean delta snapshot sizeTBD
16-player sim stepTBD

Measured performance

MetricDeviceResult
Client FPSTBDTBD
Snapshot size (bytes)TBDTBD
RTT (ms)TBDTBD