Files
Battle-for-Tismo/docs/simple_economy/07-procurement.md
T
adrien d5305da449 Gave the world a simple economy: one pool per nation and a global market
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.
2026-09-25 14:58:49 +02:00

3.9 KiB

07 — Procurement from the pool, no bidding

Depends on: 01-, 02-.

Goal

All regions procure their resources from their player's global resource pool. There is no bidding, no local sourcing, no distance and no per-region pricing.

Current behaviour (hard economy)

  • Procurement is a cost-ordered search across reachable stores and the world market:
    • _procureFromNeighbours(city, id, amount, haul, nodes, opts)
    • _nearbySuppliers, _resourceNodes, _resourceNodeAt, _nodeSurplus
    • _tradeGraph / _cityMarketAccess (the expensive sea-lane flood, cached)
    • _marketUnitCost(id) = market price + energy freight per unit.
  • Consumers call the above from many places: _payConstructionResources, payCombatResources, _gatherSiteMaterials, _gatherBuildEntry, _drawFromNearest, _buyBuildingMaterials, plus food/upkeep in _tickResources and _consumeCityResources.
  • resourceSpend records what a nation bought/sold for the budget panel.

Target behaviour

  • In simple mode, procurement is a single subtraction from the owner's pool: _drawFromPool(civ, id, amount) returns what was available and decrements the pool. No ordering beyond resource id, no suppliers, no distance, no freight.
  • Replace each consumer's procurement call in simple mode with a pool draw:
    • building/training material bills (03-),
    • upkeep and city consumption in the daily tick,
    • combat and repairs,
    • anything that currently calls _procureFromNeighbours or _drawFromNearest.
  • No bidding. The old MONEY.bidPremium / maxBidMultiplier behaviour and _nearbySuppliers price escalation must never run in simple mode. If a consumer used to bid, it now simply takes from the pool; a shortfall is a shortage (the work stalls or the need goes unmet), never a higher price.
  • No transport bill. RESOURCE_RULES.deliveryEnergy, the trade graph and the delivery overlay are hard-economy concerns. Do not compute them in simple mode; skip _tradeGraph rebuilds entirely.
  • Keep the day's ledger (resourceSpend, consumption/production totals) so the Resources tab and budget can still report flows. Only the sourcing changes.
  • Prices for any valuation that remains (budget forecasts, combat material value) are the global market prices from 06-.

Files

  • shared/game_state/resources.js — _procureFromNeighbours, _drawFromNearest, _nearbySuppliers, _resourceNodes, _tradeGraph, _cityMarketAccess, _marketUnitCost, _tickResources consumer passes.
  • shared/game_state/sites.js — _siteBuy, _gatherSiteMaterials, _gatherBuildEntry, _siteUnreachableMaterials.
  • shared/game_state/industry.js — _buyBuildingMaterials, _buildingMaterialAvailability.
  • shared/game_state/simple_economy.js — _drawFromPool and the overrides.
  • tests/simple_procurement_test.js — new.

Acceptance criteria

  • Ordering a build/unit in simple mode never calls the trade graph or supplier search and never charges a transport premium.
  • Consumption and production move the player's pool by exact amounts.
  • A pool shortfall leaves the need unmet / the work stalled, with no price bid.
  • The hard economy procurement path is byte-for-byte unchanged.

Notes / decisions

  • Priority of draws. If several needs compete in one tick, define an order (e.g. food before industry before construction) so the simulation is deterministic. Recommendation: food/upkeep first, then industry inputs, then construction.
  • Shortage consequence. In hard mode a shortfall triggers shortagePopularityPenalty and grid throttling. Decide whether a pool shortfall keeps those penalties. Recommendation: keep the popularity penalty; drop the per-region grid throttle since energy stays regional and is handled in 03-.
  • _marketUnitCost for quotes. Where the UI quotes a delivered price, in simple mode it is just marketPrice(id) from 06-.