Project / public game repo
Zero Game
A real-time multiplayer card game for 3-7 players: predict how many tricks you will win, score only when the bid is right, and keep a shared room moving over WebSockets.
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
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
- 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.
- 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.
- 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.