A House Divided A House DividedDocumentation
↵
Changelog
Game Design/Legislature & Parties

Policy System

Last updated 2026-10-29
Source files

How policy positions work at two levels, a character's personal stance and the enacted status quo per legislation type, and how enacted policy moves state and national metrics and demographics every turn.

Summary#

Player guide: Policy Effects (enacted policy and metric effects). For two-axis party positions see Party Ideology. No wiki page is dedicated to the personal policy shift action.

The policy system tracks where characters and the game world stand on policy issues across two dimensions: economic (fiscal/regulatory spectrum) and social (cultural/rights spectrum). These positions are stored at two levels:

  1. Character policy positions - each player character's personal stance on the economic and social axes (-5 to +5)
  2. State/national policy records - the current legislative status quo per legislation type, stored in the statePolicies collection (-3 to +3 per axis)

The two levels are related but distinct. A character's personal positions affect how demographic groups vote in elections and how visible policy alignment is to voters. The statePolicies records reflect what the government has actually enacted through legislation and drive ongoing metric effects each turn.

Scope note: the legacy metric loop in processStatePolicyEffects skips countries that run the political metrics board (US, UK, RU, DD and the non-playable boards, see Edge cases and limits). The demographic effects engine runs for every country.

Rules#

Player policy positions#

Scale#

Each character has a policies object with two numeric fields:

interface PolicyPositions {
  economic: number; // -5 to +5
  social: number; // -5 to +5
}

Changing positions: policy shift action#

Players shift their policy position one step at a time via POST /api/settings/policy ().

Parameter Values
axis "economic" or "social"
direction 1 or -1
useVoucher optional boolean, default false

Cost per shift:

Resource Cost
Actions 15 (POLICY_SHIFT_ACTION_COST)
Political Influence -5% (floor 0; floor(current x 0.95))
National Influence -5% (same formula)
Infamy +5 (POLICY_SHIFT_INFAMY_COST), clamped to 0 to 100

The new value is the old one plus or minus 1; a request that would pass -5 or +5 is rejected with a 400 error and the character is not charged (the bound is part of the atomic update filter).

The 15, 5 and 0.95 values are POLICY_SHIFT_ACTION_COST, POLICY_SHIFT_INFAMY_COST and POLICY_SHIFT_INFLUENCE_MULTIPLIER in . A shift can instead be paid with one position update voucher (useVoucher: true), which costs 0 actions, 0 infamy and no influence loss (multiplier 1) and takes one from positionUpdateVouchers. Vouchers are granted one at a time (POSITION_UPDATE_VOUCHER_GRANT_AMOUNT = 1). A policy_shift achievement is awarded on the first successful shift.

Changing positions: bill votes#

Voting on a bill shifts the voter's own policy positions (). The bill's position on each axis is the average of its provisions that take a stance there (omitted and 0 values are ignored). An aye vote moves the voter toward the bill by VOTE_SHIFT_STEP = 0.25 per axis, never past the bill's position; a nay vote moves them away by 0.25; an abstention, an axis with no stance, or a voter already on the bill's position does not move. Results are clamped to -5..+5 and snapped to the 0.05 grid.

A per-bill ledger (policyShiftLedger.<characterId> on the bills or stateBills document) stores the voter's baseline before this bill first moved them and what was applied. Every later change of vote is computed from the baseline and only the difference is added, so the net effect of one bill never exceeds one step, an abstention after an aye or nay reverts what that vote applied, and shifts from other bills in between are kept. A vote cast through a party whip never moved the voter's positions and does not count as a prior vote (personalPreviousVote). A vote recorded before the ledger existed is left alone when changed (shouldApplyVoteShift).

State and national policy tracking#

Collection: statePolicies#

Each record in statePolicies represents the current legislative standing for one legislation type, either at the national level or for a specific state or region.

Fields the policy API reads (StatePolicyRecord, ):

Field Type Description
scope "national" | "state" Whether this record is a country-level position or a state-level position
stateId string (optional) Present when scope = "state" (e.g. "CA", "TX")
legislationTypeId string References a LegislationType._id
economic number (-3 to +3) Economic axis position; 0 = center
social number (-3 to +3) Social axis position; 0 = center
updatedAt Date Last modification timestamp

The turn engine reads the richer enacted-bill record (StatePolicy, ), which also stores policyOptionId, policyOptionIndex, enactedTurn, effectDirection (-1, 0, +1), countryId and enactedBy (kind: bill, order or expiry). Country-level rows use pseudo state ids: federal (US), uk_national, jp_national, de_national.

Legislation types marked nationalOnly: true only have national-scope records. Types with allowedScope: "both" or "state" have per-state records.

Seeding#

Base policy records come from (re-exported by ) and are written by :

Position matching#

The statePolicies position (economic, social) is an integer pair, not a named label. The API matches this pair against the legislation type's policyOptions array to return a human-readable policyOptionName (findMatchedOption, ):

Policy to demographics (elections)#

Character policy positions are compared to the leans of each demographic group when calculating vote appeal. The live appeal curve uses exponent 1.5 (APPEAL_POSITION_EXPONENT, ), not the retired squared/gamma=2 curve. For the exact formula and pipeline, see elections.md - specifically the Appeal step in the Total Appeal System.

Candidates closer to a demographic group's lean on the economic and social axes receive higher appeal scores with that group, which translates to a larger share of that group's votes per turn during general elections.

Policy to legislation (bills and archetype approval)#

When a bill is enacted, each provision's legislation type carries economic and social scores that define the ideological direction of that policy shift. This information is used in two ways:

  1. State metrics: applyLegislationEffect() applies the provision's delta to the relevant state or national metrics via effectTarget.
  2. Archetype approval: Legislators who voted FOR the enacted bill receive approval changes from their demographic archetypes. The impact is calculated from the difference between the old and new policy index for that legislation type, multiplied by each archetype's domain affinity. For the full formula, see bills-legislation.md - the Archetype Approval Impacts section.

Active statePolicies records also drive per-turn metric effects through policyOptions[].metricEffects. Each turn a policy is in effect, the matched option's metricEffects array applies direct additive changes to specific state or national metrics (e.g. -0.04%/turn to uninsured rate while a given healthcare option is active).

Metric effects engine#

Entry point: -> processStatePolicyEffects()

Processing order (per turn, per state)#

  1. Exponential decay toward target. Each metric moves a fixed fraction of the way to its policy-driven target. With no active policy on a metric, the target is the metric's baseline, so the same step pulls it back to baseline.
  2. Direct tick rates. metricEffects add a flat change on top of the decayed value.
  3. Clamp to the metric's range, and write only if the change is above 0.001.

There is no separate "natural decay" step for metrics. processMetricDecay () is an explicit no-op kept for compatibility, and its DECAY_RATE of 0.0025 is not used by the metric engine. The 0.25% per turn rate applies only to demographic lean and turnout (below).

Exponential decay formula#

// shared/constants/formulas.ts
export const POLICY_TAU = 139; // turns

export function applyPolicyDecay(current: number, target: number, tau = POLICY_TAU): number {
  const decayFactor = 1 - Math.exp(-1 / tau); // about 0.7168% of the remaining gap per turn
  return current + (target - current) * decayFactor;
}

Metrics approach their target asymptotically; the half-life of the gap is 139 x ln 2, about 96 turns (2 game years).

Target calculation#

calculateMetricTarget () sums, for every active policy and every matching effectTargetsWeighted entry:

intensity   = optionIntensity(options, optionIndex)      // -1..+1, signed distance from the ladder centre
strength    = effectiveIntensity(intensity) * 3          // sign * |intensity|^0.8, then x3
contribution = (strength / 3) * weight * MAX_EFFECT_PER_LAW * decayScope * sign * rangeScale
             * adaptation * deliveryMultiplier
target      = clamp(baseline + sum(contribution), metric min, metric max)

Federal multiplier (country-aware)#

National laws apply at reduced strength per state or region:

// shared/constants/formulas.ts
export function getFederalMultiplier(countryId: string): number {
  // UK 1/12 (regions), JP 1/8 (regions), DE 1/16 (Lander)
  return FEDERAL_MULTIPLIER_BY_COUNTRY[countryId] ?? 1 / 50; // default 1/50 (US states)
}

Source: FEDERAL_MULTIPLIER, UK_FEDERAL_MULTIPLIER, JP_FEDERAL_MULTIPLIER, DE_FEDERAL_MULTIPLIER in shared/constants/formulas.ts. This multiplier governs the per-turn tick path (metricEffects). The exponential-decay path is normalized separately: any national law (scope below 1) uses NATIONAL_LAW_DECAY_MULTIPLIER = 0.21 per region (nationalDecayScope), so a strong national law moves its main metric about the same amount whether the country has 12 or 50 regions. State and regional laws (scope 1) keep full strength. MAX_EFFECT_PER_LAW = 12 caps the decay-path points one law can move a metric before the scope multiplier. Metrics with a range above 100 are scaled by their reference value divided by 100 (metricRangeScale).

Rationale: the sum of per-region effects equals the intended national total, which prevents a single federal bill from dominating state metrics.

Time-based effect decay (adaptation)#

Some effect targets have adjustmentHalfLife, which models economic adaptation:

// Example: defense cuts hurt GDP initially, but the economy adapts
const decayFactor = applyHalfLifeDecay(1, turnsElapsed, adjustmentHalfLife);
// After N half-lives: effect = initial x (0.5)^N; turnsElapsed = currentTurn - policy.enactedTurn
Half-life (turns) Effect after 48 turns (1 game year)
24 25% of original
48 50% of original
96 71% of original

Direct tick rates#

Policy options apply additive per-turn changes (computeTickRates):

rate(metric) = sum over active policies of  ratePerTurn x scopeMultiplier x deliveryMultiplier
newValue     = clamp(decayedValue + rate)

Metrics owned by the budget mirror (MIRROR_CONTROLLED_METRIC_IDS) and by dedicated drift engines (DRIFT_OWNED_METRICS) are never written here, and with the era system on a law cannot tick a metric that does not exist yet in that era (isMetricActive).

Effect scale: extreme policies are about +-0.06 per turn, center = 0. Designed for about a 10-year full reversal.

Demographic effects engine#

Entry point: -> processAllStateDemographics()

Policies shift demographic groups through up to four channels, each with its own maximum rate at full policy strength:

Channel Constant Value Unit Notes
Population SHIFT_RATE_PER_TURN 0.1 percent of group per turn Always on
Economic lean, social lean LEAN_SHIFT_RATE_PER_TURN 0.035 lean points per turn Needs the v2 flag; capped by LEAN_MAX_DEVIATION_FROM_BASELINE = 1.5
Turnout TURNOUT_SHIFT_RATE_PER_TURN 0.25 percentage points per turn Needs the v2 flag; capped by TURNOUT_MAX_DEVIATION_FROM_BASELINE = 10
Decay back to seeded baseline LEAN_TURNOUT_DECAY_RATE_PER_TURN 0.0025 share of the gap per turn Lean and turnout with no active shift

Per effect: shift = direction x (policy.economic / 3) x scopeMultiplier x rate x magnitude, where direction is -1 to +1 from the legislation type's demographicEffects, and magnitude is clamped to 0.25 to 3 (DEMOGRAPHIC_EFFECT_MAGNITUDE_MIN, DEMOGRAPHIC_EFFECT_MAGNITUDE_MAX, default 1, ignored for population).

Policy strength Normalized Max population shift per turn
+3 (extreme right) +1.0 +0.1%
+1 (moderate) +0.33 +0.033%
0 (center) 0 0
-1 (moderate left) -0.33 -0.033%
-3 (extreme left) -1.0 -0.1%

Effects marked permanent on lean or turnout relocate the group's base value through the durable realignment overlay () instead of the capped, decaying channel. When mediaEditorialEnabled is on, a newsroom slant pull is added on top.

Federal division#

Federal demographic effects use the same country-aware multiplier: US 1/50 per state, UK 1/12, JP 1/8, DE 1/16; any other country falls back to the US set (federalPolicies).

Bulk processing#

Both engines bulk-fetch all states, policies, legislation types and metrics in parallel and write with one bulkWrite (macroMetrics for policy effects, stateDemographics for demographics).

API#

GET /api/country/[code]/policy#

Returns current policy records joined with legislation type metadata. No authentication required. The route is per country (code in the path), replacing the older global route.

Query parameters:

Parameter Required Description
scope Yes "national" or "state"
stateId When state State abbreviation (e.g. "CA")

Response: array of PolicyRecordResponse objects (), plus tariff and subsidy rows:

Field Type Description
legislationTypeId string Legislation type identifier
name string Human-readable legislation type name
policyDomain string Domain (e.g. "healthcare", "economy")
economic number Current economic axis position (-3 to +3)
social number Current social axis position (-3 to +3)
nationalOnly boolean Whether this type is federal-only
policyOptionName string | null Name of the matched policy option (exact or nearest)
hasEconomic boolean True if this type has any option with a non-zero economic score
hasSocial boolean True if this type has any option with a non-zero social score
metricEffects array Per-turn metric effects from the matched option (category, metricId, ratePerTurn)
weightedEffects array (optional) Secondary targets from effectTargetsWeighted
enactedByKind, activeOrder optional Whether the record came from a bill, an executive order or an expiry

Cache-Control is no-store on all responses. Error: 400 for an invalid country code, or a missing or invalid scope, or scope=state without stateId.

POST /api/settings/policy#

Shifts the authenticated character's policy position. See Changing positions: policy shift action above. Rate limited to 30 requests per 60 seconds per user.

Display#

Data#

Collection Fields Read or written Player-visible
characters policies.economic, policies.social, actions, infamy, politicalInfluence, nationalInfluence, positionUpdateVouchers read, written by the shift action and bill votes yes (profile)
bills, stateBills policyShiftLedger.<characterId> (baseline, applied) read, written by votes no
statePolicies scope, stateId, legislationTypeId, policyOptionId, policyOptionIndex, enactedTurn, economic, social, effectDirection, enactedBy read by the engines and API; written by enactment and seeding yes (policy pages)
legislationTypes policyOptions, effectTargetsWeighted, effectTarget, demographicEffects, policyDomain, nationalOnly read partly (names, domains)
stateBaselines baselines.<category>.<metric> read no
macroMetrics (via merged region view) economic and population metric values read, written by policy effects yes (metrics pages)
stateDemographics groups.<id>.population, economicLean, socialLean, turnout, cached state lean, mediaOpinionPull read, written by demographics yes (demographics pages)
demographicDefaults seeded per-group baselines read (v2 only) no
states ids and countryId read yes
gameState currentTurn, eraSystemEnabled, legislationDemographicEffectsV2Enabled, departmentFinanceEnabled, regionalLegislationFinanceEnabled read no
gameConfig mediaEditorialEnabled read no

Key type files:

StatePolicyRecord (in legislation.ts) and StatePolicy (in statePolicy.ts) are different interfaces. StatePolicyRecord is what the policy API reads: the current axis positions per type. StatePolicy is the richer enacted-bill record the engines read.

Indexes used: { scope, stateId } for state queries; { scope: "national" } for national queries.

Configuration#

Setting Default Where set
legislationDemographicEffectsV2Enabled on in fresh worlds; absent (off) in older worlds gameState; default in
eraSystemEnabled on in fresh worlds gameState; same defaults file. Turns on era baselines and the metric era gate
departmentFinanceEnabled on in fresh worlds gameState; scales national policy effects by delivered share
regionalLegislationFinanceEnabled on in fresh worlds gameState; scales state and regional policy effects by delivered share
mediaEditorialEnabled on in fresh worlds gameConfig; default in FRESH_WORLD_GAME_CONFIG_FLAGS,
Policy constants see Constants table shared/constants/formulas.ts, , ,
Base policy defaults per country per COUNTRY_POLICY_CONFIGS entry
World preset per world gameState.preset; selects the base policy set
Country scope ids and multipliers US federal 1/50, UK uk_national 1/12, JP jp_national 1/8, DE de_national 1/16 , shared/constants/formulas.ts

There are no gameConfig fields for the shift costs; they are code constants.

Constants#

Constant Value Source
Character position range -5 to +5
statePolicies range -3 to +3
POLICY_SHIFT_ACTION_COST 15
POLICY_SHIFT_INFAMY_COST 5
POLICY_SHIFT_INFLUENCE_MULTIPLIER 0.95
POSITION_UPDATE_VOUCHER_GRANT_AMOUNT 1
VOTE_SHIFT_STEP 0.25
POLICY_TAU 139 turns shared/constants/formulas.ts
POLICY_INTENSITY_GAMMA 0.8 shared/constants/formulas.ts
MAX_EFFECT_PER_LAW 12 shared/constants/formulas.ts
NATIONAL_LAW_DECAY_MULTIPLIER 0.21 shared/constants/formulas.ts
Federal multipliers US 1/50, UK 1/12, JP 1/8, DE 1/16 shared/constants/formulas.ts
SHIFT_RATE_PER_TURN 0.1 (percent)
LEAN_SHIFT_RATE_PER_TURN, LEAN_MAX_DEVIATION_FROM_BASELINE 0.035, 1.5
TURNOUT_SHIFT_RATE_PER_TURN, TURNOUT_MAX_DEVIATION_FROM_BASELINE 0.25, 10
LEAN_TURNOUT_DECAY_RATE_PER_TURN 0.0025
Minimum write threshold (metrics, demographics) 0.001, 0.0001 ,
APPEAL_POSITION_EXPONENT 1.5

Timing#

stateEffectsPhase (hourly turn)
  crisisTurn -> ministerialOrders            (serialized writers of the same metric paths)
  UK and JP regional budgets settle
        -> policyEffects (processStatePolicyEffects)      }  run together in one
  demographicEffects (processAllStateDemographics)        }  parallel group
        -> era checkpoints (after demographics)           }
  ...
  metricEngine -> demographicFlows -> statehood -> census

Both engines run inside the hourly turn, in the state effects phase (). policyEffects waits for the crisis and ministerial-order writers (which also write metric paths) and for the regional budget processors that supply delivery multipliers, then runs. processAllStateDemographics is started in the same parallel group, so the two run concurrently; demographics read statePolicies themselves, and era checkpoints run strictly after demographics. Within processStatePolicyEffects the order is: exponential decay toward target, then direct tick rates. Enactment itself happens when a bill resolves, outside this pass; a new statePolicies record takes effect from the next turn. See Turn Processing.

Worked trace#

A. Policy shift. A character has 40 Political Influence, 12 National Influence, 3 infamy, 30 actions, economic 2. They shift economic by +1 without a voucher.

  1. Cost: actions 30 - 15 = 15. Infamy 3 + 5 = 8 (within 0 to 100).
  2. Political Influence floor(40 x 0.95) = floor(38) = 38. National Influence floor(12 x 0.95) = floor(11.4) = 11.
  3. Economic 2 + 1 = 3 (bound filter passed, 3 < 5).
  4. Result stored on the character; policy_shift achievement awarded if first.

B. Metric decay path. A Japan national law (scope 1/8 on the tick path, 0.21 on the decay path), a metric that is higher-is-better with baseline and current value 50, a weighted target of weight 0.5, and the ladder's second-strongest option on a 7-option ladder (centre index 3, option index 5).

  1. Intensity: |5 - 3| / 3 = 0.6667.
  2. Effective intensity: 0.6667^0.8 = 0.7230. Strength 0.7230 x 3 = 2.169.
  3. Contribution: (2.169 / 3) x 0.5 x 12 x 0.21 = 0.9110.
  4. Target: 50 + 0.9110 = 50.9110.
  5. Decay factor: 1 - exp(-1/139) = 0.007168. New value 50 + 0.9110 x 0.007168 = 50.00653.
  6. Tick: suppose the matched option has ratePerTurn = 0.03. Scaled by 1/8 it is 0.00375. Value 50.00653 + 0.00375 = 50.01028.
  7. Both are clamped to the metric range and written to macroMetrics because the change exceeds 0.001.

After 96 turns of the same target the gap is about 50% closed (0.5 of 0.911 is 0.455).

C. Demographic population channel. A US federal law with policy.economic = +2 and a demographic effect with direction = +1 on group G.

  1. Strength: 2 / 3 = 0.6667. Scope 1/50 = 0.02.
  2. Population shift: 1 x 0.6667 x 0.02 x 0.1 = 0.001333 percent per turn.
  3. With the v2 flag on and magnitude = 1, the lean shift is 1 x 0.6667 x 0.02 x 0.035 = 0.000467 lean points per turn, and cannot take the group more than 1.5 from its seeded baseline.

Edge cases and limits#

Invariants#

Invariant Enforced by
Personal positions stay within -5 to +5 Atomic bound filter in the shift route; clamp in computeVoteShift; policyShift.test.ts, route.test.ts
One bill moves a voter by at most one step net Ledger baseline in applyBillVotePolicyShift; policyShift.test.ts
A shift is never charged when rejected Single findOneAndUpdate with payment and bound filters;
Metric values stay in their range Clamp in the engine; policyEffects.bounds.test.ts
Center option and neutral laws change nothing optionIntensity returns 0; policyEffects.intensity.test.ts
Policy never writes budget-mirror or drift-owned metrics Skip sets in the engine; policyEffects.budgetSync.test.ts, policyEffects.driftOwned.test.ts
A law cannot tick a metric that does not exist in the era isMetricActive gate; policyEffects.eraGate.test.ts
Lean and turnout stay within the deviation band applyBandedShift; demographicEffects.v2.test.ts
Sum of per-region national effect is region-count independent By construction (NATIONAL_LAW_DECAY_MULTIPLIER); not directly asserted by a test

Failure and recovery#

Connections#

Driven by

Affects

Tests#

File Covers
Bill position targets, vote shift, preview, ledger rules
Shift route: costs, bounds, vouchers
Payment resolution
Range handling for large metrics
Graded option intensity
, policyEffects.eraGate.test.ts Era-aware baseline and gate
Delivered-share scaling
, policyEffects.driftOwned.test.ts Ownership chokepoints
src/lib/demographicEffects.test.ts, demographicEffects.v2.test.ts, demographicEffects.buckets.test.ts Population, lean, turnout and bucket channels
shared/constants/formulas.test.ts, shared/constants/formulas.intensity.test.ts Federal multiplier constants, decay helpers, intensity curve
Option matching and policy API payload

Gaps: no end-to-end test pins the 0.21 national multiplier through a full turn, no test covers the board-country skip, and the stats-phase ordering of policy and demographics is not asserted.

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask