gitflarePublicPartly agent-ready40
orbit-duel
Real-time two-player orbital combat game on Cloudflare Workers and Durable Objects.
- LicenseApache-2.0
- LanguageJavaScript
- Last landed
0413e56Oct 23, 2026
Landing stream
| Week of | People | Agents | Missions | Reviews | Releases | Issues |
|---|---|---|---|---|---|---|
| 25 May | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 8 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 15 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 22 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 29 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 6 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 13 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 20 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 27 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 3 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 10 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 17 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 24 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 31 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 7 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 14 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 21 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 28 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 5 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 12 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 19 Oct | 0 | 2 | 3 | 0 | 0 | 0 |
| 26 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
| 9 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
| 16 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
0413e56| Name |
|---|
| migrations |
| public |
| scripts |
| src |
| tests |
| .gitignore |
| gitflare.json |
| LICENSE |
| package.json |
| README.md |
| tsconfig.json |
| wrangler.jsonc |
README.md
Orbit Duel
Real-time multiplayer space dogfight for 2-8 pilots: ships with inertia orbit a central planet in a wrap-around 1600x1600 world. One Cloudflare Worker with static assets, Durable Objects and D1.
How to play
- Keyboard: A/D or arrows rotate, W or Up thrust, Space fire, Tab scoreboard, F3 debug.
- Touch: left stick aims and thrusts, right button fires. Landscape is best.
- 3 hits destroy a ship; the planet kills too. Respawn after 3 s with 2 s invulnerability. Power-ups: shield, triple shot, rapid fire.
- First to 10 kills or 4 minutes wins; results show kills, deaths and accuracy, then a rematch starts.
- Quick play joins the fullest open room; Create private room gives a link like
/r/ABC234. Opening that link shows a join sheet over a live view of the room.
Run
npm install
npx wrangler d1 migrations apply DB --local # optional: local leaderboard table
npm run dev
npm test
npm run bots -- http://localhost:8787 --bots 3 --seconds 20
The leaderboard also creates its table on first use (CREATE TABLE IF NOT EXISTS, same schema as migrations/0001_init.sql) and degrades to "unavailable" without a DB.
Architecture
src/index.tsroutes:/health,POST /api/rooms,/api/quickplay,/api/leaderboard?mode=duel,/ws/<CODE>; everything else is static assets (SPA fallback for/r/<CODE>).src/room.tsRoom Durable Object: 30 Hz alarm loop, hibernation WebSockets, token-bucket rate limit, per-client delta snapshots.src/lobby.tstracks rooms (players = connected player slots) for quick play and live counts.public/shared/sim, rng and protocol shared by server, browser and tests. Bullets are never in snapshots: clients simulate them fromfireevents.
Protocol (compact JSON arrays)
Client: ["j",name,token|null,tick|null,_,watch?], ["i",seq,rotate,thrust,fire,ackTick], ["a",tick], ["p",ms].
Server: ["w",...] welcome, ["s",tick,baseTick,lastInputSeq,delta], ["o",ms,tick], ["v",tick,...events], ["e",code,msg].
File map
public/app.js,index.html,style.css,_headers: landing, join sheet, HUD, CSP.public/net.js,render.js,input.js,fx.js,audio.js: client networking, canvas, input, particles, sound.scripts/bots.mjs: load-test bots.tests/: node:test suites.
How to play
Duel in orbit around a planet. 3 hits destroy a ship; the planet is lethal. First to 10 kills (or most after 4 min) wins; a results screen shows a podium and accuracy, then a new match starts.
Controls: A/D or ←/→ rotate, W/↑ thrust, Space fire, Tab scoreboard, mute button in the HUD. Touch: left stick aims and thrusts, right button fires, Scores button toggles the scoreboard.
Architecture (text)
browser: input.js -> app.js -> net.js <== WebSocket ==> Worker (src/index.ts)
render.js/fx.js/audio.js \-> Durable Object room (src/room.ts)
runs shared/sim.js at 30 Hz
Protocol summary
Client sends inputs {rotate,thrust,fire} with seq and snapshot-tick ack. Server sends welcome, full/delta snapshots and ["v", tick, ...events] (fire, hit, kill, crash, respawn, power, pickup, phase, results). Bullets are simulated client-side from fire events.
Measured performance
| Metric | Value |
|---|---|
| Client fps | TBD |
| Server tick ms | TBD |
| Bandwidth per client | TBD |