A House Divided A House DividedDocumentation
↵
Changelog
Game Design/Economy & Finance

Resources & Extraction Contracts

Last updated 2026-10-29
Player wikiResources
Source files

Summary#

Extractable resources model sovereign ownership of natural wealth. States hold an extraction capacity ceiling (a daily basis, not a fixed per-turn amount); corporations can hold exclusive contracts that reserve a share of that capacity. Uncontracted capacity flows to all extraction sectors in the state, and a contract holder that wants more than its reserved share competes for that open pool too.

Player guides: Resources and Extraction Contracts.

Rules#

Extractable resources#

Six resources can be extracted, defined by EXTRACTABLE_RESOURCES in :

Resource Unit Typical role
Oil bbl Energy sector primary input
Coal tons Energy / industrial input
Iron tons Industrial / construction input
Natural Gas MMBtu Energy sector input
Timber m3 Construction / paper input
Rare Earth tons Tech sector strategic input; merged commodity (copper + rare earth minerals, demand-weighted blend)

These are a subset of the 27 commodity types tracked in the commodity pricing engine (Commodities, COMMODITY_TYPES in ). Standard commodities (steel, electronics, etc.) have no extraction capacity model. Copper is not a separate extractable resource; it was folded into rare_earth.

Constants#

Constant Value Source
GOVT_CONTRACT_MAX_TOTAL_SHARE 0.75 (total of offered plus active contract share per state and resource)
CONTRACT_SHARE_MIN / CONTRACT_SHARE_MAX 0.01 / 0.75
CONTRACT_ROYALTY_RATE_MIN / MAX 0 / 0.02 (fraction of contracted capacity market value per turn)
CONTRACT_TERM_TURNS_MIN / MAX 24 / 480 turns
CONTRACT_OFFER_EXPIRY_TURNS 24 turns
CONTRACT_DEFAULT_MISSED_PAYMENTS 3 missed royalty payments trigger default
PROSPECT_DURATION_TURNS 6 (scaled by era through prospectEraScaling)
PROSPECT_YIELD_MIN / MAX 0.03 / 0.08 of current capacity
PROSPECT_MAX_GAIN_FRACTION 0.2 of current capacity per survey
PROSPECT_MAX_ACTIVE_PER_INITIATOR 6
DEPOSIT_RESERVE_TURNS 1,920 (40 game years x 48 turns)
EXTRACTION_CAPACITY_HAIRCUT_TURNS 240 (fade-in window for the revenue haircut)
EXTRACTION_CAPACITY_HAIRCUT_FLOOR 0.5 (worst case realized factor)
RAMP_REANCHOR_DELTA 0.25 (a one-turn utilization drop that restarts the ramp)
EXTRACTION_UTILIZATION_MAX_RISE_PER_TURN 0.05 (module-private; falls apply at once)
CAPACITY_BINDING_THRESHOLD 0.9 (display and alerts)
Scarcity relief full relief at world supply/demand 0.5 or below, none at 1.0 or above, linear between haircutScarcityRelief,
Extractable resources 6 EXTRACTABLE_RESOURCES
Commodity types tracked 27 COMMODITY_TYPES

Capacity model#

Each state holds a stateResourceCapacity document specifying, per resource, the maximum extraction output ceiling in commodity units on a daily basis (the same basis as sector.revenue and capitalStock; a turn is a fraction of a day on the money timescale, so reading this as units/turn overstates the ration). Values are seeded from real-world production benchmarks and are updated via the admin panel.

stateResourceCapacity: {
  stateId: "TX",
  countryId: "US",
  resources: { oil: 300_000, natural_gas: 1_500_000, coal: 10_000, ... }
}

Every seeded state receives a capacity document. States without authored deposits receive an empty resources map, which gives them zero extraction capacity. Only a truly missing document uses the compatibility fallback of uncapped output.

Capacity is not strictly fixed over time. R&D breakthroughs for extraction corps permanently $inc per-resource capacity on the sector's state (see Corporations, "R&D Budget & Innovation"). The increase is weighted by the sector's active strategy supply map, so oil_gas breakthroughs grow oil + natural gas, iron_mining grows iron only, etc. This is by design: R&D "unlocks new deposits." States with no capacity document are still skipped: the innovation phase does not auto-insert docs. Prospecting surveys (, launchGovernmentProspect.ts) also raise capacity beyond the seed.

Deposit depletion (plants tier only)#

On worlds running the plants market tier, deposits are finite. Reserves are derived, not stored:

reserves(r)  = resources[r] x DEPOSIT_RESERVE_TURNS
remaining(r) = max(0, reserves(r) - extractedUnits[r])
ceiling(r)   = min(resources[r], remaining(r))

The ceiling only binds at the end of a field's life, so a deposit tapers off over its last turns. A prospecting survey that lifts resources[r] lifts derived reserves by the same multiple. Below the plants tier the raw documents are used and nothing is booked (depletedCapacityDoc is never called).

Extraction contracts#

A contract grants a named corporation an exclusive share (0% to 100%) of a state's capacity for a specific resource:

extractionContract: {
  stateId, countryId, corporationId, resource,
  share: 0.5,           // fraction of state capacity reserved
  grantedTurn, grantedBy, grantedByLevel: "state" | "national",
  revokedTurn?: number  // absent = active; set = revoked
}

Capacity multipliers#

computeExtractionCapacityMultipliers () returns Map<sectorId, Partial<Record<resource, 0..1>>>. Per state and resource, with C the capacity and S the sum of contracted shares:

openPool      = max(0, C x (1 - S))
for each contracted company:
  desired     = sum of its sectors' desired output (revenue-based output, capped by plantOutputCap where present)
  allocated   = min(desired, C x share)
  residual    = desired - allocated (spread over its sectors pro rata)
OA demand     = sum of open-access outputs + contracted residuals
poolFill      = 0 if openPool <= 0 or OA demand <= 0, else min(1, openPool / OA demand)
multiplier    = min(1, (reserved units + residual x poolFill) / output)

A lease is a reserved floor, not a ceiling: what a holder wants beyond its reserved share competes for the open pool on the same terms as everyone else (ticket 1619). Other branches:

Revenue haircut#

The multipliers also bite realized revenue (). Revenue-weighted utilization is sum(supplyRate_r x multiplier_r) / sum(supplyRate_r). The haircut fades in linearly over EXTRACTION_CAPACITY_HAIRCUT_TURNS from the first turn a sector is processed, is floored at EXTRACTION_CAPACITY_HAIRCUT_FLOOR, is relieved per resource by world scarcity, and utilization may rise by at most 0.05 per turn. Relief is capped by the raw physical capacity ratio so a sector cannot book revenue for ore the deposits cannot yield (scarcityReliefCappedUtilization).

Royalties and lifecycle#

royaltyDue (anchor) = royaltyRatePerTurn x share x stateCapacity[resource] x price

(royaltyDueAnchor, ). The corporation pays; the issuer treasury is credited and the amount counts as revenue.resourceRoyalties. A failed payment increments missedPayments; the third sets status: "defaulted" and revokedTurn. A successful payment resets missedPayments to 0. Term expiry (expiresTurn <= turn) takes precedence and charges nothing. lastRoyaltyTurn makes a retried phase idempotent.

Issuer offers (status "offered", offerExpiresTurn) -> counterparty accepts (signing fee, status "active", activatedTurn, expiresTurn)
  - decline, or offerExpiresTurn reached: status "declined" / "expired", revokedTurn set
Admin direct grant -> extractionContracts insert (may over-allocate)
Active -> royalties each turn -> expired (term) | defaulted (3 missed) | revoked

Contract changes are effective in the next commodityPrices pass.

API routes#

Method Route Auth Purpose
GET /api/contracts/extraction Public List active contracts (filterable)
POST /api/contracts/extraction Admin Grant a contract
DELETE /api/contracts/extraction/[id] Admin Revoke a contract (soft delete)
GET /api/states/[id]/resources Public State capacity + contracts + output
GET /api/map/resources Public Country-wide choropleth data
GET /api/admin/resource-capacity Admin List all capacity docs
PATCH /api/admin/resource-capacity/[stateId] Admin Set/update a state's resource capacity

GET /api/contracts/extraction query params: stateId, corporationId, resource, countryId.

Admin direct-grant path: POST /api/contracts/extraction can create a contract directly and is the only path that may over-allocate. Player-created contracts use the offer and acceptance commands instead.

Body:

{
  "stateId": "TX",
  "corporationId": "<24-char ObjectId>",
  "resource": "oil",
  "share": 0.5,
  "grantedBy": "<legislature ID>",
  "grantedByLevel": "state" | "national",
  "force": false
}

If the new contract would over-allocate and force is false, the server returns 409 with { overAllocated: true, needsConfirmation: true } without inserting. The client must re-submit with force: true to proceed.

UI surfaces#

Surface Location Read Admin actions
State Resources tab /country/[code]/region/[id]?tab=resources Capacity + contracts + output Grant / Revoke
Corporation Contracts section /corporation/[id] Own contracts -
National Congress Contracts tab /country/[code]/congress?tab=contracts Country contracts Grant / Revoke
Country map Resources mode /country/[code]/map Choropleth by capacity/allocation -

Key files#

Data#

Collection Fields Written by Player-visible
stateResourceCapacity stateId, countryId, resources (per-resource ceiling), extractedUnits (cumulative, plants tier), updatedAt () seed, admin PATCH, R&D $inc, prospecting, bookExtractionDepletion () Capacity, output and contracted share on the state Resources tab and map mode
extractionContracts stateId, countryId, corporationId, resource, share, grantedTurn, grantedBy, grantedByLevel, revokedTurn?, tenderId?, status? (offered, active, declined, expired, defaulted), signingFeeAnchor?, signingFeeAttemptKey?, signingFeeSettled?, royaltyRatePerTurn?, termTurns?, activatedTurn?, expiresTurn?, offerExpiresTurn?, missedPayments?, lastRoyaltyTurn?, updatedAt offer, accept, decline and revoke commands, contractSettlement, admin POST and DELETE Terms and status for the corporation and officials; the list is public; missedPayments is visible only to the corporation's owner and admins
gameConfig prospectingEnabled, contractIssuanceEnabled, treasuryCashLedgerEnabled admin config No

The in-memory multiplier map is not stored; it is rebuilt every commodityPrices pass. Contract documents join to corporations by corporationId.

Configuration#

Setting Default Where set
contractIssuanceEnabled true on fresh worlds and resets; absent means off ; read by . Gates offer, accept and decline routes and the contractSettlement phase
prospectingEnabled true on fresh worlds; absent means off same. Gates survey launch and the prospectingResolution phase
treasuryCashLedgerEnabled true on fresh worlds same. Switches signing fee and royalty to funded treasury cash
Plants market tier (marketSystemMode) per world gameConfig; turns on depletion, plant output caps and fuller revenue coupling in commodityPriceTurn.ts
extractionOutputScaleEnabled per world gameConfig; scales desired extraction units in extractionDesiredUnits
Contract and prospecting constants see Rules
Seed capacity per state unlisted states get an empty map (zero capacity)

Timing#

Extraction caps are applied in the commodityPrices phase (processCommodityPriceTurn, , listed in ). Phase order around it: prospectingResolution, macroCountryTurn, then bondTurn and commodityPrices (run in parallel), then contractSettlement. Contracts are read at the start of the price phase, so a contract granted or revoked during turn N is effective in turn N+1. Offer expiry, term expiry, royalty payment and default run afterwards in contractSettlement. The multipliers feed computeRawSupplyDemand, which produces the supply side of that turn's commodity price update; on plants worlds the depletion counter is incremented in the same pass.

Within the price phase: load capacity docs and active contracts for states with extraction sectors, build revenue-based inputs, ration (on depleted views when plants), book depletion, then compute supply and demand.

Worked trace#

State capacity for oil is 300,000 bbl daily. Corporation A holds one contract at share 0.5 and wants 200,000. Corporations B and C hold none and want 100,000 each. Plants tier off, so no depletion view.

Step Calculation Result
Open pool 300,000 x (1 - 0.5) 150,000
A reserved min(200,000, 300,000 x 0.5) 150,000
A residual 200,000 - 150,000 50,000
Open-access demand 50,000 + 100,000 + 100,000 250,000
Pool fill min(1, 150,000 / 250,000) 0.6
A multiplier (150,000 + 50,000 x 0.6) / 200,000 0.9
B and C multiplier (100,000 x 0.6) / 100,000 0.6 each
Total extracted 180,000 + 60,000 + 60,000 300,000 (equals capacity)

Royalty for A's contract at rate 0.01 and an anchor price of 80 per bbl: 0.01 x 0.5 x 300,000 x 80 = 120,000 anchor per turn, converted to the corporation's and issuer's currencies. Three misses in a row default the contract.

Depletion: capacity 300,000 gives reserves 300,000 x 1,920 = 576,000,000. After 575,900,000 extracted, remaining is 100,000, so the ceiling is min(300,000, 100,000) = 100,000.

Edge cases and limits#

Invariants#

Invariant Enforced by
Offered plus active player-issued share per state and resource never exceeds 0.75 issueContractOffer headroom check plus a post-insert re-check for races; computeContractedShare.test.ts, headroom/route.test.ts
Multipliers stay in 0 to 1 min(1, ...) in code; extractionCapacity.test.ts
Total granted output does not exceed capacity when not over-allocated extractionCapacity.test.ts cases; no runtime check
A retried royalty phase never double charges lastRoyaltyTurn guard; contractSettlement.test.ts, contractSettlement.ledger.integration.test.ts
Admin over-allocation requires explicit confirmation extraction.integration.test.ts

Failure and recovery#

Typical failures: a state with no capacity document (extraction runs uncapped and inflates supply), a stuck royalty settlement (the corporation is debited but the issuer credit fails; the code refunds the debit and rolls back the stamp so the next run charges again), and an over-allocated state starving open-access miners. Repairs are a reseed of the capacity table for missing documents, a heal that rewrites a wrong share or status on a contract, or an admin revoke (soft delete) of the offending contract. Depletion counters can be reset by a heal of extractedUnits if a bad run over-booked.

Connections#

Driven by

Affects

Related: Commodities (pricing engine that consumes extraction output) and Corporations (sectors that produce commodity supply).

Tests#

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask