A House Divided A House DividedDocumentation
↵
Changelog
Game Design/Elections & Campaigns

Demographics

Last updated 2026-10-29
Player wikiDemographics
Source files

Summary#

Player guide: Demographics. Strategy companion: Demographics & Targeting.

This is the technical reference for who votes, how many of them turn out, how a candidate's appeal to each group is scored, and how party GOTV and player canvassing move turnout. The strategy-level summary is in Demographics and Targeting (design). Canvassing from the player's side is in Canvassing (design).

The electorate that actually casts votes is the granular Layer-1 electorate, not the 12 archetypes. Every country runs on a lattice of granular demographic cells (the cross-product of Layer-1 census dimensions, race, age, education, wealth in the US; ethnicity, income, urbanization variants abroad), IPF-raked to each state's census marginals. This is the live vote path everywhere; there is no flag-gated archetype fallback left in the tally engine. See Granular Electorate (as shipped) for the authoritative description; is the core.

The 12 US voter archetypes described below are legacy authoring vocabulary, not the live electorate. Gameplay systems that were written against them (character/NPP archetypeApprovals, legislation demographicEffects, Address-driven party-group favorability, GOTV/canvassing modifiers) still author effects keyed by archetype id, and src/lib/demographics/archetypeBucketMap.ts projects each archetype onto 2-3 Layer-1 census buckets so those effects still land on the real (cell-based) electorate. Archetypes themselves have no independent vote-share logic any more. See Archetype Approvals for the deprecated-field detail.

Rules#

Structure (12 archetypes, legacy authoring vocabulary)#

Voter groups (single category)#

One category voterGroups with 12 mutually exclusive archetype ids: young_renters, evangelicals, rural_traditionalists, union_trades, soccer_moms, college_liberals, small_business, public_sector, retirees, libertarians, new_immigrants, secular_professionals.

Each carries a default economic lean, social lean and turnout, which differ by country (the UK set in src/lib/countries/uk/data/ukDemographicCategories.ts is not the US set). Those per-archetype numbers are authoring defaults and are not live vote inputs, so they are not tabulated here: the live numbers per cell come from the census position tables in src/lib/demographics/ (the US Layer-1 table is , re-exported by ). The mapping of each archetype onto census buckets is src/lib/demographics/archetypeBucketMap.ts; non-US archetypes project through src/lib/demographics/countryArchetypeBuckets.ts.

Note: State ideology composition modulates leans for retirees, soccer moms, union & trades, and rural traditionalists, their actual values shift slightly based on how conservative or progressive each state is.

Groups have defaultEconomicLean, defaultSocialLean, and defaultTurnout.

State demographics#

Per state (StateDemographics, ):

Derivation#

Group sizes and leans are derived from Layer 1 (race, education, wealth, age, ideology) via weighted formulas. No manual per-state data entry, all values come from census-style config. See and .

Ideology modulation: For four swing groups, leans shift based on the state's conservative/progressive ideological composition:

Policy positions#

Candidates have policies.economic and policies.social (-5 to +5). Compared to each group's economicLean and socialLean for alignment.

Default category weights#

There is a single category, voterGroups, weighted 100% (categoryWeights: { voterGroups: 100 } in ). There is no per-category weighting across race/wealth/education/ideology/age, and no gender dimension exists in the Layer-1 census dimensions ( has race 5, age 4, education 3, wealth 3 and ideology 6 groups only).

Vote / appeal calculation#

Shared formula in , used by the election engine, poll route, and NPP dropout. "Group" here means a granular Layer-1 unit (or, for legacy-keyed inputs, the archetype projected onto units, see Summary above). The steps below describe the group-level competitive allocation path (primaries, polls, and the general-election fallback); live general-election vote accumulation defaults to the swing-flow model, which builds on this same appeal/reach/approval math but adds coattail, median-voter, persuasion, and incumbency drivers, see Elections and Election Engine:

  1. For each category, for each group: get state population share, group lean, turnout
  2. Reach: normalizeNPI(politicalInfluence) = sqrt(min(100, max(0, PI)) / 100) (), a sqrt curve mapping influence to a 0-1 fraction of turned-out voters the candidate reaches, hard-capped at 1.0 once influence reaches 100 (PI 25 gives 0.5, PI 50 gives 0.707). US presidential primaries use a different reach curve, 1 - exp(-PI / 45) (normalizeNationalReachPresidentialPrimary, same file), not covered here.
  3. Appeal: position score 25 × (positionRaw/50)^1.5 + APPEAL_POSITION_FLOOR, where positionRaw = max(0, 50 - |econDiff|×5 - |socialDiff|×5), APPEAL_POSITION_EXPONENT = 1.5 and APPEAL_POSITION_FLOOR = 0.5 (the old squared curve is a special case, not the default), plus a directional bonus of up to DIRECTION_BONUS_PER_AXIS = 5 per axis (economic, social) for a candidate whose lean matches the group's lean direction, plus normalizeNPI(politicalInfluence) × 12.5 only when influence is included in appeal (presidential races; state races use influence for reach only). All in (calcAppeal). MAX_APPEAL = 50 is the declared ceiling; the practical maximum is position 25.5 + direction 10 + influence 12.5 = 48 in a presidential race and 35.5 in a state race
    • The directional factor per axis ramps from CENTER_FRACTION = 1/3 for a dead-center candidate up to 1.0 once the candidate leans DIRECTION_RAMP = 0.5 the group's way, and falls to 0 when opposed. Formula: lean = clamp(charAxis / 0.5, -1, 1), align = lean × sign(groupAxis), factor = clamp(1/3 + (2/3) × align, 0, 1). A neutral group (lean 0) grants no bonus. If a leaning candidate disagrees in sign with their party on an axis, the bonus on that axis is 0.
  4. Group-level allocation: Each group contributes to the turn pool proportionally to its size. Within each group, candidates split that contribution by relative (appeal × reach × approval × partyOrg). Groups vote as blocs.
  5. Approval scalar: (favorability / 100)^0.8 (APPROVAL_SCALAR_EXPONENT, approvalScalar), voters won't support candidates they don't approve of; 0% approval = 0 votes; favorability is clamped to 0-100 and defaults to 50 when missing
  6. Party org scalar (general elections): normalizedOrgShare ^ 0.2 (ORG_WEIGHT_EXPONENT in src/lib/electionEngine/electionFormulaFactors.ts), a party's normalized share of statewide Org, diminishing returns; primaries use a uniform neutral 1×
  7. Final votes: Sum over groups of each candidate's share from that group

State political lean#

State lean is computed from demographics for display on state pages and the map (, calculateStateLean, getDisplayLean and getLeanLabel; the cached value is built by calculateStateLeanForCache in ):

  1. Turnout-weighted average: For each group, weight = (population share / 100) × (turnout / 100) × (category weight / 100). A category absent from categoryWeights contributes 0. Turnout falls back to the group's defaultTurnout, then 55. Sum economicLean × weight and socialLean × weight, divide by total weight. Each axis is rounded to 2 decimals and clamped to -5..+5. Zero total weight gives 0, 0.
  2. Display lean (getDisplayLean): if the two axes have the same sign, their average. If they disagree in sign, the stronger axis alone (so a state at econ -0.5, social +2 shows +2 rather than being compressed to center).
  3. Label (getEconomicPositionName, ): the display lean is rounded to the nearest whole step (roundLabelBucket, half away from zero) and named on the shared -5..+5 ruler:
Rounded lean Label
-5 Far Left
-4 Strong Left
-3 Left
-2 Lean Left
-1 Center-Left
0 Centrist
+1 Center-Right
+2 Lean Right
+3 Right
+4 Strong Right
+5 Far Right

So any display lean with absolute value under 0.5 reads "Centrist". Where the granular substrate drives the lean, state leans stay well under 1 in absolute value, so most states label Centrist; the map shading uses a continuous scale fitted to the observed spread instead of these steps. This is why a state can look purple on the map and still be labelled "Centrist" on its page. Which path produces the cached lean depends on the preset, see Configuration.

Used for: state page top stats bar, map Political Lean mode, state panel on map. If a state has no cached lean, getStateLean falls back to the 2020 election margin (ELECTION_2020_MARGIN), then 0.

The lean display scale is separate from election mechanics, elections use raw position differences (-5..+5) directly, not the display lean.

State-level demographic turnout#

The turnout system allows strategic manipulation of voter participation through party GOTV spending and player canvassing actions. Each state tracks turnout modifiers per census bucket (US: race 5, age 4, education 3, wealth 3, ideology 6 = 21 buckets; other countries use their own dimensions).

Constants#

Constant Value Source
CAMPAIGN_RULES_VERSION 1 (stamped on newly inserted races only; races already in progress keep the old rules)
TURNOUT_CAP 20 (modifier range -20 to +20 points, additive to baseline turnout)
TURNOUT_HALF_LIFE 6 turns (decay factor 2^(-1/6) = 0.8909 per turn, about 10.9% lost per turn)
Decay zero threshold modifiers under 0.01 in absolute value snap to 0
CANVASS_BASE_BOOST 2 turnout points
Canvass fit 0.2 + 0.8 × exp(-d² / 18), floor 0.2
Closing multiplier ×2 when a qualifying race ends within 4 turns ,
Canvass cost 100 funds (anchor-denominated, converted to local currency) and 1 action per canvass (COST_FUNDS, COST_ACTIONS)
MAX_CANVASS_BATCH 50 canvasses per request
Canvass rate limit 60 requests per 60 seconds per user
DOLLARS_PER_TURNOUT_POINT 5000
GOTV alignment multiplier max(0.1, 1 - 0.15 × Manhattan distance) (calculateAlignmentMultiplier)
MAX_GOTV_PERCENT 25 (whole percent of hourly revenue)
Legacy decay 2% per turn (DECAY_RATE = 0.02), zero threshold 0.01
Legacy canvass base 0.05 point × max(0.1, 1 - 0.15 × Manhattan distance) × (2 in season) calculateCanvassingBoost in
Legislation drift decay 0.25% per turn toward baseline when no law targets the group (LEAN_TURNOUT_DECAY_RATE_PER_TURN = 0.0025); cumulative law-driven turnout shift capped at 10 points (TURNOUT_MAX_DEVIATION_FROM_BASELINE)

Core mechanics#

Modifiers: Each bucket has a modifier from -20 to +20 points (additive to baseline turnout).

Two modifier sets (plus a canvass ledger). Each state turnout document holds campaignModifiers (read by races stamped with campaign rules version 1, via turnoutForElection) and the older modifiers (read by races that predate it). Both are updated by every GOTV action and both decay each turn. The difference is in the numbers:

Campaign rules v1 (campaignModifiers) Legacy (modifiers)
Decay half-life 6 turns 2% per turn
Diminishing returns directional (see below) symmetric: boost × (1 minus absolute current / 20), floor 0
Canvass size 2 × fit² × closing, fit from the share-weighted audience position 0.05 × max(0.1, 1 - 0.15 × Manhattan distance) × closing, distance to the bucket's Layer-1 lean
GOTV size same boost as the legacy set same boost as the campaign set

A canvass therefore writes two different boosts, one per set (: modernBoost into campaignModifiers, boost into modifiers), while GOTV and suppression write the same raw boost into both (applyBoost(state, demo, boost, boost)).

A third document field, campaignContactModifiers, records the realized canvass contribution only (the change actually applied to campaignModifiers, clamped to -20..+20). It decays on the same half-life as campaignModifiers.

Decay: Campaign modifiers decay toward 0 with a half-life of 6 turns, requiring sustained investment to maintain boosts. Why: a one-off burst of canvassing should not carry a whole term, and a 6 turn half-life means an unrefreshed modifier is down to a quarter after 12 turns.

Diminishing returns (v1): Larger existing modifiers receive smaller boosts in the direction they already point (addTurnoutBoost):

Party GOTV (passive)#

Each party budget (national or state-level) targets a single chosen demographic (gotvTargetCategory / gotvTargetGroup) and spends automatically each turn:

  1. Spend: gotvBudgetPercent (0-25% of hourly revenue, floor(revenue × percent / 100)) is the primary path; a legacy flat gotvBudgetPerTurn amount is used only when the percent field is 0 (calculateGOTVSpend).
  2. Alignment: A continuous multiplier scales the boost by how close the party's position is to the target demographic's lean, max(0.1, 1.0 - distance × 0.15) where distance is the Manhattan distance on economic + social axes (same curve as the legacy canvassing curve). There is no binary "within 2 points" eligibility cutoff (the helper isWithinTwoPoints still exists in but nothing in the turn uses it), the multiplier degrades smoothly from 1.0 (perfect alignment) to a floor of 0.1.
  3. Boost: (spend / DOLLARS_PER_TURNOUT_POINT) × alignmentMultiplier. National spend is divided evenly across the regions of the party's own country first (calculateNationalGOTVBoost); state-scoped spend applies in full to one state (calculateStateGOTVBoost).
  4. Treasury: The treasury is debited by the computed GOTV spend each turn: a state budget draws on the state party treasury, a national budget on the national party treasury. A budget whose target is stale (unknown group, or a state with no turnout document) produces no effect and is not charged. If the treasury is below the spend, GOTV does not run that turn. If the treasury is negative, every spending percent on that budget is reset to 0.
  5. Who sets it: the national party chair, vice chair, treasurer or an admin, through POST /api/country/[code]/parties/[id]/gotv. The percent must be a whole number from 0 to 25, and a target category and group must be given together.

Source: (processPartyGOTV) and (applyBoost).

Sibling spends in the same pass. The same loop also runs voter suppression (a negative boost with the same formula, target in suppressionTargetCategory / suppressionTargetGroup, percent in suppressionBudgetPercent) and voter-registration drives (registrationBudgetPercent, spending the same DOLLARS_PER_TURNOUT_POINT rate into registration pools, capped at REG_DRIVE_MAX_BOOST_PER_STATE = 0.1 point per state in ). Both are described with the party systems in Parties, not here.

Player canvassing (active)#

Campaign action to boost a specific demographic in the candidate's active campaign state (home state by default; presidential candidates use their travel or primary state; a running mate may canvass the ticket's travel state, drawing on the ticket's shared daily surrogate pool):

Cost: 100 funds and 1 action point per canvass, up to 50 canvasses in one request.

Effectiveness formula (canvassingBoost in ):

CANVASS_BASE_BOOST = 2
distance² = ((candEcon - audienceEcon)² + (candSocial - audienceSocial)²) / 2
campaignFit = 0.2 + 0.8 × exp(-distance² / 18)
finalBoost = CANVASS_BASE_BOOST × campaignFit² × (closing ? 2 : 1)

audience is the share-weighted mean position of the cells in the targeted bucket (targetAudience).

Fit scaling:

Closing: the closing multiplier applies when an active state race in that state, or the national presidential race of the character's country, ends within the next 4 turns (checkActiveCampaignSeason: endTurn between the current turn and the current turn + 4).

Immediate effect: Unlike party GOTV, canvassing applies its effect immediately (not queued until turn processing), and canvassingProcessed in the turn summary is always 0. The write is crash-safe and idempotent: funds, actions and the turnout write are keyed legs of one flow, and an Idempotency-Key header replays a stored outcome without charging twice.

Legacy set: for the older modifiers set the route still applies the calculateCanvassingBoost formula (0.05 base, Manhattan alignment, season ×2) with symmetric diminishing returns, once per canvass in the batch. It is the weaker of the two. When a native (non-legacy) bucket has no legacy equivalent, the legacy boost is 0.

Election integration#

State-specific turnout modifiers are applied to election calculations through the granular electorate (): US dimension-keyed modifiers (modifiers.race.white) apply natively to the matching bucket rates, and a cell's turnout is blended from its buckets' rates plus the modifiers of every bucket it belongs to. Archetype-keyed modifiers (modifiers.voterGroups) are projected onto buckets through archetypeBucketMap.ts. Ideology modifiers have no cell axis and are dropped on that path; races on campaign rules version 1 build their audience from campaignModifiers through , which preserves ideology identities. See Granular Electorate (as shipped).

deriveGroupTurnout and computeLiveGroupTurnouts () remain the archetype-group path used by polls and legacy-keyed inputs: final turnout = baseline + sum(layer1Modifiers × layer1Weight).

How demographics affect gameplay#

Data#

Collection Fields used Read or written by Player-visible
stateDemographicTurnout _id (region), countryId, modifiers, campaignModifiers, campaignContactModifiers, lastDecayApplied, lastUpdated Written by decay, GOTV and the canvass route; read by the tally and polls Yes: GET /api/country/[code]/region/[id]/turnout returns baselines, modifiers and actual turnout per bucket
partyBudgets partyId, countryId, scope, stateId, gotvBudgetPercent, gotvBudgetPerTurn, gotvTargetCategory, gotvTargetGroup, plus suppression, registration and org-building percents Read by processPartyGOTV; written by the party budget routes (the reset-on-negative-treasury path writes it back) Party officers see their own budgets
politicalParties (treasury, position) and statePartyOrg (treasury) treasury debited by GOTV spend Read and debited by processPartyGOTV Treasury is shown to party officers
stateDemographics categoryWeights, groups.*.{population,economicLean,socialLean,turnout}, cachedEconomicLean, cachedSocialLean, layer1PositionOverrides, layer1TurnoutOverrides Read by the lean calculation, appeal and polls; written by seeding, legislation drift and the lean cache Lean, label and group sizes on the region page and map
demographicDefaults same shape, the durable base Read by the granular substrate and the campaign audience Indirect
demographicCategories archetype group defaults Read by loadDemographicCategories No
characters policies.economic, policies.social, politicalInfluence, funds, actions Read by canvassing and appeal; funds and actions debited by canvassing Own stats
elections campaignRulesVersion, endTurn, endTime, state, electionType, countryId Read for the rules version and the closing window Race pages
// StateDemographicTurnout (stateDemographicTurnout collection)
{
  _id: "PA",
  countryId: "US",
  modifiers: {
    race: { white: 2.5, black: -1.2, hispanic: 0, asian: 0, other: 0 },
    age: { young: 5.0, mid: 0, mature: -0.5, senior: 1.0 },
    education: { no_college: 0, college: 3.5, graduate: 2.0 },
    wealth: { low: -1.0, middle: 0, high: 0.5 },
    ideology: { evangelicals: 0, environmentalists: 4.0, ... }
  },
  campaignModifiers: { /* same shape, read by campaign-rules-v1 races */ },
  campaignContactModifiers: { /* canvass-only component */ },
  lastDecayApplied: Date,
  lastUpdated: Date
}

// PartyBudget (partyBudgets collection), national or state scope
{
  _id: ObjectId,
  partyId: "DEM",
  countryId: "US",
  scope: "state",  // or "national"
  stateId: "PA",   // required if scope === "state"
  gotvBudgetPercent: 5,    // 0-25
  gotvBudgetPerTurn: 100,  // legacy, used only when percent is 0
  gotvTargetCategory: "age",
  gotvTargetGroup: "young",
  suppressionBudgetPercent: 0,
  orgBuildingPercent: 0,
  registrationBudgetPercent: 0,
  createdAt: Date,
  updatedAt: Date
}

The treasury is not stored on the budget; it is read from the party (national) or the state party row (state). Types: , , .

Configuration#

There is no gameConfig switch for the turnout or appeal math. Behaviour is set by constants (see Rules), the race's rules version, the preset and per-budget settings.

Setting Default Where set
campaignRulesVersion on an election stamped 1 on new races, absent on older ones (treated as 0, legacy rules) withCampaignRules in
gotvBudgetPercent 0, max 25, whole numbers gotvBudgetSchema in , set per budget
gotvBudgetPerTurn legacy flat spend, used only when percent is 0 partyBudgets row
GOTV target none; GOTV does nothing without a category and group partyBudgets row
categoryWeights { voterGroups: 100 }
Cached state lean path granular substrate only for the US 1953-default preset; every other preset uses the archetype-level calculateStateLean calculateStateLeanForCache in
Closing window 4 turns checkActiveCampaignSeason in
Forex scaling of the canvass fund cost on when forex is enabled: 100 anchor funds times the frozen campaign rate; off: 100 isForexEnabled, campaignLocalRate in the canvass route
Appeal exponents position 1.5, approval 0.8, org 0.2 demographicAppeal.ts, electionFormulaFactors.ts

Country and era variants: US turnout buckets are the 21 listed above; other countries use their own Layer-1 dimensions (src/lib/demographics/countryDemographics.ts). Era position tables and per-state overrides shape cell positions ().

Timing#

Turnout processing runs in the demographicsAndPartySetup step of the turn pipeline (), in this order:

  1. turnoutDecay (applyDecayToAllStates): decay campaignModifiers and campaignContactModifiers (half-life) and modifiers (2%).
  2. partyGOTV (processPartyGOTV): spend party budgets and apply alignment-scaled boosts, so a boost bought this turn has not yet decayed.
  3. partyOrgTurn, then the registration, pressure and support decay passes in the same step.
  canvass (any time, immediate write)
        |
        v
  [turn start] turnoutDecay  ->  partyGOTV  ->  partyOrgTurn ... (later phases) ... election tally
   decay both sets            boost both sets                                       reads post-decay,
   (6-turn half-life /        (alignment x $/pt)                                    post-GOTV modifiers
    2% per turn)

Election tallying runs later in the turn, so it reads the post-decay, post-GOTV modifiers. Player canvassing is not part of the turn: it writes immediately when the action is taken, so a canvass made between turns is decayed once at the start of the next turn processing before it can reach a tally. Appeal, reach, approval and Org scalars are evaluated inside the tally and in polls, not in a separate phase.

Worked trace#

Turnout chain. A candidate at economic +2, social +2 canvasses the age bucket young in a state three times in one request, outside the closing window. The bucket's share-weighted audience mean sits at -1, -1 and the bucket's Layer-1 lean is -3, -3. Starting modifier is +5.0 in both sets.

Appeal and share. A state race (influence is reach only). Candidate A: economic +2, social +1, political influence 49, favorability 64, party Org share 0.5. Group: economic +1, social +2.

Lean label. Two groups give state economic lean -0.5 and social +2.0. Signs disagree, so the display lean is the stronger axis, +2.0, which rounds to bucket +2 and reads "Lean Right". A state at economic 0.3, social 0.4 averages to 0.35, rounds to bucket 0, and reads "Centrist".

Edge cases and limits#

Invariants#

Failure and recovery#

Connections#

Driven by:

Affects:

Tests#

Gaps: no test pins the two-boost behaviour of a canvass (campaign versus legacy set) side by side; the label table in getEconomicPositionName and the 55 turnout fallback in calculateStateLean have no dedicated assertion that I could find; the registration and suppression passes are only indirectly covered here.

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask