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

Party Whips

Last updated 2026-10-29
Source files

Summary#

Technical design for the whip system, which lets parties and caucuses coordinate both player and NPP voting without turning every vote into a hard override.

Player guide: Voting & Whips

Whips currently live on:

Whips are stored in billWhips and can target either character audiences (players) or npp audiences.

Rules#

Rule Value Source
NPP whips per target and chamber (national, state, caucus), per phase 2 attempts, then "Maximum 2 whip attempts per bill/chamber reached" , .../region/[id]/party/[partyId]/whip/route.ts, .../caucuses/[slug]/whip/route.ts
Player whips per target one soft and one hard, each at most once national whip route, character branch
Hidden NPP success roll, base chance 55 WHIP_SUCCESS_BASE_CHANCE in
Loyalty weight round(loyalty * 0.35) added WHIP_LOYALTY_WEIGHT
Stubbornness weight round(stubbornness * 0.18) subtracted WHIP_STUBBORNNESS_WEIGHT
Mode bonus soft +6, hard +15 WHIP_MODE_BONUS
Final chance clamp 40 to 95 percent WHIP_MIN_SUCCESS_CHANCE, WHIP_MAX_SUCCESS_CHANCE
Statecraft bonus round((statMultiplier(statecraft) - 1) * 50) points; statMultiplier = 1 + (stat - 5.5) * 0.04, so 0 at the neutral stat 5.5 and about plus or minus 9 at the extremes (EFFICACY_PIVOT, EFFICACY_SLOPE in ) statecraftWhipBonus in
Missing loyalty or stubbornness treated as 50 ,
Party whip force in turn-time voting hard 60, soft 30 PARTY_WHIP_BASE_BY_MODE in
Caucus whip force (defined, not wired in the autonomous path) table is hard 80, soft 40, free 0, but computeWhipForce reads only the soft value (40) whatever the mode; core-position bonus 20 CAUCUS_WHIP_BASE_BY_MODE, CORE_POSITION_BONUS in
Compliance multiplier loyalty/100 * 0.7 + (1 - stubbornness/100) * 0.3 complianceMultiplier in crossPressure.ts, weights COMPLIANCE_LOYALTY_WEIGHT 0.7 and COMPLIANCE_PLIABILITY_WEIGHT 0.3 in
Party-line lean with no whip 20 * complianceMultiplier for same-party-as-sponsor NPPs PARTY_LINE_BIAS_BASE, computePartyLineForce
Cabinet discipline pressure on whip force multiplier 1 + bonus, bonus between 0 and 0.2 applyCabinetWhipPressure in
Force range and verdict each force clamped to -100..100; sum above 5 is for, below -5 is against, otherwise abstain VERDICT_THRESHOLD, verdictFromForces in
Local bill force weights ideology 1, whip 1, district 1.35, donors 0.65 LOCAL_BILL_FORCE_WEIGHTS in
Statecraft use growth per whip USE_GROWTH_INCREMENT 0.03 XP
Route rate limit 20 requests per 60 seconds per user, on each of the national, state and caucus whip routes the three whip route.ts files

Who can whip#

National party#

The National Party Chair, Vice Chair, an admin, or a chamber leader of the party (Speaker, Majority or Minority Leader, Majority or Minority Whip, President Pro Tempore) can issue whips. Targets are bills and, where the country uses them, leadership elections, PM appointment votes, no-confidence votes, cabinet nominations, SCOTUS nominations, Speaker vacate motions and impeachment votes. German chambers refuse leadership-election whips and use PM appointment or no-confidence whips instead. NPP-audience whips also require the party's NPP control to be unlocked (getPartyNppControlStatus).

State / regional party#

Only the State Party Chair or Vice Chair can issue whips, for NPPs in their own state. Targets are limited to bills in the sub-national legislature, cabinet nominations and their own state's governor impeachment.

Caucus#

The Caucus Chair, an admin or a chamber leader can issue caucus whips. They are scoped to caucus members only and behave like a smaller internal whip bloc inside the national party.

Player vs NPP whips#

Player whips#

A hard player whip reports how many players were overridden and how many were already aligned.

NPP whips#

NPP whips are intentionally different from player whips. They interact with autonomous NPP behaviour, and soft and hard affect NPPs differently.

Hard NPP bill whip. At issue time applyWhipVotesToBill () walks every party NPP in the chamber that is not already voting the whip direction. For each:

  1. Compute the NPP's autonomous cross-pressure verdict with this whip applied.
  2. Roll 1 to 100 against the hidden success chance (formula below).
  3. Roll at or below the chance: the vote is written in the whip direction.
  4. Roll above: the vote is written as the cross-pressure verdict (which may still agree with the whip).

Override ballots (US veto override, JP Shugiin override) coerce an abstain into against. NPPs who had already voted are re-resolved and their old tally is subtracted first.

chance = clamp(55 + round(loyalty * 0.35) - round(stubbornness * 0.18)
               + modeBonus + statecraftBonus, 40, 95)

The curve is deliberately generous so same-party NPPs usually comply, while stubborn or disloyal NPPs still have a real chance to balk.

Soft NPP bill whip. Does nothing at issue time (applyWhipVotesToBill returns immediately for soft). The whip document is stored, and later, when NPPs vote autonomously in the turn, it adds weaker pressure (30 instead of 60) into the cross-pressure verdict. Soft whips are meant to tip close calls, not dominate neutral NPPs.

Autonomous bill-vote pressure#

When an NPP votes on a bill in the turn ( for federal bills, for local bills), the verdict is the clamped sum of four forces: ideology, whip, district (home-state or home-region sentiment) and donors. Whip pressure follows these rules:

Leadership elections#

US congressional leadership elections are player-only in live NPP behaviour. The turn processor counts speakerVotes as a constant 0 (), so NPPs never vote in Speaker, House or Senate leadership races on their own. Whip helpers for NPP leadership votes (applyWhipVotesToLeadership) still exist and a chair's hard whip writes NPP leadership votes directly with no roll (see Edge cases), but autonomous NPP congressional leadership voting is not an active simulation system.

Defiance#

Whip history is a defiance watch (), not a permanent compliance ledger.

An entry appears only when the whip exists, the target has cast a vote, and that vote currently contradicts the whip. It clears when the target changes back into compliance, the whip becomes irrelevant, or the underlying target closes or is withdrawn. For bills, only whips from the current phase count: a veto-override ballot ignores whips issued before it began ().

Access patterns#

Data#

Collection Fields Read or written Player-visible
billWhips targetType, targetId, chamber, direction, candidacyId, issuedBy (stateParty, nationalParty, caucus), countryId, stateId, partyId, caucusId, issuedByCharacterId, issuedByRole, audience, mode, attemptNumber (1 or 2), createdAt Inserted by the three whip routes; read by turn-time voting, defiance, and the bill whip panel Party members with access see whips and the defiance watch; the NPP success roll is hidden
bills votes, otherChamberVotes, vetoOverrideVotes (maps keyed npp_<id> or character id), per-vote tallies, whippedFromVote snapshot for player undo, overrideVotingStartedAt Written by hard whips and by turn-time voting Vote totals yes; the whip-applied snapshot no
electedOfficials nppId, officeType, seatsHeld, countryId Read to find the NPPs to whip and their weight Yes
npps personality.loyalty, personality.stubbornness, party, homeState, isTechnocrat Read only Personality is shown as hints; exact values are not
characters stats.statecraft, statXp.statecraft Statecraft read for the bonus; XP incremented by USE_GROWTH_INCREMENT Own stats only
statePartyOrg chairId, viceChairId Read to decide whether a state whip pre-empts a national one Yes
nppVotePredictions forces, verdict, resolved vote per NPP and bill Rewritten after a whip so the forecast stays current Yes, on the prediction surface
Leadership, nomination and motion collections (speakerNominations, houseLeadershipNominations, senateLeadershipNominations, speakerVacateMotions, impeachments, cabinetNominations, scotusNominations) per-target votes Written by hard leadership-type whips Yes

Configuration#

Whips read no gameConfig field and have no era or scenario override. Behaviour changes only through code constants and through live data.

Setting Default Where set
WHIP_SUCCESS_BASE_CHANCE, WHIP_LOYALTY_WEIGHT, WHIP_STUBBORNNESS_WEIGHT, WHIP_MODE_BONUS, WHIP_MIN_SUCCESS_CHANCE, WHIP_MAX_SUCCESS_CHANCE 55, 0.35, 0.18, soft 6 and hard 15, 40, 95
PARTY_WHIP_BASE_BY_MODE, CAUCUS_WHIP_BASE_BY_MODE, CORE_POSITION_BONUS, PARTY_LINE_BIAS_BASE, VERDICT_THRESHOLD hard 60 and soft 30, hard 80 soft 40 free 0, 20, 20, 5
Compliance weights 0.7 and 0.3
Cabinet discipline bonus 0 to 0.2, loaded per party and turn , applyCabinetWhipPressure in (throws outside 0 to 0.2)
Max NPP attempts per target and chamber 2 the three whip routes
NPP control requirement (national NPP whips only) party age and member tenure, waived for default parties and admins getPartyNppControlStatus in
Rate limit 20 per 60 seconds per user the three whip routes
Whip window start overrideVotingStartedAt on a veto-override ballot; election startedAt for US Speaker and leadership targets , national whip route
German chambers (bundestag, landtag) leadership-election whips refused national whip route

Timing#

Worked trace#

A national party chair with neutral Statecraft (stat 5.5, bonus round((1 - 1) * 50) = 0) issues a hard "for" whip on an open bill. A cabinet discipline bonus of 0 applies. NPP A has loyalty 70 and stubbornness 40, and without the whip its forces on this bill are ideology -30, district -10, donors 0.

Step Computation Result
Loyalty term round(70 * 0.35) = round(24.5) 25
Stubbornness term round(40 * 0.18) = round(7.2) 7
Hard roll chance clamp(55 + 25 - 7 + 15 + 0, 40, 95) 88 percent
Compliance 0.7 * 0.7 + 0.3 * 0.6 = 0.49 + 0.18 0.67
Whip force, cross-pressure 60 * (1 + 0) * 0.67, clamped to -100 to 100 40.2
Verdict with the whip -30 + 40.2 - 10 + 0 = 0.2, inside plus or minus 5 abstain
Roll of 73 (at or below 88) success: vote written in the whip direction for, counted as fell in line
Roll of 95 (above 88) failure: vote is the cross-pressure verdict abstain, counted as ignored

The vote is stored under bills.votes["npp_<id>"] with the NPP's seatsHeld weight added to the tally, and nppVotePredictions is rewritten with the post-whip forces. If the bill is a veto-override ballot, an abstain result is coerced to against.

Other numbers from the same inputs:

Case Computation Result
Soft whip on a non-bill target 55 + 25 - 7 + 6 79 percent
Soft whip on a bill, later at turn time 30 * 0.67 20.1 force, no roll
Hard whip with maximum cabinet discipline 60 * 1.2 * 0.67 48.24 force
Chair Statecraft 8 round((1.1 - 1) * 50) plus 5, chance becomes 93
NPP B, loyalty 20, stubbornness 80, hard whip 55 + 7 - 14 + 15 63 percent
NPP B turn-time hard force 60 * (0.14 + 0.06) 12; with ideology -30 the sum is -18, so against

Edge cases and limits#

Invariants#

Invariant Enforced by
Roll chance stays in 40 to 95 calculateNppWhipSuccessChance clamp;
Each cross-pressure force is within -100 to 100 and the verdict uses a plus or minus 5 band clamp100 and verdictFromForces;
Cabinet discipline bonus is within 0 to 0.2 applyCabinetWhipPressure throws otherwise
At most 2 NPP whips per target, chamber and party in the current phase Route checks; route.test.ts for the national and caucus routes. The state route has no route test
At most one soft and one hard player whip per target National route check; character-whip.integration.test.ts
A hard bill whip subtracts an NPP's old vote before adding the new one, so tallies do not double count Logic in applyWhipVotesToBill; covers application, not named for this case
A hard player whip is undoable: whippedFromVote stores the prior vote applyPlayerWhip.test.ts, clearWhippedVote.test.ts
An NPP is only whipped onto its own country's bill Country guards in applyWhipVotes.ts; applyWhipVotes.test.ts (cross-country guard, bug 0699)
Votes written by a whip never move a player's positions Not enforced in this module; stated by the player guide and handled in the vote path

Failure and recovery#

Failure What it looks like Repair
Whip document inserted but apply step fails A whip exists but NPP votes did not change; the chair sees an error The whip row is inserted before the apply step (player whips also write an audit row first), so it stays traceable; the chair can use the remaining attempt, or an admin repairs the target
Tally disagrees with the vote map For or Against totals differ from the stored votes Re-resolving subtracts an NPP's old vote before adding the new one to prevent it; a stored mismatch is repaired by a heal that recomputes the tally
Stale whips carried into a veto-override ballot Defiance shows whips from the passage phase Readers reject whips older than overrideVotingStartedAt (isBillWhipInCurrentPhase); old rows are also cleaned up best-effort
Cross-country party id collision A whip from another country's party applies resolveWhipForNPP and the apply functions skip whips and NPPs of other countries

Connections#

Driven by

Affects

Tests#

File Covers
Roll chance, clamps, Statecraft bonus
, playerWhip.test.ts, playerWhipSummary.test.ts, issuerRole.test.ts, constraints.test.ts Defiance, player whip modes, issuer roles, constraints
, applyWhipVotesImpeachment.test.ts NPP whip application, overrides, leadership-type targets
src/lib/congress/applyPlayerWhip.test.ts, applyPlayerWhipImpeachment.test.ts, clearWhippedVote.test.ts Player hard whips and undo
, billWhipPanelData.test.ts Phase window and panel data
, crossPressure.v2.test.ts Forces and verdict
, stateBillVoting.test.ts, whipResolution.test.ts Turn-time voting and whip precedence
, .../whip/character-whip.integration.test.ts, .../whip/impeachment.route.test.ts National route
Caucus route
State route, impeachment only

Gaps: the state whip route has no general route test, and no test exercises the caucus whip through turn-time voting because it is not wired there.

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask