A deterministic geopolitical simulation
Procedurally generated worlds that are the same on every machine, and (soon) nations that rise and fall on them.
What it is · Getting started · Controls · How it is built · Roadmap · Contributing
Sovereign is heading toward a deep grand-strategy simulation: individual rulers, generals and governors, populations with cultures and religions, economies, diplomacy and war, all running on a world whose entire history can be reproduced from a seed. You will start as an observer with god tools; playing a nation comes later.
Today it generates and shows the world, and spawns the nations. Nothing simulates yet: that is the next phase, and it is built on the foundation below on purpose.
- 2 000 x 2 000 tile maps with elevation, temperature, humidity, biome, river, resource and ownership for every tile
- 26 biomes, from deep ocean and glaciers to rainforest and volcanic peaks, with organic boundaries
- Rivers that follow noise zero-crossings: primary and secondary waterways, tapered at the shore
- 22 resources in two slots per tile (surface and ground), placed by geology and ecology rather than noise: timber, grain, pasture, horses, fur, cotton, spices, wine, tea, ivory, stone, iron, copper, coal, oil, gold, silver, salt, gems, fish, pearls and whales. Metals follow ridges, oil and coal sit in basins, whole landmasses can lack some, and stocks can be drawn down (minerals for good, the renewable ones grow back)
- A route network between the best places to live, and strategic locations read off it: the passes, fords, straits and land necks its routes have to go through, scored 1 to 10 by how much traffic needs them
- Nations: 12 placed on the best sites, each growing a starting territory over the terrain (borders follow mountains and rivers); its stats, government and personality are computed from what its land is like, not rolled
| Key | Overlay | Shows |
|---|---|---|
E |
Elevation | Height (blue, green, brown, white) |
T |
Temperature | Heat (blue to red) |
H |
Humidity | Moisture (tan to teal) |
B |
Biome | The 26-biome palette (default) |
G |
Strategic | Routes, and the passes, fords, straits and necks on them |
R |
Resource | Biome plus resource deposits |
P |
Political | Territory colours and borders |
Click a nation's territory for its panel; the tile inspector (I) describes whatever is under the cursor, including what each of its two resource slots holds and how much is left. In the resource view a legend lists all 22 resources by tier; pick one to see only where it is (a heat map), or "All resources" to see each tile's dominant one.
The same seed and config give the same world byte for byte, in the browser, in Node and on the command line, on Linux and Windows. That is what makes seeds shareable, runs replayable and balance work possible. The engine therefore uses its own PRNG, its own noise and its own ln/exp/pow instead of the platform's, has no third-party runtime dependencies, and is checked by golden hashes in CI. See docs/simulation/determinism.md.
pnpm sim -- --seed 1337 # prints a 128-bit hash of the world- Web: a static build on GitHub Pages
- Desktop: an Electron app (Windows, macOS, Linux) that loads the same web build
- Headless:
pnpm sim, the simulator CLI, which needs no browser at all
You need Node 22+ and pnpm 10 (corepack enable).
git clone https://github.com/CodeByBryant/Sovereign.git
cd Sovereign
pnpm installpnpm dev # the web app on the Vite dev server
pnpm desktop # builds the web app, then opens the Electron app
pnpm sim -- --seed 1337 --summarypnpm check # typecheck, lint, fast tests
pnpm test:determinism # golden hashes and bit-exact math
pnpm buildEverything else (test layout, CI, measured performance) is in docs/development.md.
| Mouse and keyboard | Action |
|---|---|
| Click and drag | Pan the camera |
| Scroll wheel | Zoom in and out |
E T H B G R P |
Switch overlay |
| Click a nation | Open its panel |
Esc |
Close the nation panel |
I |
Toggle the tile inspector |
S |
Toggle the toolbar |
| Touch | Action |
|---|---|
| One finger drag | Pan the camera |
| Two finger pinch | Zoom in and out (a two finger drag pans too) |
| Tap a nation | Open its panel (a bottom sheet on a phone); tap the close button to dismiss |
| Tap anywhere | Show that tile in the tile inspector (a phone has no hover) |
Toolbar + and - |
Zoom in and out; they also work with a mouse |
On a phone the toolbar wraps and the panels become bottom sheets. Every button is at least 44 px, and the map respects notches and rounded corners (safe areas).
--------------------------- | ------------------------- |
| Click and drag | Pan the camera |
| Scroll wheel | Zoom in and out |
| E T H B G R P | Switch overlay |
| Click a nation | Open its panel |
| Esc | Close the nation panel |
| I | Toggle the tile inspector |
| S | Toggle the toolbar |
A pnpm workspace in which the simulation engine is a headless library and everything else is a client of it. The dependency rules are enforced by a lint check, not by convention.
packages/
contracts/ shared types; depends on nothing
config/ the typed world configuration
simulation/ the deterministic engine: RNG, math, noise, terrain, nations, hash, saves, World
renderer/ camera and palettes (pure) and the PixiJS map renderer
ui/ React components and styles
apps/
web/ the browser app: engine in a Web Worker, IndexedDB saves
desktop/ the Electron shell
simulator-cli/ the headless runner
tools/ dependency-rule check, CI scoping, Pages artifact check
docs/ architecture, ADRs, the determinism spec, roadmap
Start with docs/architecture.md; docs/README.md indexes the rest.
The restructure is done: workspace, deterministic engine, PixiJS renderer, apps and CI. Next:
- Provinces and borders: a province graph, expansion, natural borders, time controls
- People and economy: pops, production, trade, notables
- AI and diplomacy, then warfare, then culture and events
- God mode and observability: every intervention a logged, deterministic command; replays
- Scale and 1.0; later, play a nation
Details, exit criteria and the decisions behind them: docs/roadmap.md.
Contributions are welcome. Read CONTRIBUTING.md: it is short, and the one rule that matters is that the same seed must give the same world everywhere.
MIT. Copyright (c) 2026 Bryant Ejorh.