Image 1 of 2: Liar's Dice in two browser windows, one per player, after a Liar call reveals the dice
A backend for multiplayer turn-based games on Pekko typed actors: accounts, lobbies, rematches, server-side move validation, per-turn timeouts, AI bots and fog-of-war views pushed over WebSockets, with Postgres, a Redis cache, Prometheus metrics and eight games from Tic-Tac-Toe to Texas Hold 'Em.
Trade-offs
- One actor per match serializes its moves, so concurrent requests can't corrupt state, with no locks or shared mutable state.
- Snapshot writes are fire-and-forget: a move's latency is never gated on Postgres, at the risk of losing the newest move in a crash.
- It runs as one instance today; actor boundaries are drawn so Pekko Cluster Sharding can spread games across nodes later.
Q&A4
A game actor never ships raw state. Every reply and push is rendered per viewer through a GameStateView type class, so players see their own hand and spectators a fog-of-war view.
GameManager restores games and lobbies asynchronously, stashing incoming messages until the restore finishes, then replays them against the recovered state.
A pure Game model, a one-line actor binding on the shared turn-based actor, a small module with decoder and view, and one case in the registry; routing, persistence and delivery pick it up.
Actors publish domain events to a Redis channel that a separate consumer folds into Prometheus metrics, keyed only on game type and outcome to keep cardinality low.
Links
Built by
Reviews
Loading reviews
More in Scala
More in Game dev
See all 22 →
Rigby2DOpen-source 2D skeletal animation editor for games and film- Raising HellA Tamagotchi-style virtual pet game for the M5Stack Cardputer ADV
WhimTexA sprite and texture editor inside Unity, with layers that stay editable
GodotMakerAgent workflow that turns a game idea into a tested Godot project
CSG_BlockoutLevel blockout in Godot with native CSG nodes, from drawn rooms to playtest
SculptForgeOpen-source digital sculpting app for Linux, macOS and Windows
More in Distributed systems
See all 20 →
arbiterPostgreSQL job queue for Haskell, with no broker and no leader- RRQClosed-loop payment ledger on sharded Postgres with a Kafka outbox
RuvioRust key-value server that speaks RESP, with locks and queues as commands
EgresPostgres-compatible database in Zig for heavy, multi-tenant workloads- clinkC++ stream processing engine that stays correct when processes die
- pg-statusSidecar that reports PostgreSQL master, replicas and replication lag