Skip to content

0001 — Procedural galaxy as a pure function ​

Date: 2026-11-09 · Status: accepted

Context ​

Galaxy is an eternal, procedurally generated Milky-Way-scale universe: hundreds of billions of stars, no player or alliance ever finishes it, scarcity is local and never global (GAME-DESIGN.md §1, §2, pillar 1). It must be designed so the backend can reach millions of players (AGENTS.md §3).

Any design that materialises the map fails on size alone. A stored star is storage plus upkeep, a generation step, a world-size cap, and a migration every time the galaxy grows (GAME-DESIGN.md §4.1).

Decision ​

The galaxy is a pure function: galaxy(seed, coordinates) → star, planets, resources. Deterministic, no I/O, no state. Nothing about an untouched system is stored anywhere; the database holds only deltas — what players discovered, claimed, built, mined out or destroyed (ARCHITECTURE.md §1.1).

The same function must produce bit-identical results on client and server, which is why there is exactly one implementation, in the shared core package (ARCHITECTURE.md §1.1, §4). The generator is explicitly versioned, because changing it changes the universe; freeze v1 for existing regions and generate new space with v2 is the assumed migration story (ARCHITECTURE.md §4, §7).

Consequences ​

  • Universe storage is zero regardless of size. Unexplored space costs nothing to keep.
  • No world-generation step, no size cap, no migration when the galaxy grows.
  • A client can generate and render any region locally from the seed; the server ships only deltas and the things it is willing to reveal (ARCHITECTURE.md §1.1, §5).
  • Determinism becomes a correctness property: the generator is exhaustively tested for it, and a change to it is a universe change (ARCHITECTURE.md §4).
  • Whether the client ships the generator or asks the server is still open, leaning ship it: the seed-to-star mapping is not the secret, ownership is (ARCHITECTURE.md §7).

Alternatives rejected ​

  • A pre-generated, stored universe. Costs storage and upkeep for hundreds of billions of stars, needs a generation step and a world size cap, and requires a migration each time we grow (GAME-DESIGN.md §4.1).
  • A bounded, hand-authored galaxy. Contradicts pillar 1: the galaxy must be bigger than everyone, and "too big to seize" has to be literally true rather than a balance number (GAME-DESIGN.md §2, pillar 1, and §4.1).

Galaxy design documentation. Nothing here is implemented yet.