Sector: Web app · Personal project · Period: 2026
Turn-based multiplayer strategy game
Web app for playing a turn-based strategy game online with friends and bots: real-time rooms over WebSocket, a TypeScript game engine and AI opponents up to Monte Carlo search, all on Cloudflare.
- Real time
- Multiplayer
- 3
- Bot levels
- 0
- Servers to manage
Context
A personal project started to play a turn-based conquest game online with friends: a map of territories, dice, reinforcements, cards and secret objectives. It became a testbed for three themes that keep coming back in client work: real-time shared state, complex domain logic and near-zero infrastructure costs.
What it does
- Accounts with protected passwords (PBKDF2) and signed sessions.
- Rooms configured by their creator: password, number of bots at the table, rule variants, dice rolled by the server or rolled live and entered by the players (validated server-side).
- Interactive SVG map, chat and real-time battle announcements.
- Bots at three difficulty levels, which can be mixed in the same game.
- Admin panel, game history and replays.
Technical challenges
Real-time shared state. Each room is a Cloudflare Durable Object: a single instance owns the game state and broadcasts it to players over WebSocket, so concurrent moves never conflict and there is no server to manage.
A pure game engine. The rules live in a dependency-free TypeScript package with its own tests: the same code validates moves on the server and powers the bots’ simulations.
Bots that think. The intermediate level uses heuristics and exact battle-odds calculation; the hard level uses Monte Carlo Tree Search (MCTS) with determinization of hidden information, calibrated by having the bots play against each other.
A single deploy. One Worker serves the page, the REST API and the WebSockets; accounts and games live on D1. A scheduled cleanup removes abandoned rooms and compresses the longest replays.
The game is live at risiko.avren.it, invite-only.
Stack
TypeScript · React · Vite · Cloudflare Workers · Durable Objects · D1 · WebSocket