npm install && npm run dev # single-player, http://localhost:3000
npm run build && npm run preview # production build (installable PWA), :4173
npm run dev:server # multiplayer only, HTTP :8787 / WS :8788
npm run dev:local # Postgres in Docker + server + web on the hostNew here? Running Civ1 Browser covers prerequisites, ports, the PWA install/offline walkthrough, the container stack, every test command and troubleshooting.
The repo is an npm workspace with three packages:
-
packages/shared/— headless simulation:GameEngine, turn/AI managers, map generator, balance data, types and i18n. Imported by both other packages; no DOM, React or wall-clock dependencies (seeports/runtime.ts). -
packages/server/— authoritative rooms: lobby→settings, command validation, save store, signed seat tokens, fog filtering, room lifecycle and HTTP/SSE + WebSocket transports. -
packages/web/— React/Vite client: components, rendering, stores, styles and the transport seam (session.ts,remoteSession.ts,remoteEvents.ts,remoteGame.ts).
Root-level tests/, scripts/, e2e/ and tools/ stay where they are. Vite serves packages/web with public/ from the repo root; npm test, npm run type-check and npm run build all run from the repo root.
For the full implementation status — completed work, verification results, open limitations and concrete next steps — see Server/Client Split Status Report.
Games that need no other players — single player, hotseat and the AI-vs-AI spectator scenarios — run entirely in the browser. The same is true of the installed PWA: install it once and it keeps working with the network off.
The plan, the rationale and the implementation status are in Offline Play & PWA — Implementation Plan.
-
One engine, one codebase. The simulation lives in
packages/sharedand already runs in the tab for single-player; the server runs the same class for authoritative rooms. Offline play therefore needs no second copy of the game and no second build —npm run buildproduces one artifact that is served online and installed offline. -
One save format. The V5 save blob is what the browser stores, what the file export writes, what the file import reads and what the server persists. A campaign saved offline can be uploaded to a room later.
-
The shell is cached, the artwork is fetched on demand. The service worker precaches the document, the JavaScript, the stylesheet and the fonts (~5 MB). Tiles, music, sound effects and wonder art (38 MB) are cached the first time you meet them.
-
Serve the production build over HTTPS (or
http://localhost). -
Open it in Chrome, Edge or Safari and use the browser’s Install action (Chrome: the install icon in the address bar).
-
Launch it from the desktop. It works with the network off.
The manifest lives at public/manifest.webmanifest, the icons at
public/icons/ (regenerate with python3 tools/pwa/generate_icons.py), and
the service worker is generated into dist/sw.js at build time by
packages/web/pwa/vite-plugin-pwa.mjs. The worker is registered in
production builds only — npm run dev is untouched.
The step-by-step walkthrough (build, serve, install, cut the network, verify the caches) is in Running Civ1 Browser ▸ Running it as an installed PWA.
Campaigns are stored on the device in IndexedDB (civ1 → campaigns), with a
localStorage fallback for browsers that block IndexedDB. The engine’s own
two slots (civ1_savegame, civ1_autosave) live in the same library; a
legacy localStorage save is migrated on the first launch and is never
deleted before its copy is safely stored.
-
GAME ▸ Save Gamewrites the manual slot and downloads a.jsonfile. -
GAME ▸ Load Gamereads a file and adds it to the library. -
GAME ▸ Campaignsopens the library: continue, export, delete, import. -
Ctrl+S/Ctrl+Lsave and load the manual slot.
Saves are managed only from inside a running game (GAME menu and shortcuts); the pre-game wizard has no campaign library or "continue" card.
A deliberate save is written to the device immediately; the end-of-turn autosave is debounced. Nothing is pending when the tab is closed.
A multiplayer room still needs the server. When the connection drops the client keeps the existing reconnect logic, waits for the browser to report the network back, and shows a Reconnecting banner instead of silently dropping commands. A single-player game is never affected.
There is one central authoritative server for all players. No LAN parties,
no host discovery and no server selection in the UI: the deployed web client
reads the one server URL from /config.js at start-up, and players only create
a table and share invitations. The commands below are for developing and
running that single central server.
Start the authoritative server locally for development:
npm run dev:server
# HTTP :8787 (commands, SSE events, state), WS :8788, SQLite DB ./server.db
# Override with PORT, WS_PORT, GAME_SERVER_SECRET, DB_FILEFor development against a real Postgres, one command starts everything:
npm run dev:local
# Postgres in Docker (:5433), server (:8787/:8788) and Vite (:3000) on the host
# credentials from .env (copied from .env.example on first run)
# Ctrl-C stops the app, Postgres keeps running; --stop-postgres stops it tooOnly the database is containerised: the client hot-reloads and the server is
debuggable as a normal host process. No K3s needed for this loop; the K3s
cluster is the deployment test rig (npm run test:k3s). Full details:
Running Civ1 Browser — Local development.
Then either open http://localhost:3000/?lobby to use the in-app lobby (choose seats and difficulty, then copy one invitation per seat), or create/join through the HTTP API directly. The server URL, room ID and signed tokens are discovered automatically and kept out of the player-facing UI — they remain available under Connection details (advanced) in the lobby:
curl -X POST localhost:8787/rooms -H 'content-type: application/json' -d '{"seed":42,"numberOfCivilizations":2}'
# -> {"ok":true,"id":"room_1","token":"<host token for seat 0>"}
curl -X POST localhost:8787/rooms/room_1/seats -H 'content-type: application/json' \
-d '{"token":"<host token>","seats":[0,1]}'
# -> {"ok":true,"tokens":{"0":"...","1":"..."}}Open the client with ?server=http://localhost:8787&room=room_1&token=<seat token>. The client runs a read-only mirror engine fed by /rooms/:id/state; every command goes through sendCommand() to the server, so the authority remains the only simulation. Single-player (no ?server parameter) still uses the in-tab engine unchanged.
Architecture diagrams (xdot-readable Graphviz DOT): doc/diagrams/README.adoc.
Secrets are never committed: copy .env.example to .env for compose, and create the two K3s secrets in the cluster with the commands in k8s/secrets.example.yaml. Run npm run check:secrets to verify no credentials leaked into manifests.
Local full stack (Postgres + two server workers + web):
docker compose build
docker compose up -d
curl http://localhost:8787/health
curl -o /dev/null -w '%{http_code}' http://localhost:3000/
docker compose downSingle-node K3s test cluster (K3s runs in a privileged Docker container because passwordless sudo is not available on the dev machine):
docker run -d --privileged --name civ1-k3s -p 6443:6443 -p 30080:30080 \
-p 30787:30787 -p 30788:30788 rancher/k3s:v1.31.4-k3s1 server \
--disable=servicelb --write-kubeconfig-mode 644
docker cp civ1-k3s:/etc/rancher/k3s/k3s.yaml /tmp/opencode/k3s.yaml
docker tag civ1browser-server civ1browser-server:local
docker tag civ1browser-web civ1browser-web:local
docker save civ1browser-server:local | docker exec -i civ1-k3s ctr -n k8s.io images import -
docker save civ1browser-web:local | docker exec -i civ1-k3s ctr -n k8s.io images import -
KUBECONFIG=/tmp/opencode/k3s.yaml kubectl apply -k k8s
KUBECONFIG=/tmp/opencode/k3s.yaml kubectl get pods -n civ1
curl http://localhost:30787/health
curl -o /dev/null -w '%{http_code}' http://localhost:30080/The K3s Postgres is a StatefulSet with a PVC; a nightly pg_dump CronJob writes to the civ1-backups PVC. Restore with:
KUBECONFIG=/tmp/opencode/k3s.yaml kubectl -n civ1 exec deploy/civ1-postgres -- \
sh -c 'pg_restore -U civ1 -d civ1 /backups/<dump-file>'Run the browser end-to-end test against either stack:
# local compose (browser on :3000, server on :8787)
npx playwright test e2e/multiplayer.spec.ts
# K3s NodePorts
CIV1_SERVER=http://localhost:30787 CIV1_WEB=http://localhost:30080/ \
npx playwright test e2e/multiplayer.spec.tsThe self-contained cluster can be rebuilt with one command (it uses alternate ports so it coexists with a host K3s):
bash scripts/setup-k3s-test.sh
# API :16443 | web :31080 | server :31787 / WS :31788playwright.k3s.config.ts targets the K3s NodePorts and writes a screenshot of every significant step to ~/Desktop/civ1-k3s-screenshots (created automatically). It covers the full chain (lobby → two seats → command → Postgres → metrics/ready) plus real UI interactions (rates modal, research panel, end turn):
# test K3s cluster on alternate ports (host K3s owns 6443/30787)
CIV1_SERVER=http://localhost:31787 CIV1_WEB=http://localhost:31080 npm run test:k3s
# screenshots: ~/Desktop/civ1-k3s-screenshots/01-*.png ... 09-*.pngThe same suite also runs through the Traefik HTTPS ingress (self-signed cert, civ1.local resolved via Chromium’s host-resolver rule — no /etc/hosts change needed):
CIV1_TLS=1 CIV1_SERVER=https://civ1.local:30443/api \
CIV1_WEB=https://civ1.local:30443 CIV1_API=http://localhost:31787 \
npx playwright test --config playwright.k3s.config.tsOverride the folder with CIV1_SCREENSHOTS=/path/to/folder. The suite surfaced a pre-existing issue: generated unit sprites and terrain variants (/assets/units/unit_*.png, /assets/tiles/terrain_*_*.png) are absent in both compose and K3s (about 160 harmless 404s — the client falls back to SVG/emoji and colour tiles). Running npm run tiles:install with a generated set removes them.
Full verification results, the bugs found while testing multi-worker mode, and project-specific follow-up prompts are in Deployment verification and gaps.
Overall Assessment
Zivilisation_1 is not a perfect clone, but it is not trying to be one.
It is a spiritual successor that takes the core concepts of Civilisation and reimagines them for a modern audience.
For players seeking a nostalgic Civilization-like experience in the browser, it delivers!
For purists seeking a 1:1 recreation of the 1991 original, it falls short in several areas but therefore it introduces more strategic depth, more strategy and a non-cheating AI.
The implementation is technically impressive (TypeScript, React, Vite, comprehensive tests, data-driven design) and functionally complete (the game is winnable and playable).
The developers should be commended for creating a sophisticated strategy game that honors its inspiration while making sensible modernizations.
- Gameplay
-
-
14 civilizations with leaders, portraits and city-name lists
-
City founding, joining, capture, destruction, razing, governors, specialists
-
Growth, starvation, granaries, disorder, martial law
-
36 units across land, sea, air and civilian, with stacking, GoTo, sleep/fortify/skip/wait
-
54 technologies (8 available at the start) with map-size and difficulty cost scaling
-
Six governments (Despotism through Democracy, plus Anarchy), revolutions, capital relocation
-
Diplomacy: war, peace, ceasefires, alliances, six treaty types, bribes, tech exchange
-
Fixed alliances — optional permanent teams with locked diplomacy, team-wide war/peace, team victory and human spectating
-
Nomads — three historical factions (Bedouin, Mongol, Sámi) that travel from court to court and parley with whoever they meet
-
The Chronicle — full-screen illustrated story cards for the game’s big moments
-
Seven city disasters with prevention rules
-
Trade routes, ferries with cargo, Fisher Boats and fishing nets
-
Barbarians, goody huts, tile improvements, pollution
-
Fog of war with per-player visibility and cross-turn scout memory
-
Hot-seat play — several humans at one machine, with a handoff screen
-
Two victory conditions: Moonshot and elimination
-
24 world wonders with a data-driven effect model
-
- Systems
-
-
Save/load — versioned JSON (v5) with v1–v5 migration, file download/upload and an autosave every turn
-
Full AI: 6 production profiles, strategy selection, research, government, diplomacy, army groups, naval doctrine, city governor, auto-production
-
Headless batch runners and a progression export (JSON + compact CSV)
-
13 map types, including 3 static maps and 3 unattended AI-vs-AI scenarios
-
Localized UI in 6 languages (EN/DE/FR/RU/ES/JA), type-checked keys
-
Animated movement, combat, camera glides, death
-
Minimap, tech tree, statistics, demographics, settings, game menu
-
URL parameters for reproducible, unattended runs
-
The UI never calls the engine directly. Every player intent is a Command
(types/commands.ts) sent through a GameSession (src/utils/session.ts) to
GameEngine.submit(command, context), which validates whose turn it is and
who owns the subject before delegating to the rules engine. Rejections are
typed values (NOT_YOUR_TURN, NOT_YOUR_UNIT, …), never silent.
This is the seam that will carry the planned client/server split: a remote session implements the same interface over a socket, and the UI does not change.
-
Per-civ doctrines — Leader Doctrines
-
AI governor rebuild — AI Governor Architecture
Neither is implemented. Choosing a civilization currently changes only your colour, portrait and city-name list.
Code |
~125,000 lines TypeScript/TSX across ~200 files |
Engine |
|
AI |
31 files, ~25,600 lines ( |
Rendering |
6 files, ~4,900 lines (two-layer canvas) |
Tests |
247 Vitest suites, 2,929 cases, node environment (no DOM) |
Browser tests |
6 Playwright specs |
Balance data |
20 modules in |
src/
├── components/ # React UI
│ ├── game/ # GameCanvas, unit stack / action modals
│ └── ui/ # TopBar, SidePanel, dialogs (gamemodals/)
├── data/ # Every balance number: terrains, units, buildings,
│ │ # techs (54), governments, improvements, wonders (24)
│ └── maps/ # Static Freeciv-derived maps + registry
├── game/
│ ├── engine/ # GameEngine + turn/economy/combat/diplomacy/AI
│ │ ├── AI/ # ~25,600 lines over 31 files
│ │ ├── diplomacy/ # Opinion ledger, proposal scoring
│ │ ├── nomad/ # The nomads: contact visit, parley, strategy, economy (README inside)
│ │ └── MapGenerator/# Procedural world generation
│ └── rendering/ # Canvas layers, minimap, textures, animation
├── hooks/ # useGameEngine: engine ↔ React wiring
├── i18n/ # 6 languages, type-checked keys, language switcher
├── stores/ # GameStore.ts — one Zustand store
├── utils/ # session (command layer), event handlers, export, log
└── styles/ # 31 CSS files
types/ # game.ts, progression.ts, commands.ts — shared types
tests/ e2e/ scripts/ # Vitest (node env), Playwright, headless runners
doc/ # Subsystem documentation — index belowFour files near the root of src/game/ (City.ts, Unit.ts, Terrain.ts,
Civilization.ts, ~2,500 lines) are legacy classes that nothing imports. The
runtime uses the interfaces in types/game.ts and the src/data/ tables. Do
not add rules there.
| File | Responsibility |
|---|---|
|
World state and the public API: grid, units, cities, civilizations, techs,
per-player storage, ID counter. Emits every change through one
|
|
The phased turn engine: |
|
The computer player. |
|
The single place a battle is resolved. See combat below. |
|
Yields, corruption, rates, food, growth, happiness, upkeep, bankruptcy. |
|
Build queues, tech gating, and the auto-production governor the AI and the player share. |
|
Opinion ledger, proposals, treaties, war declaration rules. |
|
Continents → temperature → climate → age → rivers → polar caps → resources. |
|
A cached static terrain layer, a dynamic unit/city layer, an offscreen minimap, composable tile textures. |
|
One Zustand store: a mirror of engine state for React, plus all UI state. |
-
Write: UI →
session.send(command)→GameEngine.submit()→ engine methods.submit()is the only place that decides who may act. -
Read: engine →
onStateChange→EngineEventHandlers.ts→ Zustand store → React. The store is a projection; the engine is the source of truth.
Zustand is the only state container in the project — there is no React Context.
There are 130 selector subscriptions and 62 imperative getState()/setState()
reads from engine, renderers and utilities.
All balance numbers live in src/data/ and nowhere else:
| File | Contents |
|---|---|
|
13 terrains — yields, defence, movement, resources, spawn weights |
|
36 unit types — attack/defense/move/cost/sight, tech requirements, cargo |
|
23 buildings (wonders are derived, see below) |
|
24 wonders — the authoritative wonder table. |
|
54 technologies, prerequisites, costs, unlocks (6 carry an explicit
|
|
6 governments (incl. Anarchy): tax cap, corruption, commerce penalty, happiness bonus |
|
Irrigation/road/railroad/mine/fortress — yields, worker-turns per terrain |
|
Goody-hut outcomes and the AI’s risk model |
|
Global constants, auto-scenario map types, specialist yields, colours |
|
Nomad pacing and prices, fixed-alliance tuning, chronicle moments, the distance-corruption model |
Game Rules Reference transcribes all of it with the formulas. If this README and that document disagree, the rules reference wins.
Exactly two, checked at the end of every turn:
-
Moonshot — research
moonshot(Space Flight → Moonshot) and you win immediately. The tech only appears once a space-station wonder (ISS, Tiangong or Mir) is built. Detection scans human seats only, so an AI cannot end the game this way; it wins by elimination. -
Elimination — be the last civilization still operational: owning at least one unit or one city. A single surviving enemy unit keeps the game alive.
The score (population, land, cities, techs ×5, wonders ×20, peace per 5 rounds, pollution penalty) is recomputed every turn for the scoreboard and the export CSV. It never ends a game.
-
winChance = A / (A + D);A = attack × health/100 × rank,D = defense × health/100 × rank -
Only the loser takes damage: 25 HP, or death if the round was decisive
-
Terrain defence: forest/river/lake/jungle/swamp ×1.5, hills ×2, mountains ×3
-
Fortified or in a friendly city ×1.5; a Fortress ×2 on top
-
City walls ×1.5 on
max(1, population)— catapults, cannons, artillery and air units ignore them (CombatSystem.ignoresCityWalls) -
Garrison units die one per round; the city falls once the garrison is empty
-
A captured city loses population, its walls and one building per citizen lost, pays 20 % plunder (capped at 100) and stays restless for 5 turns
Veterancy (unit ranks). Every unit holds one of four ranks — Rookie
(default) → Trained → Seasoned → Battle-Hardened — multiplying
its combat strength by ×1.0 / ×1.1 / ×1.25 / ×1.5 (the ladder caps at the
classic Civ veteran bonus). Combat earns experience (round won +10, unit
destroyed +30, city captured +60); the ladder thresholds are 40 / 120 / 280
XP. Units produced in a city with Barracks start as Seasoned (Civ1). The
legacy isVeteran flag stays in sync (true from Seasoned upward);
see src/game/engine/UnitRankSystem.ts.
-
Growth threshold
(population + 1) × 10; a Granary keeps half the food box -
Citizens eat 2 food, rising by 0.2 each above size 5; settlers eat 1 (2 under Republic/Democracy)
-
Settlers also cost 1 shield per turn under Republic/Democracy — nowhere else
-
Unit upkeep is per unit type (0–6 gold), not a flat 1; city-less units pay nothing
-
Corruption grows with distance from the capital; a Courthouse multiplies the rate by 0.8 (a 20 % cut)
-
Trade converts to gold at
TRADE_GOLD_MULTIPLIER = 3
There is no tolerance field. Every citizen is unhappy, and content has to be
bought: happiness = BASE_CONTENTMENT(2) + luxury + specialist luxury + martial
law + buildings + wonders + government bonus. A city disorders when
unhappiness > happiness, and disorder zeroes tax, science and commerce.
Martial law caps at 4 (Despotism/Anarchy), 3 (Monarchy/Communism), 1 (Republic/Democracy).
| Government | Tax cap | Corruption | Commerce penalty | Happiness bonus | Martial law |
|---|---|---|---|---|---|
Despotism |
100 |
0.30 |
0 |
0 |
4 |
Monarchy |
100 |
0.25 |
0 |
+1 |
3 |
Republic |
100 |
0.15 |
0 |
+2 |
1 |
Democracy |
10 |
0.05 |
0 |
+4 |
1 |
Communism |
100 |
0.10 |
−25 % |
+1 |
3 |
Anarchy |
0 |
0.30 |
0 |
0 |
4 |
Switching government costs 3 turns of Anarchy with all rates forced to 0. The AI only revolts when the candidate beats its current government by a clear margin (≥ 5).
54 technologies, 8 available at the start, locked for the first 5 rounds
(RESEARCH_UNLOCK_ROUND). Cost scales with map size, difficulty (harder is
easier), how far ahead you are, how many civs you have met and how many
prerequisites you already know. Research takes between 1 and 32 turns — the
32-turn maximum is enforced, a 4-turn minimum is not.
Six treaty types (open borders, trade agreement, mutual defence, non-aggression, embargo, embassy) on top of four statuses. Attitude is a directed goodwill/grievance ledger, not a single reputation number: an act costs a paranoid civ 2.5× what it costs a belligerent one, betraying an alliance costs more than breaking a peace, and grievance decays at 0.5 per turn. A signed peace blocks re-declaration for 8 rounds. Breaking a ceasefire costs 30 goodwill.
Setup can also lock the civilizations into fixed alliances (permanent teams). Teammates cannot fight or betray each other; wars, peace and ceasefires expand across whole teams; every member wins or loses together; a human whose own civ falls while a teammate survives keeps watching. Alliances with outside civilizations remain per civ, and teammates share vision, explored ground and contact.
A phantom horde that acts once per round before everyone else, spawned only by Barbarian Ambush villages. It becomes a real, targetable civilization the moment it holds a city — and only then can it be a loss condition. It has no diplomacy. (Captured cities make it stronger; they do not spawn it.)
Full rules, tables and formulas: Game Rules Reference. Player-facing summary: Gameplay.
-
React 18 + TypeScript 5.6 + Vite 7 — dev server on port 3000
-
Zustand 5 — the only state container
-
Bootstrap 5 + React Bootstrap + Bootstrap Icons + canvas-confetti
-
Vitest 3 (node environment), Playwright, knip, ESLint 8
-
Qodana (
qodana.yaml) for JetBrains static analysis -
No Prettier — formatting is not enforced; match the surrounding style
-
Node.js 18+, Git LFS for the art assets
# Git LFS is required for the images (Ubuntu/Debian example)
sudo apt install git-lfs
git clone https://github.com/JCTRoth/Zivilisation_1.git
cd Zivilisation_1
git lfs pull
npm install
npx playwright install chromium # only needed for the e2e suites
npm run dev # http://localhost:3000That is the whole single-player game: the Vite dev server serves the client and the engine runs in the tab. No game server is started or contacted.
To run the built app — including the installable, offline PWA — and the multiplayer server:
npm run build # bundles into dist/
npm run preview # http://localhost:4173 — the production build
npm run dev:server # multiplayer only: HTTP :8787, WS :8788A save is a versioned .json file you can download and load back from the
Game Menu, and campaigns are also kept on the device (IndexedDB) so
GAME ▸ Campaigns can resume them without a network. See
Save & Load System.
Prerequisites, ports, the PWA install/offline walkthrough, Docker Compose, the test commands and troubleshooting live in Running Civ1 Browser.
-
Arrows — move the selected unit; Shift + arrows — pan the camera
-
Space cycle stacked units · Enter end turn · Esc cancel/close
-
W wait · S skip · F fortify
-
G — opens the government dialog; GoTo itself is a canvas click, not a key
-
B road · I irrigation · M mines · P clean pollution
-
R rush production · C centre on unit · T rates · D/F4 diplomacy
-
+/− zoom · Ctrl+1…9 select city · Ctrl+S/Ctrl+L save/load
-
Ctrl+P pause · F1 help · F2 tech tree · F3 settings · F11 fullscreen
npm run dev # Vite dev server, port 3000 (single-player)
npm run dev:local # Postgres in Docker + server + web on the host, one command
npm run build # production build
npm run lint # ESLint, max-warnings 0
npm run type-check # tsc --noEmit
npm run test # Vitest — 263 files, 3,051 cases, node environment, no DOM
npm run test:e2e # Playwright (needs the dev server)
npm run test:offline # Playwright against the production build, network cut
npm run knip # unused exports / dependenciesCI runs type-check, lint, vitest and knip on every push and PR
(.github/workflows/tests.yml) and the Playwright suite separately
(playwright.yml). The offline suite is self-contained — it builds the app
and serves it on :4173 — and is documented in
Running Civ1 Browser ▸ Tests.
node scripts/run-ai-batch.mjs # many seeds, writes game-logs/
node scripts/run-naval-session.mjs # one naval AI-vs-AI sessionOr spectate in the browser with no clicking:
http://localhost:3000/?maptype=AI_VS_AI_NAVAL&civs=7&seed=123&gold=50&noanim
?seed= pins the map, the starting positions and the AI profile rotation, so a
regression reproduces exactly. Also supported: ?quickstart, ?combatlab,
?dev=0, and ?noanim (disables animations). seed, civs, gold and
difficulty only apply together with ?maptype=.
npm run lint && npm run type-check && npm run test && npm run knipIf you touch tools/tile-generator/, add its golden check:
npm run test:generator # tools/tile-generator: specs/*.json + prompt bundleIf you touch a balance number: change it in src/data/, update
Game Rules Reference in the same commit, and say in
the commit message which rule the number encodes.
-
Balance data →
src/data/*. Never in the engine. -
Engine mechanics → the matching
src/game/engine/*file.GameEngine.tsis already 9,504 lines; do not grow it. -
Anything the AI also needs → shared engine code, not
AI/. -
Player intents → a
Commandintypes/commands.ts+ acaseinGameEngine.submit(). UI never calls engine methods directly.
-
Running Civ1 Browser — prerequisites, dev server, production build, the PWA install/offline walkthrough, the multiplayer server, Docker Compose, every test command, and troubleshooting
-
Offline Play & PWA — why offline play needs no second engine, the service worker rules, and the campaign library design
-
Containers and Deployed Topologies — every container, what is inside it, ports, probes, resources, the Compose and K3s topologies, and where each setting lives
-
K3s Setup — the two-node test cluster, the script and the manual path, TLS, verification, operating and troubleshooting
-
K3s Completion Plan — verified state, the gap register (P0–P2) and the phased plan to production
-
Deployment verification — the original audit and the prompt log it was implemented from
-
Game Rules Reference — the authoritative source for every balance number and formula
-
Gameplay — player-facing summary
-
Terrain Around City — work radius, yields, worker assignment
-
Technology Research — the beaker cost model
-
Technology Comparison — all 54 techs vs. original Civ I, with recommendations and clarity notes
-
Government & Revolution — revolutions, anarchy, capital
-
Diplomacy System — opinion ledger, treaties, proposals
-
Fixed Alliances — locked teams, team diplomacy, victory and spectating
-
Nomads — the visiting tribe: contact-based parley, three factions drawn from real nomadic history (Bedouin / Mongol / Sámi), they travel from court to court (your audience, their deals with the rivals in code), relationship memory, their own economy (routes, city market, bribes) and their own row in the diplomacy hall; folder README:
src/game/engine/nomad/README.md, faction book + art prompts:src/game/engine/nomad/FACTIONS_README.md -
City Capture & Destruction — what happens when a city falls
-
Wonders — the 24-wonder data format and effect model
-
Modals & Dialogs — every dialog, how it opens, screenshots in
doc/dialogs/ -
Happiness — content, disorder, martial law
-
City Disasters — the seven Civ1 events, their chances and prevention
-
Fog of War — visibility, exploration, storage
-
Save & Load System — the v5 format, the campaign library and the file round trip
-
Offline Play & PWA — installing the app, the service worker, and playing without a server
-
GoTo Manager — pathfinding orders
-
Round Manager — automated path following
-
Game Progression Export — the analysis JSON/CSV
-
Auto Turn Ending — the automatic end of turn
-
The Chronicle — full-screen illustrated story cards: the queue, the moments, the promotion rules
-
Static Maps — static map format and registry
-
Adding a New Map — step by step with a checklist
-
Rendering & Tile Assets — layers, textures, tile generator; the generator’s own README (specs/*.json prompt engine, request → bundle) is
tools/tile-generator/README.md -
Tile Generator Requests — want a tile set generated? Write a small JSON request, run
--checkon it and send it; the generator needs the local models, the request travels -
Sound Effects — every cue, when it plays, the shipped recordings, and how to drop in another
-
I18n — the six shipped languages, key namespaces, adding a language
-
Team Coordination — fixed-alliance attack/defence coordination and the team commands
-
Missing Assets — what art, icons and recordings are still missing
-
AI Overview — start here: the map of the AI layer
-
AI Economy — tax policy, gold reserve, upkeep, bankruptcy
-
AI Production — profiles and expansion-first production
-
AI Settler Integration — site selection
-
AI City Stability — keeping large cities stable
-
AI vs AI Analysis — a headless AI-vs-AI game: missing aggression, zero captures, no expansion
-
AI Micro-Errors Report — a 587-round catalogue
-
Scout & Enemy Search — scout unit and spiral search
-
AI Memory — what the AI remembers between turns, and what is still unwired
-
Air Doctrine — how the AI builds and uses air power
-
Naval AI Overhaul — hulls, invasions and the naval bench
-
Development Status — where the project stands, what is next
-
Implementation Audit — done / partial / missing, with the open backlog
-
AI Governor Architecture — critique of the current AI shape
-
Leader Doctrines — per-civ identities hung on diplomacy
-
Balance & Behaviour Analysis — 400-round headless games, measured economy/AI failures and a prioritized fix list
-
Economics Analysis — why the treasury is empty: quantized income, priced-above-output citizens, dead corruption data, and the
economy_sim.pysimulator that decided the fix -
Caravan Governor — the per-unit trade brain: mission lifecycle, route economics, travel budget, threat profile, escort, and the three gates a caravan has to pass
-
Modals — every dialog, how it opens, and what protects it
Image prompts for the optional artwork (everything degrades to emoji / gradient fallbacks without them — generate one at a time, in any order):
-
Nomad Factions & Art — the three peoples who visit you (Bedouin / Mongol / Sámi): where they come from in real history, how they play, and the image prompts for their 512×640 portraits; art slot notes
-
Story Screen Art — the chronicle’s wide 16:9 scenes: the dawn, a horde conquest, the nomad migration and the four city-chronicle moments
-
TODO — the live task list
Ordered by impact, see Development Status and TODO for the detail:
-
Command layer rollout — 6 commands converted (
MOVE_UNIT,SET_RATES,SET_CITY_PRODUCTION,FOUND_CITY,TEAM_COORDINATE_ATTACK,TEAM_DEFEND_CITY); the remaining direct UI→engine calls follow the same pattern, then engine methods can be made internal. -
Determinism — route the 63
Math.random()calls (37 of them in the engine) and theDate.now()-based unit IDs through a seeded RNG and a counter. -
Client/server split — a
GameRoomrunning the engine as the authority over theGameSessioninterface, with per-connection fog filtering. The engine is already DOM-free and runs headlessly; the blockers are the three items above plus movingsaveGame/loadGameofflocalStorage.










