Zero Game app icon with a black spade on a green radial background.

Project icon from the public repo. The interesting artifact is the room model behind it: a small game whose rules need one shared source of truth.

Game Shape

Zero Game is a trick-taking game built around prediction. Each round, players bid how many tricks they expect to win. A correct bid scores 10 + bid; an incorrect bid scores nothing.

Rounds shrink as the game progresses. With five players, the deal goes from five cards to four, then three, two, and one. Trump comes from the top card of the remaining deck, and the dealer bids last under the hook rule: they cannot make the total bids equal the number of tricks available.

System

Browser clients -> Next.js UI -> Worker route -> GameRoom Durable Object -> native WebSockets

OpenNext builds the Next.js app for Cloudflare; a custom entry script connects assets, routes, and the Durable Object room boundary.

The repo keeps the rule logic, WebSocket protocol, room state, and React UI separate enough that the game can stay understandable. The important boundary is the room: every player sees the same bids, cards, tricks, scores, and turn state because that state is owned in one place.

What It Proves

  1. Realtime state Multiplayer games punish ambiguous ownership. The room needs to be the authority for bids, legal plays, trick winners, and scoring. Optimistic UI can help the interface feel fast, but the rules cannot live only in the client.
  2. Rule modeling Small card games still have real state machines. Follow-suit enforcement, trump resolution, dealer rotation, shrinking hands, and the hook rule all create edge cases that are easier to reason about when they are explicit.
  3. Deployment shape Cloudflare's primitives fit room-based realtime apps. Workers handle the edge entry point, Durable Objects give each room a natural home, and WebSockets keep the table synchronized without adding a separate server fleet.

Tradeoffs

This is a public game repo, not a polished product claim. Multiplayer code earns trust slowly: reconnection behavior, strange bidding sequences, latency, and browser edge cases matter. The current artifact is useful because it shows the system shape and the game rules in code.