A procedural engine that grows the whole economic history of a city into a generated world — from the founding engine to the metropolis — deterministically, from a seed. The streets and quarters are how the economy writes itself onto the ground. It stands on mappa's planet and reuses two field solvers from hoop. The long arc is a 4X game.
Three things already exist in this repo, and polis is the missing middle:
| Layer | What it is | What it gives polis |
|---|---|---|
| mappa | a deterministic planet + one-shot city-site scatter | the substrate: terrain, rivers, coasts, fertility — the ground the economy stands on |
| polis | this project | the economic history: founding engine → multiplier → diversification → regional hierarchy |
| hoop | a game with two pure field solvers in its internals | the geometry engines: a Physarum network-grower and a hypoxia/angiogenesis capillary-grower |
mappa's placement answers where; it has no notion of a city growing an
economy. A 4X needs cities with a legible economic history — a founding engine, a
multiplier, a diversifying base, a place in a hierarchy. polis is that layer.
This is the heart of polis, and the answer to how do cities start?
A city is not founded by spreading people evenly. It nucleates around one economic function strong enough to pull a surplus toward a point — and at the start, everything else is negligible against that one engine. The archetypes:
In every case the early city is one engine plus its support system — which is exactly why its earliest network is a star of routes to that engine (regime 1, below).
Economic-base theory (Sombart 1916 → Haig 1928 → Hoyt 1939; the export-base theory of regional growth, North, 1955) splits a city's economy in two:
If s is the local-serving share, each export dollar re-circulates locally and total activity is the geometric sum:
M is the base multiplier — the structural analogue of the Keynesian
income multiplier, with s playing the role of the marginal propensity to spend
locally. If non-basic is half the economy (s = ½), M = 2: every export job supports
one local job. If s = ⅔, M = 3. This multiplier is the core economic engine that
allows for growth: add one base job, the town grows by M.
The base multiplier is linear: double the staple, double the town. It cannot explain a city that keeps growing after its founding engine fades (the portage that silts up, the mine that empties). Two mechanisms make growth self-reinforcing:
The growth engine, assembled. Founding export base
→ the multiplier M = 1/(1−s) spins up local services → agglomeration makes the
place more productive as it grows → import-replacement turns local services into new
export base → the multiplier acts on a bigger base → … A staple that merely serves
becomes a city that generates. Past a threshold, Wilbur Thompson's urban size
ratchet (1965) makes continued growth all but guaranteed — structural diversity
insures the city against the death of any one sector.
A city is always solving a flow problem on a graph. Which problem is set by the
shape of its economy, and that shape changes over the life cycle. Both hoop
solvers are the graph Laplacian L with different forcing — and the forcing
tracks how concentrated the economic base is. It evolves one point → uniform → many
peaks, so Physarum bookends the cycle (a star at birth, a network at maturity)
with the diffusion/coverage solver in the middle.
Economy: monoculture — one export engine; the multiplier barely started.
Forcing: a single dominant sink — the big game in town.
Form: spokes to the one engine; everything else barely on the map.
Economy: the base multiplier has spun up local-serving services.
Forcing: a roughly uniform source — serve everyone.
Form: capillary infill toward the under-served fringe — the town fills in.
Economy: diversified — many sectors (import-replacement, agglomeration).
Forcing: many peaked origin–destination currents.
Form: arterial hierarchy — the trading city.
This is not a metaphor we impose — it is what the kernels compute.
flux.js's header notes the stationary flux of trips is the Laplace transform of
the journey process (the graph's Green's function); foam.js's seize() is a
multi-source BFS perfusion field plus angiogenesis toward the worst-served tissue. The third
regime — the nucleus — is the same Physarum solver with current collapsed onto
one sink, which is exactly the network of the earliest city: a few routes to the
one place that matters, everything else barely on the map. A one-engine economy produces a
one-hub network.
The phases are not invented — they track Wilbur Thompson's five stages of urban
growth (1965): export specialization → the export complex → economic maturation
(import-replacement) → regional metropolis → technical-professional virtuosity. polis
reads that economic succession spatially, with the three regimes as its geometry.
Score every candidate cell on two independent axes (site vs situation): site
= local terrain (water, defensibility, buildable land); situation = betweenness on the
route/river graph. Some terrain features are forced spawn points because they manufacture
a founding engine — the fall line (rapids =
head of navigation and water power; one escarpment seeds a string of cities — Richmond,
Baltimore, Washington), the head of navigation, the lowest bridging point (river port), the
harbour, the defensive hill/meander/island, the gap/pass town. The founding advantage is a
one-time tie-break, not a permanent subsidy — which is what later lets the city outlive
the reason it was founded.
The economy is a monoculture: one basic sector (the founding engine), the multiplier barely started. The network is therefore a star — sparse routes from the scattered hinterland to the one place that matters. This is the Physarum solver with current injected to a single sink and μ high (the field collapses to a minimal tree/star, not a grid). This is the regime you identified, and it is economically exact: a one-engine economy produces a one-hub network.
The base multiplier M = 1/(1−s) spins up the non-basic economy — bakers, smiths, a
parish, a market. The binding constraint flips from route-to-the-engine to
serve-everyone: every dwelling within reach of the well, the market, the mill, the gate.
This is the angiogenesis solver (foam.js seize()): grow capillary lanes toward the
worst-served ("hypoxic") cell until all tissue is within reach. Its grain follows
Conzen (streets → burgage plots →
buildings, each plot aging through the burgage cycle); the first land-use gradient appears via
von Thünen
(R = Y(p−c) − Y·F·m, uses sorted by the upper envelope).
Agglomeration and import-replacement diversify the base into many sectors. The flow
problem becomes one of moving concentrated flows among many origins and destinations — the
Physarum solver again, with a dense, peaked O–D current matrix (gravity demand
T_ij ∝ P_i·P_j/d_ij², Reilly 1931). Conductance adapts, dD/dt = f(|Q|) − D
(Tero et al., Science 2010);
arteries are the superlevel set; μ dials grid↔tree. Bid-rent
(Alonso) sorts land use — concentric rings (Burgess), sectors (Hoyt), or multiple nuclei
(Harris–Ullman). History freezes as fringe belts under a morphological-frame constraint.
The loop closes (Levinson & Xie): road → accessibility → development → demand → more road.
Y = Y₀·N^β — infrastructure sublinear (β≈0.85), socioeconomic output superlinear (GDP, wages, patents, crime; β≈1.15), needs linear (β≈1.0). Pick N, derive the rest.P_n ≈ P_1/n self-organizes.The phases are the shape. The engine runs on three clocks, spans two
territories, opens two doors to the wider world, and is judged on two axes. This is where
polis becomes a hinterland sim as much as a city sim, and where it pulls in
two more assets the repo already has.
K. The Verhulst
logistic (1838), dP/dt = r·P·(1 − P/K), inflects at K/2; the Gompertz
alternative dP/dt = r·P·ln(K/P) inflects early at K/e ≈ 0.37K — fast boom, long
crawl to the ceiling. Northam's urbanization S-curve (1975) is the macro envelope.K(t) rises and
the city chases a moving ceiling — stacked successive S-curves (the bi-logistic), not
one plateau.K up discretely. Hirschman (1958) splits
investment into social-overhead capital (SOC) and directly productive activity
(DPA): build SOC ahead of demand (permissive — invites DPA) or let it lag
(compulsive — scarcity pulls SOC in). Rosenstein-Rodan's big push (1943): below a
coordinated minimum quantum, returns are negative; cross it and external economies flip
positive. Model K = K_continuous + Σ(infra_blocks), each block a binary paid out of surplus.Technology is the one exogenous force that moves every other parameter: it raises the
agricultural surplus ratio (freeing labour for the city), lowers transport cost
(the master lever — as τ falls past a threshold it tips Krugman's
core–periphery bifurcation: the dispersed equilibrium loses stability at the break
point, agglomeration self-sustains past the sustain point), raises productivity,
and cuts project costs. With general-purpose technologies (Bresnahan–Trajtenberg 1995),
Schumpeter's creative destruction and Kondratiev's ~50-year long waves, it also rewrites
which industries lead each era. Strip the tech tree out and the base multiplier just
saturates against a fixed K — the city has no history. So a tech clock is structural.
Reuse, don't rebuild. The repo already has a
500-node technology DAG in cards
(tech-pool.js) — 8 eras (prehistoric → ai) × 12 domains incl. agriculture, transportation,
energy, finance; prerequisite depth 26. It is pure portable data but carries no effects
field. The integration is exactly that missing layer — a per-tech effects map onto the
economic levers: { agSurplus:+0.2, transportCost:−0.1, baseMultiplier:+0.05, projectCost:{road:−0.15}, K:×1.1 }
— so an agriculture chain compounds the surplus that lifts K, and a
transportation chain drives τ toward the break point.
A city and its hinterland are one coupled system — which is why polis is a
hinterland sim as much as a city sim.
R = Y(p−c) − Y·F·m that sorts the land
into concentric specialization rings (dairy → fuel → grain → ranching).Two distinct external growth drivers, through which raw resources, agriculture and away-market access reach the city:
| Door | Logic | Form | Fed by |
|---|---|---|---|
| Central place (Christaller) | endogenic — serve the local hinterland's threshold demand | centred, symmetric radial catchment, retail/service | agricultural surplus of the near hinterland |
| Gateway (Burghardt 1971; Vance's mercantile model 1970) | exogenic — reach distant away markets via a break-of-bulk node | edge-located, asymmetric one-way hinterland, wholesaling | raw-resource staples (Innis) + away-market access |
So a polis city carries two size terms — a central-place term (local demand) and a gateway term (export-demand × break-of-bulk advantage). Raw-resource availability (where the staple sits on the mappa substrate), agricultural surplus (the hinterland), and away-market access (the gateway's reach) are the three inputs of the broader economy.
A city is judged on more than scale (population, GDP — the N^β laws). The second
axis is flourishing, and it has two faces.
Livability (the floor). The civic-vitality model in
hoop/econ — scoreSociety() → vitality
0–100 + tier on seven sub-signals (supply closure, multiplex thickness, social
weave, Granovetter bridges, third-places, employment,
resilience) — is the floor: is the city good to live in? Its framing already
separates this from output: the loop closes, and "the real output is regard."
A structural edge (the bloom). But flourishing meant something sharper in
Vienna 1900 (Schorske) — a cultural and technological efflorescence. Structurally that is
the city's capacity to attract talent and generate technology, and it is the missing
feedback that closes the growth loop: talent → human-capital externalities →
innovation → import-replacement → new export base → scale → (more talent). Skilled people near
skilled people produce more than the sum (Lucas: "what else is a city?"; Glaeser; Jacobs);
Peter Hall's Cities in Civilization catalogues these golden ages; Florida names the
levers Talent · Technology · Tolerance. And because technology diffuses, generating
it first is a competitive edge — a lead-time that decays as it spreads. So flourishing
is the city's tech-generation rate: it advances the tech clock for itself and leaks to
laggards. Sassen's global cities are the limit case.
The dusk — the Owl of Minerva. Flourishing is non-monotonic, and its peak
sits on the edge of collapse. Hegel: "the owl of Minerva spreads its wings only with the falling
of the dusk" — Vienna's bloom was the eve of the empire's fall. The structural account is
Tainter's declining marginal returns on complexity: a metropolis at peak complexity is at
peak fragility, each added layer of coordination returning less until the margin goes
negative (Thompson's ratchet has the same ceiling; Spengler's "megalopolis" the late form). So
polis models flourishing with a complexity cost that eventually bites — bloom and
dusk on one curve. (This resolves last pass's open question: flourishing does
feed back into growth — via talent + tech — but the complexity cost can turn it negative at the top.)
The economy above moves real goods and labour. Finance is the parallel system that moves claims on the future — it mobilizes surplus into investment, prices time and risk, and supplies the medium of exchange. It is not a garnish: it is how the lumpy projects get paid for and how the multiplier deepens, and its cost of capital is a master lever on par with transport cost — cheaper, deeper finance unlocks bigger projects sooner and is a decisive edge between cities.
A financial system mobilizes savings · allocates capital · monitors its use · eases exchange · manages risk (Ross Levine). Schumpeter's slogan is the point: "the banker authorizes the entrepreneur" — credit creates the means for innovation before the returns exist (King & Levine, "Schumpeter Might Be Right," 1993). Financial deepening (Goldsmith's Financial Interrelations Ratio) tracks development; Patrick's supply-leading (built ahead of demand — the financial twin of Hirschman's permissive excess-SOC) vs demand-following finance names the two sequences. (Honest nuance: causation is contested — Robinson's "where enterprise leads finance follows," and the "too much finance" literature finds the effect turns negative at high depth — itself an Owl-of-Minerva point.)
1/(1−reserve) is the structural twin of 1/(1−s).ρ is positive and financing exists (tax flow + borrowing
capacity). ρ is the gate.| Phase | Financial regime | Mechanism |
|---|---|---|
| Nucleus | redistribution (pre-market) | Polanyi: the temple/palace treasury & granary concentrates tithe/tribute and redistributes it; "investment" is the ruler's command of stored surplus. Trade summons money. |
| Town | coinage + merchant credit | coinage lubricates the multiplier (velocity ↑); the bill of exchange moves value across distance; the town taxes its own toll/market flow to fund the first walls/wells. |
| City | deposit banking + funded debt | the city borrows for big SOC; the Financial Revolution — credible commitment (bind the sovereign → collapse the risk premium) lets it out-build & out-fight rivals. Land capitalizes the bid-rent gradient → mortgage finance; title turns land into collateral, not "dead capital." |
| Metropolis | financial centre (finance is the export base) | the trade entrepôt becomes a financial entrepôt; Kindleberger's succession Italy → Amsterdam → London → New York — capital follows trade, then leads it. Sassen's global city is a financial command node. |
Brewer's fiscal-military state (1989): war drove the mutually-reinforcing growth of taxation + public debt + bureaucracy. The polity that can borrow (capital-rich, credibly-committed) out-finances the one that can only tax or plunder — Tilly's capital↔coercion axis with a financial edge (Britain out-spent rivals while borrowing cheaper). Tribute is a forced periphery→core financial flow; conquest can repudiate the debt or seize the treasury — a financial shock.
Finance has its own Owl of Minerva. Minsky: over a long prosperity the financing mix migrates hedge → speculative → Ponzi — "stability is destabilizing" — until a Minsky moment forces fire-sales. Kindleberger's anatomy fits 300 years: displacement → boom → euphoria → distress → panic/crash (Tulip 1637; Mississippi & South Sea 1720). The land cycle (Hoyt's ~18-year Chicago series) is the urban form. So finance adds a third discrete event-shock alongside conquest and plague — the financial crisis — and the flourishing financial centre is the most prone to it.
→ modeling rules. Finance is a flow network over the real
economy: surplus → savings → a capital pool → allocated by the financial regime
(redistribution / merchant / bank / market / state, set by phase + tech) → funds lumpy projects and
capitalizes the base. A cost-of-capital ρ (the finance analogue of transport cost)
falls as finance deepens → an edge. Build a project when NPV(ρ)>0 and
tax + borrowing capacity ≥ lump; borrowing capacity = f(credible commitment, tax base,
debt). Capitalize land as collateral (an ~18-yr cycle that can overshoot). Fire a
crisis shock when the Ponzi/leverage share crosses a threshold — the third member of the
event layer (conquest · plague · crisis).
Everything above models the city as an economic growth machine. The full sweep — the eXterminate of a 4X — needs the city as a political-military actor too. Most of it falls out of the economics already built; one piece does not.
Defense belongs in the early running, including nucleation. Site-selection already prizes defensive sites (hilltop, river-meander, island); the political register adds defense as a founding function — the citadel/acropolis or garrison that seeds a town (you cannot accumulate a surplus you cannot hold), on the same footing as break-of-bulk, the staple, and the administrative seat. The frame is Tilly's capital↔coercion spectrum (1990): polities form along an axis from the capital-intensive pole (cities, trade — the engine of everything above) to the coercion-intensive pole (war, conquest, empire) — "war made the state, and the state made war." A settlement carries a coercion parameter on that axis; defense is both a founding engine and an ongoing security cost paid from surplus.
Is there an imperial version of the narrative, or can it be done by managing inputs and outputs? Mostly the latter. Empire is what the machinery already built does at high extraction-reach + coercion:
q>1) by political concentration. A parameter on the size distribution, not new machinery.So no separate "empire engine" is needed: empire is a configuration of the gateway, the hierarchy, path-dependence, and the coercion parameter.
Conquest is the exception: a discrete regime-change event, nothing the smooth growth
curves, the lumpy projects, or the tech clock can generate. It is the city-scale cousin of hoop's
removeImpact shock, with outcomes on a spectrum:
| Outcome | What happens | When |
|---|---|---|
| sack / raze (urbicide) | sunk capital destroyed; the city can die | rare — the city is the prize |
| tribute | city kept, surplus redirected outward; flourishing drops | the common case |
| elite-swap | the govern sector replaced; population continues | frequent |
| absorption | changes hands, carries on | frequent |
The outcome is size-dependent — exactly the intuition that a metropolis loses little.
Locational inertia (the Bleakley–Lin logic: sunk capital + agglomeration persist through regime
change) means a great city survives conquest and just changes masters — Rome,
Constantinople, Damascus, conquered repeatedly, carry on. A mono-functional nucleus can
die when its single engine is taken. Conquerors usually preserve rather than destroy
— the city is the tax base — so urbicide is the
exception. In model terms: conquest applies a shock whose damage is f(size, diversity, conqueror
intent, whether the base sector survives) — a diversified metropolis absorbs it, a one-engine
town may collapse to ruin.
total = base × 1/(1−s), capped by agricultural surplus. Agglomeration multiplies base productivity by size^ε (ε ≈ 0.04–0.08).N^β scaling emerge.Path dependence — the through-line. The founding engine breaks the initial tie; increasing returns amplify the lead; sunk infrastructure does not decay when the founding feature dies. The proof: portage cities, founded at fall-line sites, kept concentrating population after river navigation became obsolete (~6% lower density per 10% farther from the dead portage; Bleakley & Lin, 2012). The lock-in test for polis: delete a city's founding engine mid-run — agglomeration + sunk capital should keep it growing.
Everything is seeded. (worldSeed, siteCell) → a city's entire economic
history, identical on every machine, freezable to an ATProto record. No Date.now(), no
unseeded Math.random() in generation. A city permalink (and, later, a 4X save) is only
meaningful if the history reproduces.
polis is the economic map-and-history layer a 4X needs. Once a city has a
legible economic history — a founding engine, a multiplier, a diversifying base, a place in a
Zipf hierarchy — the 4X verbs act on something real: eXplore the mappa world,
eXpand along the site-score field, eXploit the surplus and the export base,
eXterminate over the central-place catchments. The phases are, deliberately, also the
economic-era progression of such a game.
Next passes (as the theory hardens into code): a
substrate.js mappa-reader; a site.js two-axis scorer with the forced spawn
points and the founding-sector assignment; an economy.js carrying the base, the
multiplier, agglomeration and import-replacement; vendored network.js (from
flux.js) and coverage.js (from foam.js), re-synced not forked; and a
deterministic history.js driving the regime cross-fades and emitting a replayable chronicle.
Assembled from the canonical urban-economics, economic-geography, and complexity-science literature. Full reading list:
Economic base analysis & the multiplier M=1/(1−s) · North, export-base theory, JPE 1955 · Cooley, "break in transportation," 1894 · Innis / Watkins staples thesis
Marshall's agglomeration trinity (1890) · Rosenthal & Strange (3–8% elasticity) · Krugman, core–periphery, JPE 1991 · Jacobs, The Economy of Cities (1969) · import-replacement
Thompson, five stages + the size ratchet (1965) · Vernon, product cycle / filtering-down (1966) · Childe's urban revolution (surplus)
Verhulst logistic · Gompertz curve · carrying capacity (K rises) · Hirschman SOC/DPA (1958) · Rosenstein-Rodan big push (1943) · Bresnahan & Trajtenberg GPTs · Kondratiev waves
von Thünen hinterland rings · Boserup intensification · Burghardt, gateway cities (1971) · Vance mercantile model (1970)
cards — 500-node tech DAG · hoop/econ — civic vitality · hoop flux + foam solvers · mappa substrate
Levine, five functions (1997) · King & Levine (1993) · Goldsmith deepening · Polanyi modes · North & Weingast (1989) · Gerschenkron (1962) · Henry George · Hoyt land cycle · Minsky · Kindleberger
Peter Hall, golden ages · Schorske, Vienna 1900 · Florida, creative class · Glaeser, Triumph of the City · Sassen, global city · Hegel, owl of Minerva · Spengler · Tainter, complexity collapse
Tilly, capital↔coercion (1990) · Wallerstein, world-systems · Jefferson, primate city (1939) · Kennedy, imperial overstretch · urbicide
Site & situation · Fall line · Break-of-bulk point
Tero et al., Physarum / Tokyo rail, Science 2010 · Reilly's law (1931) · Levinson & Xie, co-evolution
Von Thünen rent R=Y(p−c)−YFm · Alonso bid-rent · Conzen burgage cycle / fringe belts · Burgess / Hoyt & Harris–Ullman
Christaller central place theory · Gabaix, Zipf for cities (1999) · Bettencourt et al., scaling, PNAS 2007 · David, path dependence · Bleakley & Lin, portage (2012)