Strategy Empire
A browser strategy MMO with a deterministic combat engine kept apart from the network layer.
Context & problem
A persistent world where players build villages, train armies, research technologies and fight each other has to answer the same question in two places at once: what happened in that battle. If the server and the client can disagree about it, the game is unarguable. The combat simulator is therefore deterministic — three phases per round, the same inputs giving the same result anywhere it runs — and it lives in its own package with no knowledge of the transport that carried the request to it.
Role
Sole developer.
Constraints
- Real-time state for many players at once, over WebSockets.
- Long-running world processes — production, movement, research — that must survive a restart.
- A world that keeps running whether or not anyone is watching it.
Decisions & why
- The game engine is a package, not part of the server.
- Combat, formulas, heroes and research have nothing to do with sockets. Separated, they can be tested exhaustively without standing a server up, and the determinism is provable rather than hoped for.
- Scheduled world work goes to a job queue on Redis rather than into the game loop.
- A tick that also has to do bookkeeping is a tick that stalls under load.
- Its own metrics pipeline, and load tests, from the start.
- A multiplayer server that is only measured after it breaks has already broken for everyone at once.
Stack
- SvelteKit 5
- Colyseus
- Hono
- TypeScript
- PostgreSQL 16
- Drizzle
- Redis 7
- BullMQ
- Prometheus
- Grafana
- Turborepo