Your laptop is the console. Every phone in the room is a controller.
Two minutes of the real thing: demo/out/demo.mp4
Open the game on a laptop, AirPlay or screen-share it to the TV, and let everyone else scan the QR code. Their phone becomes a gamepad β joystick, GRAB, and CHOP/DASH. Up to 8 chefs. Any chef can press Start.
Hosted β works anywhere, phones only need internet:
On your LAN β offline, lowest latency:
npm install
npm run build && npm start # custom server on :3000 (PORT to override)Open the printed http://<lan-ip>:3000 on the laptop; phones on the same
Wi-Fi scan the QR.
Every ticket is a dish, and every dish is a list of ingredients that each know how they want to be prepared: onions are chopped and boiled three to a pot, a patty is chopped and then fried in a pan, rice boils one portion at a time, and a bun goes straight on the plate. Grab, chop (hold CHOP), cook, and assemble on a plate in any order you like β then run it to the serve window before the ticket expires. Pots and pans can be carried anywhere; off the ring they stop cooking, and a finished one tips straight onto a waiting plate. Ignore one and it burns, then catches fire and spreads, so somebody has to fetch the extinguisher off the wall and hold SPRAY. Rounds are 3 minutes. Full rules, the menu and the interaction table live in SPEC.md.
| World | Levels | What is new |
|---|---|---|
| Home Kitchen | Mise en place Β· Dinner rush Β· Family reunion | soup by the potful, then a menu that needs the pan too |
| Boardwalk Grill | Flat top Β· Cheese please Β· Boardwalk deluxe | raw meat: chop the patty, fry it, then build the burger β ending in a kitchen split in two by a counter wall |
| Night Sushi Bar | Rice & fish Β· Rolling Β· Omakase | rice boils one portion at a time, nori is walled in behind the pass, and six pots are all burning at once |
Any chef picks the kitchen from their phone in the lobby (βΉ βΊ above START),
and the game-over screen offers Next level. Mid-round, the βΈ in the
corner of any phone freezes the whole kitchen β the TV and every other phone
say who did it, and any chef can press Resume. Each world has its own
palette and its own floor, resolved from the level and passed to the renderer
β which is also where a future sprite pack will slot in.
A Next.js app with native WebSockets, running the same authoritative simulation in two very different places.
phones (/join) host laptop β TV (/)
β ws: input / press / release β ws: state snapshots ~20 Hz
ββββββββββββββββΊ /api/ws βββββββββββββ
Vercel Fluid Compute (experimental_upgradeWebSocket)
or server/local.ts for LAN parties
realtime/: rooms + authoritative sim @30 Hz + bus (memory | Redis)
app/api/ws/route.tsupgrades to a WebSocket on Vercel Fluid Compute viaexperimental_upgradeWebSocket(@vercel/functions). The invocation stays alive for as long as the socket does.server/local.tsis a custom Next server for LAN parties. It owns the one thing Next cannot do on its own machine β the/api/wsupgrade β and hands the socket to the same room manager. One process, in-memory bus, no external services.realtime/holds transport-agnostic rooms and the authoritative 30 Hz sim, which runs inside the host's connection.
Vercel functions are not a game server, and the design has to absorb that:
- Every socket dies. Invocations cap at
maxDuration(300 s). Clients auto-reconnect: the host sendshello-host {resume:{room}}to restore its room, controllers re-join with their seattokenand get the same chef β name, colour, and whatever they were holding. - There is no instance affinity. A reconnect can land anywhere. The room
registry, roster, and the latest sim snapshot persist to Redis, snapshots
are checkpointed ~1/s, and a resumed host rebuilds the
Gamefrom the checkpoint mid-round β the clock never rewinds. - A phone can land on a different instance than its host. Those controllers relay input and output over Redis pub/sub.
- Two instances must never tick one kitchen. An ownership lease decides which instance runs a room's sim, and hands over on host reconnect.
Redis comes from REDIS_URL or KV_URL (for example Upstash from the Vercel
Marketplace). Without it β local and LAN play β an in-memory registry and bus
do the same job in a single process.
game/game.ts+shared/levels/β the pure simulation and the level catalogue. No I/O.components/host/β the TV view: canvas kitchen, snapshot interpolation, QR lobby.components/controller/β the phone gamepad: pointer-events joystick, haptics, wake lock, auto-reconnect.shared/types.ts+shared/protocol.tsβ the frozen wire contract.
The kitchen, the chefs, and every ingredient are drawn in code on a
<canvas>. There are no game sprites on disk.
npm install
npm run dev # custom Next dev server on :3000 (HMR + websockets)
npm run typecheck # tsc --noEmit, strict
npm test # node:test β sim rules, levels, room protocol
npm run build # next buildAdd ?debug to the host URL for tile coordinates.
Levels are data. To add one, open the world's file in
shared/levels/worlds/, copy a level entry, draw the room in ASCII (legend in
SPEC.md; @ is a spawn) and list the dishes it serves:
{
id: 'home-4',
name: 'Late supper',
rows: ['#O#S#S#B#', '#.......#', '#.@...@.#', ...],
menu: ['onion-soup', 'side-salad'],
orderMs: 50_000, // every tuning field is optional
}A new world is a new file exporting a WorldDef β a name, a tagline, a
WorldTheme (palette plus one of the renderer's motif ids) and its levels β
plus one line in WORLDS in shared/levels/index.ts. npm test then parses
your map, refuses it if a station is walled off or the menu cannot be cooked
in it, and drives a chef through a whole ticket to make sure it can be
played.
npm run smoke is the end-to-end test: it drives a running server over
real WebSockets as one host and three phones, and checks the lobby, join
errors, malformed input, start, snapshots, movement, orders, controller seat
reclaim, and host resume. It never starts a server itself.
npm run dev # in one shell
npm run smoke # in another
PORT=3123 npm run smoke # a server on another port
WS_URL=wss://opencooked.vercel.app/api/ws npm run smoke # against prodTo exercise the multi-instance path β bus relay plus the ownership handover a
Vercel host reconnect causes β run two processes sharing one Redis and
point the smoke test at both. Use npm start, not npm run dev: Next allows
only one dev server per project.
docker run -d --rm -p 6379:6379 redis:7-alpine
npm run build
export REDIS_URL=redis://localhost:6379
PORT=3131 npm start &
PORT=3132 npm start &
PORT=3131 CROSS_PORTS=3131,3132 npm run smokeCI runs typecheck, build, and the single-process smoke test on every push and pull request.
Issues and pull requests are welcome β see CONTRIBUTING.md for setup, the smoke-test bar for realtime changes, and the rules of the wire contract.
MIT Β© 2026 Aaron Levin.
Opencooked is an original open-source game, inspired by the co-op cooking genre and built for fun. It is not affiliated with, endorsed by, or associated with Ghost Town Games or Team17, the creators and publisher of Overcooked. It contains no assets from any commercial game β every tile, chef, and ingredient is original art drawn in code on an HTML canvas. Overcooked and all related trademarks belong to their respective owners.