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

Price Indexing & Nominal Repricing

Last updated 2026-10-29
Source files

Summary#

Status: Partially shipped. The household price index exists and drives the real-income display, and the era campaign price level scales campaign costs and income. Full nominal repricing of constants remains a plan and is kept below under Rules as a proposal.

Player guide: Household Demand & Price Level (the shipped household price index and real-income display). The planned nominal repricing layer has no player page because it is not shipped.

Scope: a cumulative household price index per country, an era campaign price scalar, and (planned) a global weighted inflation series for the forex page plus a nominal-repricing layer for in-game constants (commodity base prices, action costs, startup capital).

Reviewed against: , , , , , , , , Currency Exchange.

Rules#

Shipped household price index#

Constant Value Source
HOUSEHOLD_PRICE_INFLATION_PASSTHROUGH 0.75
HOUSEHOLD_PRICE_INDEX_BASELINE 1
MIN_ANNUAL_INFLATION_PERCENT -100 (module-private, not exported)
TURNS_PER_YEAR 48
FOREX_AND_MACRO_CHART_HISTORY_TURNS 240 (TURNS_PER_YEAR * 5)
INERTIA (inflation smoothing, module-private) 0.35
MEAN_REVERSION_COEFF (module-private) 0.08
MODERN_PRICE_LEVEL 1

Per-turn household price factor, with x the settled annual CPI in percent (clamped to at least -100):

annualFactor = 1 + 0.75 * x / 100
factor = annualFactor ^ (stepFraction / 48)      (stepFraction = 1 for a full turn, 0.5 for the half tick)
index_next = max(epsilon, index_prev * factor)   (epsilon = Number.EPSILON)

A year held at CPI x therefore moves the index by exactly 1 + 0.75 * x / 100. When CPI changes between turns, each turn contributes its own 48th root of its own annual factor, so a year of varying CPI lands on the geometric mean of the observed annual factors. Worked example: CPI held at 4% for 48 turns gives annualFactor 1.03, so the index ends the year at 1.03 (not 1.04). Median income of 50,000 deflated by an index of 1.03 reads as 48,544 in launch-price terms (householdPriceAdjustedValue, which divides by the index).

The index is stored on federalBudget.economicFactors.householdPriceIndex and read by the real-economy outlook ().

Era campaign price level (shipped, separate from the index)#

A second shipped repricing: ERA_PRICE_LEVEL in scales campaign action fund costs and campaign income by world era so a 1953 world does not charge modern dollar amounts. It is gated by campaignEraPriceLevelEnabled on gameConfig; the shell reads it with the world preset in loadCampaignPriceLevel () and passes the resolved scalar into the pure cost formulas (getCampaignFundCost, fundraiseYieldAnchor and others in ). Values are the US nominal GDP per capita of the era divided by the 2019 value, rounded to 5 decimals.

Era Price level
1953 0.03673
1979 0.16688
1991 0.35808
1999 0.49707
2007 0.6562
2019 1
2023 1.14996
2027 1.28579

resolveCampaignPriceLevel(enabled, presetOrEra) returns 1 unless enabled === true. eraPriceLevelFor accepts an era id or a reset preset id; anything unrecognised folds onto the 2019 era and resolves to 1.

Planned nominal repricing layer (not shipped)#

Everything under this heading is a proposal. None of it exists in code: a search of src finds no priceLevels or priceLevelHistory collection and no nominalCredits resolver. Section numbers are kept so earlier references still resolve.

1. What the stored inflation value actually represents#

The per-turn budget.economicFactors.inflationRate is an annualized inflation estimate for this turn's conditions. It is not a measured trailing 48-turn rate. Inflation uses INERTIA = 0.35 plus mean reversion in .

The shipped country household index lives in . It starts at 1.0 and advances each turn by the 48th root of the annual passthrough factor (formula in the next section). The real-economy panel uses it to deflate median income. It does not yet reprice commodity bases, action costs, startup capital, or the other constants proposed later in this document.

Consequence: we cannot sum/average these values across turns to get "cumulative inflation." We need a separately-maintained price-level index.

2. Price-level index - math bridge#

Note on convention: This is a forward-looking compounding of a rolling annualized estimate - not a retrospective YoY. Document this so nobody later "fixes" it by replacing with a 48-turn trailing average (which would subtly change the meaning of the index).

3. Storage - a separate, uncapped collection#

CentralBank.inflationHistory is pruned to FOREX_AND_MACRO_CHART_HISTORY_TURNS (240 turns = 5 in-game years). A cumulative index must not live in a capped ring buffer or it loses its base.

Proposal:

Why two: the "current" doc gives O(1) reads for the repricing resolver (hot path); the history collection gives charting without inflating the central-bank document.

4. Global weighted inflation series#

For the forex page's per-turn global number:

π_global_t = Σ_c w_{c,t} × π_{c,t}

Market-cap weighting creates a feedback loop: high-inflation country → nominal market cap up → larger weight in global inflation → loops back into macro signals the chart plots. Options:

Weight Pros Cons
GDP (same-turn) Smoother, inflation-neutral in real terms Also drifts w/ nominal GDP growth
Real market cap (cap / own price level) Removes inflation feedback Adds one extra division, less intuitive
Lagged market cap (t-1) Simple, breaks tight feedback Still nominal; minor feedback at cycle scale
Market cap (same-turn) Most "financial-markets" flavor Strong feedback loop (reject)

Default for the cumulative global index: GDP-weighted. Acceptable for the forex-page YoY chart (where financial-market context is appropriate): lagged market cap, read from marketCapHistory.exchangeCaps via exchangeRegistry's 1:1 exchange↔country mapping. These can legitimately be two different series - label both clearly.

4b. Global price level#

Compound the weighted per-period factor into a global priceLevels row keyed _id: "global". Use the same weights each turn for internal consistency (weight by GDP share or cap share - don't mix per panel).

5. API + chart#

6. Nominal repricing layer#

6a. Rule#
6b. Per-country vs global deflator#

Default: per-country. A US player's action cost is scaled by US's price level; a JP player's by JP's. This is fairer cross-country.

Override to global: a small whitelist (effectively "the world market") - e.g. COMMODITY_BASE_PRICES, the anchor for commodityPressure. The resolver accepts "global" as an explicit scope.

6c. Forex baselines and commodity base prices are NOT repriced#
6d. What the resolver applies to (audit)#

The plan's "inventory" must be a grep-based discovery, not a guess. Starting commands:

grep -rn "funds:\s*[0-9]\|cashOnHand:\s*[0-9]" src/     # startup/hardcoded funds
grep -rn "estimatedCost\|COST\|_COST\s*=" src/lib        # action/fundraise cost constants
grep -rn "COMMODITY_BASE_PRICES\|basePrice\b" src/       # commodity anchors (most are off-limits - see 6c)
grep -rn "STARTING_\|INITIAL_\|DEFAULT_" src/lib/constants

For each hit, decide: (a) real constant → route through resolver, (b) already nominal balance → leave alone, (c) locked anchor (forex baseline, commodity base) → do not touch.

7. Feedback-loop check (mandatory before ship)#

Add a test that simulates a one-shot rate shock and verifies inflation/forex/commodity-pressure converge rather than diverge over, say, 100 turns. Flag anything that explodes.

8. Golden tests#

9. Phased sequencing#

  1. Math + storage - write priceLevels + priceLevelHistory, add the writer phase, seed one base snapshot. No consumers yet.
  2. Validate - let it run one game-day (48 turns) in dev; sanity-check that a flat 2% produces ~2% cumulative.
  3. Forex page series - add API fields + dedicated "Global inflation tracker" chart. Only after (2) is stable.
  4. Repricing layer - introduce nominalCredits() resolver; audit constants via greps in 6d; route real constants through the resolver. Nominal balances untouched.
  5. Docs - update currency-exchange.md and economic-systems.md with links to this doc and the weight-basis decision.

Data#

Collection and field Written by Read by Player-visible
federalBudget.economicFactors.householdPriceIndex runInflationRecalc (turn and half tick); seeded to 1 by unless the country config sets one countryEconomyOutlook.ts, the sim metrics in Indirectly: the real-economy panel shows median income deflated by it (RealEconomyPanel.tsx)
federalBudget.economicFactors.inflationRate runInflationRecalc the index writer (same call), the central bank snapshot Yes (inflation figures across the economy pages)
federalBudget.subhourStep, federalBudget.subhourBase.inflation half tick: stamp that the half step ran, plus the pre-step inflationRate and householdPriceIndex the next full turn, which restores the pre-step values before recomputing No
centralBanks.inflationHistory snapshotInterestRateHistory (), capped at 240 entries forex monetary-policy charts Yes (charts)
gameConfig.campaignEraPriceLevelEnabled seed and admin config loadCampaignPriceLevel No (changes costs and income)
gameState.preset world reset loadCampaignPriceLevel No

The index is a single number per country with no history of its own. Only the latest value is kept, so a past index cannot be read back except from backups.

Configuration#

Setting Default Where set
gameConfig.campaignEraPriceLevelEnabled true on fresh worlds and resets; absent (treated as off) on a world that never stamped it (type in )
economicFactors.householdPriceIndex in a country's budget seed config falls back to HOUSEHOLD_PRICE_INDEX_BASELINE (1)
Pass-through, baseline, inflation floor constants, no runtime override
Era price table constants; priceLevel.test.ts fails if they drift from the GDP baseline table

Timing#

The household index is advanced inside inflationRecalc (recalculateInflationPerTurn, called from ) immediately after that turn's inflation is settled, so it reads the settled rate. interestRateSnapshot runs later in the same phase file and independently. The half tick at :30 () calls the same function with stepFraction 0.5, advances the index by half a turn, and is stamped so a retried tick never applies twice. The next full turn finds the stamp, restores the pre-half-step index (restoreMultiplicative) and advances a full turn from there, so the half step is replaced, not added (inflationHalfStep.test.ts checks the turn lands where a no-tick turn lands). The era price level is not a turn pass; it is resolved at the shell boundary (action execute route and fund generation) from the world preset.

Worked trace#

Household index, one country, previous index 1.0, settled CPI 4%:

Step Calculation Result
Annual factor 1 + 0.75 x 4 / 100 1.03
Full-turn factor 1.03 ^ (1/48); ln 1.03 = 0.029559, divided by 48 = 0.000616 1.000616
Index after the turn 1.0 x 1.000616 1.000616
Half-tick factor 1.03 ^ (0.5/48) 1.000308
Two half ticks 1.000308 ^ 2 1.000616 (equals one turn)
After 48 turns at 4% 1.000616 ^ 48 1.03
Median income 50,000 in launch prices 50,000 / 1.03 48,543.69, shown as 48,544

Era price level, a 1953 world with the flag on, a campaign action at tier 2 with a regional multiplier of 1.0: round(round(20,000 x 2 x 1.0 / 1,000) x 1,000 x 0.03673) = round(40,000 x 0.03673) = 1,469. With the flag off the same action costs 40,000. (CAMPAIGN_BASE_FUND_COST is 20,000 in .)

Edge cases and limits#

Invariants#

Invariant Enforced by
The index is always finite and above 0 householdPriceIndex.test.ts ("clamps impossible deflation and keeps the index positive and finite", "never writes a non-finite level from an extreme prior")
A year at CPI x moves the index by exactly 1 + 0.75 x / 100 householdPriceIndex.test.ts ("compounds whole years multiplicatively")
A half tick compounds to half a turn; a retried half tick never double applies , rewindHalfTick.test.ts
Era table matches the GDP baseline table
CPI never reads the index Not enforced by a test; true by construction (the inflation calculation takes no price index input)

Failure and recovery#

The index is a running product, so a bad CPI value stays baked in. Typical failures: a corrupt or missing budget field (the writer falls back to the baseline 1, and the real-income panel reads as unadjusted), or a stuck half-tick stamp (the next full turn restores the stamped base and clears it). A wrong stored index is repaired by a data heal that rewrites the field on the affected country budgets, or by a reseed of the budget document, which restarts it at 1. Because no history is kept, a heal needs the intended value recomputed or taken from a backup.

Connections#

Driven by

Affects

Tests#

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask