Skip to content

Commit 730601b

Browse files
committed
ANNALS: procedurally generated living kingdom in a single HTML file
A watchable real-time 3D fantasy kingdom simulator (vanilla JS + Three.js r128 from CDN, no build step, no assets). Seed in the URL hash fully determines the world via seeded sfc32 RNG with separate gen/history streams. - Worldgen: fBm terrain with domain warp and mountain spine, flow-carved rivers, biomes, settlement siting, A* king's roads with bridges, organic building layout (12 archetypes x 3 tiers), walls, keep, procedural heraldry - Rendering: instanced buildings/trees/soldiers, vertex-color seasons with snow, day/night cycle, weather particles, sky dome, camera-tracking shadows - Camera: spring-damper rig with free/follow/director modes, curved altitude path, terrain collision - Simulation: daily tick for weather, seven-good economy with caravans and cogs, population pools with hunger cascade, dynasty and five great houses with loyalty/legitimacy/unrest, succession (incl. regencies and crises), civil wars with field battles, sieges, sacks, exile and new-blood peerage - Threats: SIR plague riding the trade network with emergent quarantine, spreading fires, floods, droughts, earthquakes, bandit camps and kings, a dragon whose wake probability scales with the treasury, omens, myth dial - Chronicle: dated annalist entries, clickable fly-to, reign headers, filters, txt export; auto-director with beat cards and Watch mode - 15 Acts, 5 overlays, rate sliders, inspector, share links Verified headless: 200 unattended sim-years hold population, treasury, and houses in sane bounds with zero errors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJUuoQXWUkMk2YSxRM2MSp
0 parents  commit 730601b

2 files changed

Lines changed: 3167 additions & 0 deletions

File tree

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# ANNALS — a living kingdom in a single file
2+
3+
A procedurally generated fantasy kingdom rendered in real-time 3D that you can
4+
watch for five minutes or five hours. Zoom from a satellite view of the whole
5+
realm down to a market square. Time runs; harvests come in; caravans crawl the
6+
roads; a queen dies without a clear heir and the great houses raise banners;
7+
plague follows the trade routes; a dragon notices the treasury has gotten
8+
large. Everything that happens is written into a scrolling **Chronicle** in the
9+
voice of a medieval annalist, and a cinematic **auto-director** flies the
10+
camera to the story as it unfolds.
11+
12+
**The whole app is one file: [`index.html`](index.html).**
13+
Vanilla JS + Three.js r128 from CDN. No build step, no framework, no backend,
14+
no assets — everything is procedural (terrain, buildings, heraldry, names).
15+
16+
## Run it
17+
18+
Open `index.html` in a browser, or drop it on any static host (Netlify, GitHub
19+
Pages). That's it.
20+
21+
- **Persistence is the seed**: the URL hash (`#s=1234567`) fully determines the
22+
generated world. *Copy share link* reproduces your realm exactly.
23+
- **Export chronicle** downloads the full annals of your run as a `.txt`.
24+
25+
## Controls
26+
27+
| Input | Action |
28+
|---|---|
29+
| drag | orbit · **right-drag** pan · **scroll** zoom (5 m – 4 km) |
30+
| click | inspect settlements, buildings, armies, caravans, the dragon |
31+
| `Space` | pause · `1–4` speeds (up to 30 sim-days/sec) |
32+
| `C` | **Watch mode** — pure documentary screensaver |
33+
| `H` | hide UI · `Esc` deselect / cancel placement |
34+
35+
The left drawer has four tabs: **Rates** (harvest, plague virulence, house
36+
aggression, myth dial…), **Acts** (Unleash plague · Wake the dragon ·
37+
Assassinate the monarch · Contest the succession…), **Overlays** (territories,
38+
trade, prosperity, plague, unrest), and **Realm** (seed, houses, succession).
39+
40+
## How it works
41+
42+
- Deterministic worldgen via seeded `sfc32` RNG with **separate streams** for
43+
generation and history — intervening in history never changes the map.
44+
- Worldgen pipeline: fBm terrain with domain warping and a mountain spine →
45+
flow-accumulation rivers → biomes → settlement siting → A* king's roads →
46+
organic street/building layout (12 archetypes × 3 tiers) → houses, heraldry,
47+
and a cast of ~140 named notables.
48+
- Sim tick = 1 day: Weather → Economy → Population → Politics → Military →
49+
Threats → Growth → Chronicle. Every positive feedback loop ships with a
50+
predator (big treasuries attract dragons and courtly waste; strong houses
51+
chafe; growth strains granaries).
52+
- Two-layer population model: pools per settlement drive economy and levies;
53+
named notables age, marry, inherit, win epithets, and die on camera.
54+
- Threats are couplings, not effects: plague rides caravans (settlements above
55+
15% infected refuse trade — emergent quarantine), fire spreads through the
56+
building graph biased by wind and drought, bandit camps prey on the roads,
57+
and the dragon's wake probability scales with the treasury.
58+
59+
Verified: 200 unattended sim-years keep population, treasury, and the houses
60+
within sane bounds — and the realm still produces story.

0 commit comments

Comments
 (0)