A House Divided A House DividedDocumentation
↵
Changelog
Game Design/World & Simulation

Crisis System

Last updated 2026-10-29
Source files

Crises are dynamic events that modify state metrics, government approval, and corporate profit margins across affected regions. They can be one-time shocks (flat effects) or ongoing situations (tick effects).

Summary#

Player guides: Crisis Interaction (templates, decision trees, collective contributions, auto-spawning) and Global Response Crises (chained multi-country crises). The bloc-alignment flashpoints in the second half of this page are described for players in Bloc Spheres. For the multi-country campaign engine see global-response-crises-as-shipped.md.

Rules#

Every constant this page relies on, with its source.

Constant Value Source
Tick decay 1 - elapsed / duration, clamped to 0..1; indefinite crises stay at 1 tickDecayFactor in
Flat effect timing Only when turn === crisis.startTurn
gdpLoss fraction clamp 0 to 0.95 per effect; several losses multiply applyGdpLossEffects in
Profit margin clamp 0 to 100 applyProfitMarginEffects in
Character stat clamp 1 to 10 applyStatEffects in
Collective contribution shortening floor(duration x min(1, current / target) x 0.5) turns; 0 when the target is missing or not positive collectiveDurationReduction in
COLLECTIVE_MAX_DURATION_CUT 0.5
Decisive-option shortening sum of durationReductionTurns over the distinct options chosen (each option id counted once) calculateDecisionDurationReduction in
Minimum effective duration 1 turn
MIN_CRISIS_DURATION_TURNS 24 (every finite template or auto-disaster duration is raised to this; null stays indefinite)
CRISIS_FLAT_UNIT_SCALE / CRISIS_TICK_UNIT_SCALE 100 / 30 (authored fractional swing times this gives the stored native delta)
MAX_AUTO_CRISES_PER_TURN 1
DEFAULT_DISASTER_COOLDOWN_TURNS 144
AUTO_DISASTER_CADENCE_TURNS 144 turns between automatic disasters per country, staggered by a hash of the country id
AUTO_DISASTER_DEFAULT_DURATION_TURNS 24
AUTO_DISASTER_MARGIN_PENALTY -10 percentage points, decaying linearly to 0 at expiry ,
Weather disaster treasury loss round(smoothed GDP x 0.0002 x climateLossMultiplier(pressure, resilience))
BOARD_DELTA_CAP / BOARD_TICK_DELTA_CAP 12 / 12 / MIN_CRISIS_DURATION_TURNS = 0.5 per turn, the cap on political metric board bends
sectorGrowth shock bounds -10 to 15 (SECTOR_SIGNAL_MIN / SECTOR_SIGNAL_MAX) ,
MAX_OPEN_CRISES (alignment) 3
CRISIS_WINDOW_TURNS (alignment) 12
TUG_OF_WAR_MIN_SHARE (alignment) 25 share points for the runner-up pole
DEFECTION_CRISIS_AT SUSTAIN_TURNS / 2 = 12 turns (SUSTAIN_TURNS = 24) ,
ALIGNMENT_GATES locked 85, nonAligned 20
PER_NATION_TURN_CAP / CRISIS_TURN_CAP 5 / 7.5 alignment points per nation per turn

Crisis Structure#

Core Fields (crises collection)#

Field Type Description
name string Display name (e.g., "Northeast Blackout", "Financial Crisis")
description string Full description of the crisis
scope "global" | "country" | "region" Geographic scope
countryIds CountryId[] Affected countries (when scope = "country" or "region")
regionIds string[] Affected states/regions (when scope = "region")
status "active" | "resolved" Current status
startTurn number Game turn when crisis activated
endTurn number | null Game turn when resolved (null while active)
durationTurns number | null Duration in turns; null = indefinite
effects CrisisEffect[] Array of effect definitions
wireMessageOnStart string Wire event message when crisis starts
wireMessageOnEnd string | null Wire event message when crisis ends

Crisis Effect Structure#

Each effect defines what changes and how often it applies:

Field Type Description
effectType "flat" | "tick" | "decay" flat: applied once on start turn only; tick: applied every turn while active, ramping down toward expiry; decay: skipped by crisisTurn.ts; used only for profitMargin effects, which the corporation turn applies as a linearly fading penalty (see Decay effects below)
targetType "metric" | "approval" | "profitMargin" | "inflation" | "gdpLoss" | "stat" What the effect modifies
statKey string | undefined For stat effects: which character stat to target (charisma, debate, energy, etc.)
metricCategory string | null Category name (e.g., "economic"), for metric effects
metricField string | null Field name (e.g., "unemploymentRate"), for metric effects
sectorType string | null Corporation sector type filter, for profit margin effects; null = all sectors
strategyId string | null Operating strategy filter, for profit margin effects; null = all strategies
value number Effect magnitude. Negative = penalty; positive = bonus. Profit margin = percentage points. For gdpLoss, the fraction of regional GDP destroyed (e.g. 0.03 = 3%)
physicality "physical" | "financial" | undefined For profitMargin effects under the plants market tier: physical reads value as a production haircut instead of a margin hit. Absent = financial (legacy margin-only)
label string Display name for the effect (e.g., "Unemployment spike")

Built-in templates () author metric, approval and inflation effects as fractional swings and convert them with toNativeEffectValue: a flat swing of -0.03 is stored as -3, a tick swing of -0.02 is stored as -0.6 per turn. profitMargin (already in points) and gdpLoss (already a fraction) are not scaled. The gdpLoss template helper always authors effectType: "flat".

Scope Resolution#

Crises resolve their geographic scope to a list of target state IDs:

Scope Resolution
"global" All states in all countries
"country" All states in the specified countryIds
"region" Only the specified regionIds (state IDs like "CA", "TX")

Effect Types#

Flat Effects#

Applied once on the turn the crisis starts (turn === crisis.startTurn):

// Example: Sudden unemployment spike
{
  effectType: "flat",
  targetType: "metric",
  metricCategory: "economic",
  metricField: "unemploymentRate",
  value: 2.5, // +2.5% unemployment
  label: "Job losses"
}

Tick Effects#

Applied every turn while the crisis is active:

// Example: Ongoing economic recession
{
  effectType: "tick",
  targetType: "metric",
  metricCategory: "economic",
  metricField: "gdpGrowth",
  value: -0.1, // -0.1% GDP growth per turn
  label: "Economic contraction"
}

Tick Decay#

Tick effects don't hold full strength for the crisis's whole life, for crises with a finite durationTurns, tickDecayFactor() () linearly ramps the applied value from 1.0x at startTurn down to 0x at expiry (50% at the midpoint):

export function tickDecayFactor(turn: number, startTurn: number, duration: number | null): number {
  if (duration === null || duration <= 0) return 1;
  const elapsed = turn - startTurn;
  return Math.max(0, Math.min(1, 1 - elapsed / duration));
}

Indefinite crises (durationTurns null or <= 0) never decay, they apply their tick effects at full strength every turn until manually resolved.

Why decay exists: a shock fades as the economy adapts, so a long crisis hurts most at the start and eases toward its end rather than ending in a cliff. The scale uses the effective duration, so a crisis shortened by player responses (below) also decays faster. Flat and gdpLoss effects are not scaled; they fire once at onset.

Shortening a crisis. If the crisis carries an interactionDefinition and the interaction exists, effectiveDuration = max(1, durationTurns - reduction), where reduction is the collective-contribution reduction (up to half the duration when the shared target is fully funded) plus any durationReductionTurns from decisive options taken. Expiry is checked against effectiveDuration. Multi-responder (global) crises earn no decisive-option reduction, because each leader answers only for their own country and the shared resolutionPath is never written.

Target Types#

Metric Effects#

Modify state metrics. The write target depends on the metric path:

Approval Effects#

Modify government approval rating at the country level:

// Example: National crisis reduces government approval
{
  effectType: "tick",
  targetType: "approval",
  value: -0.5, // -0.5% approval per turn
  label: "Public discontent"
}

Profit Margin Effects#

Modify corporate sector profit margins in the corporateSectors collection:

// Example: Power grid failure hits all sectors
{
  effectType: "tick",
  targetType: "profitMargin",
  sectorType: null, // all sectors
  strategyId: null, // all strategies
  value: -5, // -5% profit margin per turn
  label: "Power outage costs"
}

Decay effects (margin penalty)#

decay profitMargin effects never write to the stored margin. crisisTurn.ts filters them out; instead the corporation turn reads active crises through buildDisasterEffectsByState and subtracts a transient penalty value x (turnsRemaining / durationTurns) for each (computeDisasterPenaltySplit, ), summed across overlapping disasters. Automatic regional disasters rewrite their template margin effects as decay effects (buildRegionalDisasterEffects, ), or add the generic -10 point shock when the template has none. Under the plants market tier a physical effect becomes a production factor max(0, min(1, 1 + P / 100)) where P is the summed physical penalty (disasterProductionFactor).

Inflation Effects#

Modify country-level inflation via applyInflationEffects(): the summed delta is added to federalBudget.economicFactors.inflationRate of each affected country (deduplicated like approval). The per-turn inflation recalculation then blends the shock through inertia, so it decays over following turns. See Economic Systems.

GDP Loss Effects#

One-time, real output destruction (physical-destruction disasters): value is the fraction of the affected region's GDP destroyed (e.g. 0.03 = 3%), applied as a $mul on state.gdp so the economy regrows from the reduced base afterward, the loss persists across turns, unlike a metric effect on economic.gdpGrowth which only drags the growth rate. The shipped helper authors gdpLoss as a flat effect, which is what limits it to startTurn: crisisTurn.ts selects effects by effectType (flat only on the start turn, tick every turn) before routing by targetType.

Stat Effects#

Target a specific character stat (statKey: charisma, debate, energy, etc.) via applyStatEffects(). Active characters (retiredAt: null) in scope lose the absolute value of the effect from the stat, clamped to 1 through 10. Country scope matches currentOffice.countryId; region scope matches currentOffice.stateId.

Crisis Catalog and Bloc-Alignment Crisis Chains#

There is a second, distinct crisis subsystem for the bloc-alignment game (, , ), Cold War flashpoints that raise a target nation's alignment-movement ceiling while open, rather than mutating macroMetrics/governmentApprovals/corporateSectors directly. It stores its documents in a separate alignmentCrises collection (getAlignmentCrisesCollection), not crises.

Catalog#

AUTHORED_CRISES (crisisCatalog.ts) is a fixed list of historical anchors, each gated to an inclusive era window (minYear-maxYear) and a preferred targetEntityId: Hungarian Rising (HU, 1956-58), Suez Intervention (EG, 1956-58), Berlin Flashpoint (DD, 1958-63), Missile Standoff (CU, 1962-64), Prague Spring (CS, 1968-70). authoredCrisesForYear(year) filters the catalog to crises whose window contains the current year.

EMERGENT_CRISES defines two world-condition-driven kinds instead of calendar-driven ones: emergent.defection (a bloc member visibly trying to leave) and emergent.tugOfWar (a country two blocs are both heavily invested in).

Per-Turn Chain Resolution#

Each turn, closeDueCrises() and openDueCrises() () run the crisis lifecycle:

  1. Close due crises, any crisis with status: "open" and closesTurn <= currentTurn resolves (status: "resolved", resolvedTurn stamped).
  2. Open new flashpoints, up to MAX_OPEN_CRISES = 3 concurrently (slots = 3 minus those still open), in strict precedence order:
    • Authored anchors fire once each per world (any earlier crisis document of the same kind, open or resolved, blocks a repeat), gated by era window. If the anchor's preferred target is not movable (lead at or above ALIGNMENT_GATES.locked = 85, or absent from the world) or already claimed this turn, it retargets to the most contested movable nation instead of fizzling (retargetedFrom records the original target). Egypt and Cuba are deliberately kept in the catalog though neither is an implemented country, an authored crisis targeting them retargets to a real flashpoint.
    • Defection crises open for any bloc member that has wanted out for at least SUSTAIN_TURNS / 2 turns (DEFECTION_CRISIS_AT).
    • Tug-of-war crises open for any nation two poles are both contesting (tugOfWarCandidate()): the runner-up holds at least 25 share points and trails the leader by no more than ALIGNMENT_GATES.nonAligned (20).
  3. Each opened crisis gets a closesTurn of currentTurn + CRISIS_WINDOW_TURNS. Only one open crisis per nation.

The contest ranking used for retargeting is contestRank = second * 2 - (top - second) over pole shares ().

A crisis itself pays out nothing directly, while open, it raises its target's movement ceiling (openCrisisTargets() feeds CRISIS_TURN_CAP elsewhere in the alignment turn phase), so ordinary sphere-projection plays against that nation can move further than anywhere else. A crisis nobody acts on changes nothing.

See bloc-alignment-and-spheres.md for the surrounding bloc-stress/sphere-projection system this feeds into.

Turn Processing#

Handled by processCrisisTurn() in :

Phase Action
Load active crises Fetch all crises with status: "active"
Resolve scope Convert scope + countryIds/regionIds to target state IDs
Apply flat effects Only if turn === crisis.startTurn
Apply tick effects Every turn while active
Apply metric effects Clamped pipeline update to macroMetrics; political board bends
Apply approval effects $inc to governmentApprovals by country
Apply profit margin effects Update corporateSectors with clamping
Apply inflation, gdpLoss, stat effects $inc on federalBudget, $mul on states.gdp, stat bulkWrite on characters
Wire events Emit crisis_start on activation, crisis_end on resolution
Auto-resolve Mark expired crises as resolved when turn >= startTurn + effectiveDuration

Wire Event Integration#

Crises emit wire events for real-time notifications:

// On activation (start turn only)
logWireEvent("crisis_start", crisis.wireMessageOnStart, {
  href: `/world/crises/${crisis._id.toString()}`,
});

// On resolution (auto or manual)
logWireEvent("crisis_end", crisis.wireMessageOnEnd, {
  href: `/world/crises/${crisis._id.toString()}`,
});

Players with active characters whose homeState is in the affected states also receive an inbox notification (crisis on start, crisis_resolved on end) through notifyAffectedPlayers. The end notification is its own type so it stays out of the action-required filter.

Lifecycle#

  1. Creation: Admin creates crisis via admin panel or API
  2. Activation: Crisis effects apply immediately on next turn processing
  3. Duration: Tick effects apply each turn; flat effects only on start turn
  4. Resolution:
    • Auto: When turn >= startTurn + effectiveDuration (if durationTurns is set)
    • Manual: Admin marks as resolved via admin panel
  5. Cleanup: Resolved crises remain in database for historical reference

Admin Management#

Crises are created and managed via admin routes (not yet documented in public API):

Example Crises#

Financial Crisis (Country-wide, tick effects)#

{
  name: "Financial Crisis",
  description: "A severe banking crisis spreads across the nation",
  scope: "country",
  countryIds: ["US"],
  status: "active",
  startTurn: 480,
  durationTurns: 96, // 2 years
  effects: [
    {
      effectType: "tick",
      targetType: "metric",
      metricCategory: "economic",
      metricField: "gdpGrowth",
      value: -0.2,
      label: "Economic contraction"
    },
    {
      effectType: "tick",
      targetType: "metric",
      metricCategory: "economic",
      metricField: "unemploymentRate",
      value: 0.05,
      label: "Job losses"
    },
    {
      effectType: "tick",
      targetType: "approval",
      value: -0.25,
      label: "Government blame"
    }
  ],
  wireMessageOnStart: "A financial crisis has gripped the nation",
  wireMessageOnEnd: "The financial crisis has ended"
}

Regional Drought (Region-specific, flat + tick)#

{
  name: "California Drought",
  description: "Severe drought conditions impact agriculture",
  scope: "region",
  regionIds: ["CA", "NV", "AZ"],
  status: "active",
  startTurn: 500,
  durationTurns: 48, // 1 year
  effects: [
    {
      effectType: "flat",
      targetType: "metric",
      metricCategory: "infrastructure",
      metricField: "waterSupply",
      value: -20,
      label: "Water shortage"
    },
    {
      effectType: "tick",
      targetType: "profitMargin",
      sectorType: "agriculture",
      value: -3,
      label: "Crop failure costs"
    }
  ]
}

Key Files#

File Purpose
TypeScript interfaces for Crisis and CrisisEffect
Turn processing: effect application, auto-resolution
Unit tests for crisis turn processing
Wire event logging for crisis start/end
Decaying margin and production penalty from decay effects
, autoDisasterSpawn.ts Automatic crisis and disaster spawners
Authored + emergent bloc-alignment crisis catalog
Bloc-alignment crisis open/close lifecycle
Alignment crisis helpers (mostContested, tugOfWarCandidate)

Data#

crises collection#

Written by admin creation, the template creator and the auto-spawners; updated by crisisTurn on resolution. Player-visible on the World Crises page, the wire feed and inbox notifications.

Field Type Description
_id ObjectId Document ID
name string Crisis name
description string Crisis description
scope string "global", "country", or "region"
countryIds string[] Affected country IDs
regionIds string[] Affected state/region IDs
status string "active" or "resolved"
startTurn number Activation turn
endTurn number | null Resolution turn
durationTurns number | null Duration in turns
effects array Crisis effect definitions
wireMessageOnStart string Start wire event message
wireMessageOnEnd string | null End wire event message
createdBy ObjectId | null Admin who created; null for automatic crises
createdAt Date Creation timestamp
resolvedAt Date | null Resolution timestamp

Optional fields set by other paths: autoGenerated, autoSource (disaster, condition, random), templateKey, autoDisasterFiscalCost, interactionDefinition (decisionTree, autoResolveOnExpiry), chain, globalResponse, livingConflictEventId, lastUndergroundExtensionTurn, heroImage.

Other collections touched#

Collection Fields Access Player-visible
macroMetrics economic.*.value, population.*.value, lastUpdated written (metric effects) yes, as national and state metrics
political metric boards (PoliticalMetricsDoc) board value through applyBoardDelta written yes
governmentApprovals approvalRating written ($inc, no clamp) yes
corporateSectors profitMargin, stateId, strategyId, sector filter read, written yes
federalBudget economicFactors.inflationRate, economicFactors.lastUpdated; treasuryBalance, disasterFiscalReceipts (weather loss) written yes
states gdp ($mul) written yes
characters stats, homeState, currentOffice, retiredAt read, written (stat effects) yes
crisisInteractions decision state, collectiveCurrent, collectiveTarget, resolutionPath read; closed on crisis resolution yes, as decision cards
crisisAutoCooldowns lastSpawnTurn, armed read, written by spawners no
gameState flags listed under Configuration read no
alignmentCrises kind, targetEntityId, title, headline, openedTurn, closesTurn, status, resolvedTurn, retargetedFrom, createdAt read, written yes, on the alignment desk
notifications crisis, crisis_resolved types, metadata.crisisId written yes

Configuration#

All flags live on the single game state document (gameState, _id: "current", type in ) and are admin toggles. A flag that is absent counts as off unless stated.

Setting Default Effect Read in
crisisInteractionEnabled off Creates crisisInteractions on the start turn and auto-resolves expired interactions. Off: crises still apply effects, with no decision cards src/lib/crises/featureFlag.ts,
autoDisastersEnabled off Master switch for both automatic spawners (regional disasters and condition/random crises) ,
autoCrisisPaused off Stays enabled but spawns nothing this turn (the climate feedback still advances for disasters) same
crisisSpawnChanceMultiplier 1 (anything not a positive number counts as 1) Multiplies each random-tier template spawnChance; condition-tier crises are unaffected. Used by simulations
crisisAidBillsEnabled off Aid bills for crises src/lib/crises/featureFlag.ts,
livingConflictsEnabled off Living-conflict events materialize as crises and retire the legacy Vietnam crises
conflictsEnabled off Syncs the Vietnam front combat document
corporationActionsPaused false Skips both spawner phases, so cadence is not wasted on an inert economy
Template fromYear / untilYear none Era window against the live currentYear; fails open when the year is missing
Template disasterCooldownTurns 144 Per template and scope cooldown
Template autoTrigger, spawnChance, cooldownTurns per template Condition and random spawn tiers
Effect physicality absent (= financial) Plants tier only; absent keeps legacy margin-only behaviour

There are no per-country or per-era presets for the national engine itself; era shows up only through template windows and the alignment catalog's year windows.

Timing#

resourceAndFinanceStart: autoDisasterTurn -> autoCrisisTurn      (create crises, startTurn = this turn)
   ...
alignment:               closeDueCrises -> caps use open targets -> drift -> openDueCrises
   ...
fiscalYearBoundary
stateEffectsAndNationalAggregation:
   crisisTurn  (aid bills, living conflicts, Vietnam chain, then effects, announce, expiry, chain)
   -> ministerialOrders -> policyEffects (reads crisis-shocked values)
   -> metricEngine (sectorGrowth carries the GDP rate shock) -> nationalMetrics
   -> inflationRecalc (blends the inflation shock)
corporation turn: decay margin penalty read from active crises

Worked trace#

Case 1, tick decay and shortening. A country-scope crisis spawns from a built-in template that authors an approval tick swing of -0.02 and a duration of 24 turns (already at the 24-turn floor).

  1. Stored value: toNativeEffectValue("tick", -0.02) = -0.02 x 30 = -0.6 approval points per turn at full strength.
  2. At elapsed 6 turns with no responses: tickDecayFactor = 1 - 6/24 = 0.75, so the applied delta is -0.6 x 0.75 = -0.45, summed with any other approval effects and added to governmentApprovals.approvalRating for each affected country once.
  3. Whole life with no responses: ticks run at elapsed 0 to 24 (the last at factor 0). Factors sum to 25 - (24 x 25 / 2) / 24 = 12.5, so total approval lost is 0.6 x 12.5 = 7.5 points.
  4. If players raise half of a collective target: reduction = floor(24 x 0.5 x 0.5) = 6, effectiveDuration = max(1, 24 - 6) = 18. Ticks run at elapsed 0 to 18; factors sum to 19 - (18 x 19 / 2) / 18 = 9.5, so the total is 0.6 x 9.5 = 5.7 points. The crisis resolves on the turn startTurn + 18.

Case 2, the Financial Crisis below (durationTurns 96) carries a tick effect of -0.25 approval per turn and -0.2 GDP growth per turn.

Turns since start Decay factor Approval per turn GDP growth per turn
0 1.00 -0.250 -0.200
24 0.75 -0.1875 -0.150
48 0.50 -0.125 -0.100
72 0.25 -0.0625 -0.050
96 0.00 0 0

Total approval lost over the crisis: 0.25 x (96 - (0 + 1 + ... + 95) / 96) = 0.25 x (96 - 47.5) = 12.1 points, versus 24 points if the effect did not decay. If players fully fund a collective target, reduction = floor(96 x 1 x 0.5) = 48, the effective duration becomes 48, the decay runs twice as fast, and the total approval loss falls to 0.25 x (48 - 23.5) = 6.1 points. An admin-created crisis skips its start-turn tick, so its first tick is at elapsed 1 and its totals are one full-strength tick smaller (11.9 and 5.9).

Case 3, compounding GDP loss. A region with gdp 200,000,000 is hit on its start turn by two gdpLoss effects of 0.02 and 0.03. factor = (1 - 0.02) x (1 - 0.03) = 0.9506, applied as $mul on states.gdp: 200,000,000 becomes 190,120,000. Nothing happens on later turns, and the sector growth model regrows from the smaller base.

Case 4, decay margin penalty. An automatic disaster has durationTurns 24 and the generic value -10. At 6 turns after startTurn, turnsRemaining = 18, so the sector margin penalty is -10 x 18 / 24 = -7.5 points, computed fresh each turn and not stored. At expiry it is 0.

Edge cases and limits#

Invariants#

Failure and recovery#

Connections#

Driven by:

Affects:

Related documentation:

Tests#

File Covers
tick and flat timing, tick taper, auto-resolve, indefinite crises, wire events, scope, approval parent country, clamp, gdpLoss once, sectorGrowth redirect
decay margin effects never write the stored margin
year-gated conflict and chain openings use the turn's calendar year, and do not double-open on replay
collective and decisive duration reduction, interaction lifecycle
24-turn minimum duration
decaying margin and production penalty
, autoCrisisRearm.test.ts, autoCrisisEraGate.test.ts, autoDisasterSpawn.test.ts spawn caps, cooldowns, re-arm, era windows, disaster cadence
, templates.test.ts effect scaling and template integrity
, contest ranking, open and close lifecycle, retargeting, cap

Gaps: no test drives stat or inflation effects through processCrisisTurn; the political board branch of metric effects is covered only through ; no test pins the order of alignment crisis opening relative to movement caps.

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask