The simple economy is now the default and the old simulation is frozen as the hard model, selectable per game. A nation keeps one resource pool available in every region, fed by public production works rather than private per-region stores, and construction and training begin at once, paced by the region's spare power instead of gathering materials over days. Money is euro only: a per-inhabitant daily tax funds a treasury spent in a global market, where buy and sell lots trade against the world stock and move its price. The hard economy keeps its per-nation currencies, central banks and exchange rates. Simple games skip the price-settling warmup and economic migration; the snapshot carries the economy model, the market and the pool figures the client draws. Added the matching test suites and the design briefs under docs/simple_economy.
5.1 KiB
5.1 KiB
02 — Global resource pool and public production
Depends on: 01-decoupling-hard-economy.md.
Goal
In the simple economy there is one pool of resources per player, available everywhere. Every production building is public: its output goes straight into the player's pool. There is no per-region storage, no transport, no trade graph, and no private building agents.
Current behaviour (hard economy)
shared/game_state/resources.jsseeds a per-tile store inresourceStock(_seedCityResources,_ensureResourceStock,getCityResourceStock) for cities and resource-building tiles. Four goods are storable; energy is a flow.- Production is local: tiles and resource buildings feed
resourceStock, and regions buy from neighbours or the global market through_procureFrom Neighbours,_nearbySuppliers,_resourceNodes,_resourceNodeAt, all bounded byRESOURCE_TRADE_RADIUSand the delivery/transport graph. - Production buildings are private agents (
shared/game_state/industry.js):buildingAgents(cash, debt, sales, upgrades),_creditBuildingCash,_chargeBuildingAccount,_payGridProducers,getPrivateBuildingCash. getRegionResourceInfo(city)(resources.js) is the per-region view used by the scenario seeding, the UI and (indirectly) the warmup.
Target behaviour
- Add
resourcePools: Map<civ, Stock>whereStockholds the four storable goods (steel,food,luxury,hightech) in canonical units. Decision to settle first: is energy pooled too? The construction rule in03-construction.mdneeds regional energy, and energy is currently a non-storable flow, so the recommendation is: keep energy a per-region flow and pool only the four storable goods. Record the decision in the file header when implemented. - Every player starts with a pool. Sizing is a scenario decision
(
scenario.js); for the simple economy, seed each pool with a comfortable working stock rather than a year of per-region consumption. A starting figure belongs in the simple-economy data module, not inline. - All production buildings are public. Their output adds to the owner's pool.
Retire the private-agent accounting in simple mode: no
buildingAgentscash, debt, sales window or demand-driven upgrade. Keep them working for hard. - No gathering phase. Any consumer (upkeep, construction, training, combat,
repairs, food) draws from the pool immediately.
03-and07-cover the draws; this module only needs the pool exists and production fills it. getCityResourceStock(city)in simple mode should either be removed from callers or return a read-only view of the owner's pool, so the UI and any surviving consumer keeps working. Prefer an explicitgetResourcePool(civ)and migrate callers; keep the old name only if it is widely used.getRegionResourceInfoshould be replaced in simple mode by a pool-based region view (production, consumption, energy). The scenario and UI both read it.
Files
shared/game_state/resources.js—_initResources,_seedCityResources,getCityResourceStock,getRegionResourceInfo, production application (_tickResourcesproduction pass). Prefer overrides in the simple module over editing hard paths.shared/game_state/industry.js— gatebuildingAgentsand the upgrade machinery behind!isSimpleEconomy(), or override_tickIndustry,getProductionAgents,getPrivateBuildingCash/DebtandresourceBuildingOutputAtcall sites in the simple module.shared/game_state/simple_economy.js— add the pool, seeding, production and the consumers' draw helpers.shared/game_state/scenario.js— seed pools for simple instead of the per-region year of reserves (_seedStartingReserves).shared/game_state/serialization.js— see10-snapshot-and-orders.md.
Acceptance criteria
- A simple game has exactly one pool per civ; no per-tile
resourceStockis read for procurement. - Public producers add to the pool; the totals shown for a player are the pool contents.
- Ordering a build/train in a simple game does not start a materials phase and
does not consult
_nearbySuppliers,_resourceNodes, the trade radius or the transport graph. - The hard game is unchanged.
Notes / decisions
- Energy pooling. Recommended: not pooled (regional flow), because
03-construction.mdkeys construction speed to the region's available energy. Confirm before implementing. - Food synthesis / famine. Food is currently synthesised from energy in hard
mode (
foodSynthesisQuadratic) and famine is per-region. Decide whether the simple pool keeps famine (pool empty → hungry) and whether synthesis stays. Recommendation: keep a global famine check when the pool's food is zero, and keep energy→food synthesis if it is cheap to retain; otherwise drop synthesis and let the pool be the only buffer. - Middlemen.
MIDDLEMANand_procureFromNeighboursbelong to hard; they are unreachable in simple mode. - Keep the daily ledger (
resourceSpend, consumption) for the UI even though there is no bidding; a global pool still has production and consumption to report.