Drag: rotate the camera. Wheel or pinch: zoom. W A S D / arrows: move, Q E: turn. Click a building to inspect it. The seven tabs under the scene change the camera and the build palette; Build opens the palette. R rotates a building, Esc cancels, Space pauses. Minimap click flies there.
The science
Population. Growth is logistic, dP/dt = r g P (1 − P/K) + m (1 − P/K), with K the housing capacity (40 per house, 100 in the town hall, 60 in a manor, 200 in the castle), r = 0.0012 per hour, g a happiness/sanitation factor and m = 0.15 settlers per hour; over capacity people leave, with no food the realm shrinks. The closed form is P(t) = K / (1 + ((K − P0)/P0) e−rt).
Harvest. Farm output follows the year: f(d) = 0.8 + 0.35 cos(2π(d − 200)/360), peaking mid-July and lowest in January, so spring is the lean season. One ration is one citizen’s day of grain (about 0.7 kg); a granary keeps the stock from rotting and raises the storage cap.
Wind. A windmill converts P = ½ ρ A v3 Cp with ρ = 1.225 kg/m³, blade radius 9 m, Cp = 0.30 (a real sail mill is below the Betz limit 16/27 = 0.593). Milling capacity is scaled to the power at the 6 m/s design wind.
Castle works. Masonry advances at V̇ = crew × 1.2 m³ per day (crew = 20 + 20 per masons’ yard, +25% with Masonry) and eats 0.5 stone per cubic metre; the days needed are V / (crew × 1.2).
Fountain. Water leaves the nozzle at v0 = 3.1 m/s and rises h = v0²/(2g) = 0.49 m; the particles on screen follow exactly that parabola.
Defence and raids. The defence rating adds walls, towers, guards (times a discipline factor) and castle works; the threat is 180 + 0.0009 × gold + 1.5 × day (a rich realm is a juicier target), lowered by alliances and beacons. Every few weeks the two are compared; if defence is lower, a small share of gold and wheat is lost. No fighting is shown; this is an educational model of readiness, not of warfare.
Money. Gold = tax (per citizen, scaled by the tax slider and a happiness efficiency) + market trade − upkeep. Market prices follow stock with elasticity 0.5: price = base (ref/stock)0.5; ships in port pay +30%. Happiness is a sum of simple terms (food cover, market, church, tavern, wells, plaza, walls, guards, taxes, research, treaties) smoothed over time.
Neighbours and map. Relations drift toward 50 and rise 0.12 a day under a treaty; below 20 a treaty is lost. Scouts take 3 days (2 with Cartography), reveal a region and cost 5,000 gold; outposts add small bonuses. All of this is game design, not history.
Honest limits. Every price, cost, yield and the raid model are illustrative game constants, not medieval statistics. The 3D models were made in Blender (named parts, vertex colour with a baked-style ambient shade) and are instanced in Three.js; economy, seasons, day and night, quests and diplomacy run in the page.