Personal Project · July 2026 · Full-stack real-time multiplayer

Texas Hold'em — Discord Activity

Multiplayer no-limit Texas Hold'em that runs inside Discord as an embedded Discord Activity, with a browser mode for testing: a server-authoritative game engine, real-time WebSocket networking and a hand-drawn canvas table.

  • JavaScript
  • WebSockets
  • Node.js
  • Canvas
  • Discord SDK
  • Real-time
One hand, from the deal to the showdown, recorded from the game's canvas with three players connected.

The idea

A full no-limit hold'em game you launch inside a Discord voice channel. It handles the rules a real table needs (blinds and blind timers, all-ins, side and split pots, minimum raises, refunds of uncalled bets, re-entries and add-ons) and draws them with dealing animations, chip stacks that match their denominations, showdown flips and live all-in win odds.

At a glance

Project
Personal, July 2026
Runs in
A Discord voice channel, with a browser mode for testing
Server
Node.js, Express and ws
Client
Vite and vanilla JavaScript, canvas renderer
Tested
150-hand chip-conservation fuzz test

The design decision everything else rests on is that the game is server-authoritative. The Node backend runs the state machine and deals from a cryptographically secure shuffle, and clients only display what they are sent. No client receives another player's hole cards before showdown, because the server filters cards and equity data for each recipient rather than hiding them in the client.

Play it

> Play against bots

The game's own engine and table, running in this tab against bots instead of friends on Discord.

Each bot only sees what a remote player would be sent, so it can't see your cards either.

At the table

Live poker table — flop, pot, and chip stacks
Three players on the flop; everything on the table is drawn on canvas.
Full community board at showdown
A full five-card board through to the river.
Texas Hold'em Discord Activity cover art
The Activity's cover art.

What each client is told

A client sends intent, never state. Identity is checked on the server too: after the OAuth exchange it confirms the user with Discord and issues a session token bound to that user id, so a client cannot pose as another player.

Alice's client Game server Bob's client knows: A♠ K♠ · Bob: ? ? knows: 9♦ 9♣ · Alice: ? ? { t: "action", data: { kind: "call" } } table.act() whose turn · amount · pots state · you.cards = A♠ K♠ state · you.cards = 9♦ 9♣ publicState(userId): one message per player Bob's cards: never sent Alice's cards: never sent showdown: winners + both hands showdown: winners + both hands

Step through one action: each player gets a message with only their own cards, so a modified client has nothing extra to read.

How it's built

The client is Vite and vanilla JavaScript with no framework: a custom canvas renderer for the table (dealing, chips, card flips, pot pushes), the Discord Embedded App SDK and a WebSocket client. The server is Node.js (Express and ws) with an OAuth token-exchange endpoint, one table per Discord Activity instance, a game-state machine for blinds, timers, votes and stats, and a 7-card hand evaluator.

During all-in run-outs the server computes each player's win percentage by Monte Carlo simulation, and the remaining cards are revealed slowly. The single-player table on this page runs the same engine and room code in the browser: an in-page channel replaces the WebSocket, and equity-based bots take the other seats.

Try the odds

> Poker equity

The game's own hand evaluator and Monte Carlo estimator, in your browser: pick your cards and opponents, and it deals a few thousand random run-outs to estimate how often you win.

Your hand
Board
win—
tie—
hand—

Keeping the chips honest

Side pots, split pots and refunds all have to reconcile to the chip. The engine has an automated test suite covering the hand evaluator, betting flow, side and split pots, and re-entry and add-on accounting, plus a 150-hand fuzz test that checks chip conservation: across random hands, no chips are created or lost. WebSocket payloads are capped and every input is validated on the server.

What I took from it

Keep secrets where the client can't reach them. Hiding cards in the client only stops honest players; building each player's message on the server leaves a modified client nothing to find.

Test the invariant, not just the cases. My tests cover the side pots I thought of; the fuzz test covers the rest by checking one rule after every hand: the chips add up. And keeping the rules apart from the transport paid off later, when the table on this page needed only an in-page channel and some bots, not a second copy of the game.

Where it goes next

The bots come first, and that work is under way. Today's bots play by equity. I'm now training deep reinforcement-learning agents on my GPU in a league of their own: tables of two to ten, no scripted opponents, and antagonists that keep resetting to hunt for each agent's weaknesses. The goal is bots that bluff and call bluffs for real reasons, with hands captured along the way so I can replay what they learned. The other direction is a solver and trainer: counterfactual regret minimization from toy games up to push/fold charts and river spots, plugged into the engine as a bot or a post-hand review.

Want the details behind this one, or to talk about similar work?