Skip to content

Chapter 39 — Companions & Party Dynamics

Chapter 39 — Companions & Party Dynamics

Section titled “Chapter 39 — Companions & Party Dynamics”

Companions in AI RPG Engine are not a separate entity type — they are NPCs with a CompanionState sidecar. Every companion already has an EntityState, can have CognitionState, and participates in NPC agency. The companion system adds party membership, role-based reactions, morale tracking, ability tags, and departure triggers on top of existing NPC infrastructure.


A companion is defined by CompanionState:

FieldTypeDescription
npcIdstringSame ID as their EntityState
roleCompanionRolefighter, scout, healer, diplomat, smuggler, scholar
joinedAtTicknumberWhen they joined the party
personalGoalstring?”Find her brother”, “Clear her name”
abilityTagsstring[]Gameplay-modifying tags
moralenumber0–100, how they feel about traveling with the player
activebooleanIn the active party vs dismissed/away

The party itself is tracked by PartyState:

FieldTypeDefault
companionsCompanionState[][]
maxSizenumber3
cohesionnumberAverage morale of active companions

An NPC is recruitable if their entity has the recruitable or companion-ready tag. The product layer validates:

  1. Entity exists and is alive
  2. Entity is in the same zone as the player
  3. Party is not full (< maxSize)
  4. Entity has recruitable tag

On recruitment, the NPC gets a companion tag added to their entity and a CompanionState is created. Role is inferred from entity tags or specified explicitly.

These are distinct systems tracking different relationships:

SystemTracksDrives
Cognition moraleNPC’s feelings about the worldNPC agency goals, faction behavior
Companion moraleCompanion’s feelings about traveling with the playerDeparture, party cohesion

A companion can have high cognition morale (the world is fine) but low companion morale (the player keeps doing things they disapprove of). Departure is driven by companion morale, not cognition morale.

When significant events occur, each companion evaluates a reaction based on their role. The reaction table maps 12 trigger types to 6 roles:

TriggerFighterScoutHealerDiplomatSmugglerScholar
leverage-sabotage+0+2-3-5+3-2
leverage-diplomacy-1+0+2+5+0+3
leverage-rumor-1+1-1+0+3+0
combat-won+3+1-1+0+0+0
combat-lost-2-2-1-3-3-2
betrayal-witnessed-5-3-5-8-2-5
district-grim-1-1-2-2+0-1
obligation-betrayed-8-5-8-10-3-5

Each reaction produces a morale delta and a narrator hint (e.g., “Mira frowns”, “Kael nods approvingly”).

After applying morale delta, if companion morale falls to 10 or below AND their loyalty breakpoint is hostile or wavering, the companion departs. Departure removes them from the party and records a chronicle event. If the breakpoint is hostile, this is recorded as a betrayal instead.

Companion abilities produce gameplay effects through composable tags:

TagEffect
intimidation-backupLeverage sabotage costs -1
medical-supportPlayer HP recovery +2 after combat
smuggling-contactLeverage social/rumor costs -1
witness-calmingRumor spread slowed (x0.7)
faction-routeDiplomacy actions with companion’s faction get +10 reputation
trade-advantageCommerce leverage gains +1
rumor-suppression30% chance negative rumors about player are buried
scholarly-insightPerception clarity +0.1 for all entities in zone

Tags are pack-agnostic. medical-support works the same in fantasy and cyberpunk.

When a companion with the fighter role is in the same zone as the player, there is a 30% chance they intercept incoming damage. The companion takes the damage instead of the player. This is handled by the isAlly callback in CombatFormulas.

If the intercepting companion’s HP reaches 0, they are defeated and removed from the party. Both interception and death are recorded as chronicle events.

Shows full party state with companion details, ability tags, morale, departure risk, and active goals.

Recruits an NPC into the party. The NPC must be in the same zone, alive, and have the recruitable tag.

Removes a companion from the party. The entity stays in the current zone.

The session recap includes a COMPANION CHANGES section when party composition changed during a session:

COMPANION CHANGES
Mira (fighter): joined
Kael (diplomat): departed

The narrator receives party presence as context:

Party: Accompanied by Mira the Bold (fighter, confident) and Kael Whisper (diplomat, uneasy)

The narration system prompt instructs the narrator to reference companions naturally — a fighter scanning for threats, a diplomat reading the room — through small behavioral details rather than mechanical descriptions.

The play screen shows a compact party status line:

Party: Mira (fighter, 72) | Kael (diplomat, 85) | Cohesion: 78

Companion lifecycle events are recorded in the campaign chronicle:

CategorySignificanceWhen
companion-joined0.6Recruited into party
companion-departed0.7Left the party (morale or dismissed)
companion-betrayed0.9Turned hostile and departed
companion-saved-player0.8Intercepted damage meant for player
companion-died1.0Fell in battle

To make an NPC recruitable in a content pack, add these to the entity definition:

{
id: 'brother-aldric',
name: 'Brother Aldric',
tags: ['npc', 'recruitable', 'healer'],
custom: {
companionRole: 'healer',
companionAbilities: 'medical-support,witness-calming',
personalGoal: 'Redeem the fallen brothers of the chapel',
},
// ... stats, resources, etc.
}

The recruitable tag makes them eligible. custom.companionRole and custom.companionAbilities provide defaults for recruitment.

Max 3 companions: More than 3 makes the party status line unwieldy, increases reaction evaluation overhead, and dilutes the emotional weight of each companion.

Tags, not skill trees: Tags are composable, pack-agnostic, and produce effects through multiplication into existing systems. A skill tree would require per-pack progression design.

NPCs, not a new type: Companions reuse NPC agency, obligations, loyalty breakpoints, consequence chains, and chronicle hooks. The delta is a CompanionState sidecar with role, morale, and abilities.