Boss Anchor Pattern
A boss “anchor” is the primary body whose HP drives the encounter. The anchor is the canonical target — its hpMax defines the boss bar’s denominator, and damage routed through any sharer reduces the anchor’s HP. When the anchor dies, the encounter ends.
Anatomy of a boss roster
spawnBoss materializes a BossDef.roster into world.enemies. Each BossRosterEntry carries three flags that determine its role in the anchor pattern:
isBoss— marks this enemy as the anchor. The HUD boss bar readsdisplayNameandbarColorfrom the anchor for fallback rendering. Only one entry per roster is typically flaggedisBoss: true, though a multi-anchor encounter (Prism Cluster) flags multiple sharing bodies as anchors of equal weight.sharesHealthWithBoss— damage to this body routes to the anchor’s HP pool instead of resolving locally. Sharers contribute to bar damage; their own HP is bookkeeping.untargetable— excluded from player targeting (auto-aim, homing). Carriers and other support roster entries can be flagged untargetable so they don’t divert player fire.
Sharers, carriers, and adds
Three role archetypes appear inside a boss roster:
- Anchor —
isBoss: true,sharesHealthWithBoss: true. The body whose HP drives the bar. Damage to the anchor itself counts directly. - Sharer —
isBoss: false,sharesHealthWithBoss: true. A secondary body the player can shoot; damage routes to the anchor’s HP. Used in encounters like Junkrat Captains’ Marco carriers when the gate-group surface is in play. - Carrier / add —
isBoss: false,sharesHealthWithBoss: false. Standalone enemy spawned around the anchor (typically via the spawn profile). Its HP is its own; killing it doesn’t dent the boss bar.
Spawn profiles (def.spawnProfileId, e.g. 'crescendo') drive continuous add waves around the anchor through the boss spawn-profile system — separate from the roster’s at-spawn entries.
Lifecycle
Anchor death is the encounter’s terminal beat. damage.ts snapshots the last sharer’s death position into game._lastBossDeathX/_lastBossDeathY and fires the boss_kill signal. onBossEncounterEnd re-fires boss_kill carrying def.reward.xp, def.reward.currency, and def.id so reward systems with a single contract observe a guaranteed close — listeners must be idempotent.
On win, the encounter teardown:
- Culls every alive enemy flagged
isBoss,sharesHealthWithBoss, or_isBossAnchor. - Drops boss-fired projectiles tagged
_cullOutsideArena. - Triggers a Supply Pod cascade at the anchor’s death position (one ring for mini-tier, two with jitter for boss-tier).
- Either drops the portal (legacy bosses outside the run sequence) or sets
_bossLevelCleared = trueso the bridge advances to the next level.
Examples
Awakened Mech uses the single-anchor pattern: one isBoss: true body at arena center, 8000 HP, formation_lock AI, respawn_as affix chaining the body through Loader → Drillbot → Bigbot at 66% / 33% thresholds. The same anchor persists across all three phases; only the sprite, abilities, and VFX layers swap. The crescendo spawn profile feeds adds around it.
Prism Cluster uses the multi-anchor pattern: four sharing bodies, each carrying 25% of the bar, positioned on the arena’s cardinal points. All four flag sharesHealthWithBoss: true; damage to any one reduces the shared HP pool. The encounter ends when the final sharer dies (the snapshot path in onBossEncounterEnd handles asymmetric rosters where the terminal death isn’t on the body originally flagged isBoss).
Source
src/starship-survivors/engine/boss/encounter.ts—spawnBoss,onBossEncounterEnd, roster materialization.src/starship-survivors/data/bosses/awakened-mech.ts— single-anchor exemplar.- Spec:
docs/superpowers/specs/2026-04-25-bosses-as-enemies-design.md§2.5, §3.4, §6.