5 minutes
Multiplayer Poker Without a Server
The single-player table you finished works well, but only for one person. The easy fix is a game server: it would hold the deck, shuffle it, and tell each browser what it can see. We're not building that. With no referee in the middle, how do four browsers agree on a shuffled deck?
A mesh of browsers, not a server
Picture four browsers wired straight to each other. This is a peer mesh: every browser is equal, and no host owns the truth. The only thing that crosses a wire is intent — "seat 2 folds," or "deal the next hand." The cards are never sent. Each browser builds the deck itself, running the same shuffle from the same seed, so all four end up with the same 52 cards in the same order. Someone could still try to cheat by tampering, and that matters in production, but agreement here comes from deterministic math rather than a trusted authority.

This lesson adds no entities to your scene. It's a pure module: plain functions over numbers and strings, importing neither Babylon nor the DOM nor the network — so every peer gets the same result, and you can test it without a second machine.
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.