Bosses that rewrite their own arena

Eighteen multi-phase bosses as data, a three-voiced choir sharing one life pool, and two final bosses that rebuild the floor while pathfinding and prediction keep up.

The Unmaker, a huge violet figure on blue pillars, stands on a floating island of orange floor above a starfield while heroes fight at its feet
Contents
  1. A boss is a list of phases
  2. Hazards you read, not luck you survive
  3. The Drowned Choir: three voices, one life
  4. The Architect rebuilds the room
  5. Dynamic tiles: one composite, three consumers
  6. The Unmaker borrows the whole game
  7. How long the fights take
  8. Scatter versus patterns
  9. Related posts

18 boss encounters, 64 phases, one 460-line runtime. The first boss has two phases and three skeletons; the last has eight, each borrowing an earlier boss's mechanic, and ends on a seven-tile island over the void.

A boss is a list of phases

A MonsterDef holds stats and abilities; a BossDef scripts the fight as phases keyed to life thresholds:

shared/data/bosses.tsTypeScript
{
  monsterId: 'bone_king',
  uniqueName: 'The Bone King',
  title: 'Lord of the Crypt of Ash',
  leashRadius: 26,
  treasure: 'boss_bone_king',
  intro: 'Kneel. Your king has need of your bones.',
  deathLine: 'The crown... the lanterns... they were always... going out...',
  phases: [
    { atLifePct: 100, abilities: ['bk_cleave', 'bk_bone_spears'], speedMult: 1, dmgMult: 1, attackSpeedMult: 1 },
    { atLifePct: 75, abilities: ['bk_cleave', 'bk_bone_spears', 'bk_raise'], speedMult: 1, dmgMult: 1.1, attackSpeedMult: 1, yell: 'Rise, my legion!' },
    { atLifePct: 50, abilities: ['bk_cleave', 'bk_bone_spears', 'bk_raise', 'bk_quake'], speedMult: 1.15, dmgMult: 1.2, attackSpeedMult: 1.15, yell: 'The crypt itself obeys me!' },
    {
      atLifePct: 30, abilities: ['bk_cleave', 'bk_bone_spears', 'bk_quake', 'bk_ash_storm'], speedMult: 1.3, dmgMult: 1.35, attackSpeedMult: 1.3,
      yell: 'Burn with my kingdom!', summonOnEnter: { monster: 'bone_warrior', count: 4 },
    },
  ],
},
  • A phase sets abilities and pace/damage multipliers, and can yell, summon, shield, start a hazard volley or run one of six scripted specials.
  • Big hits have telegraphs: a wind-up and a ground marker.
  • 7 bosses shield on phase change; the Choir has linked bodies; the Leviathan floods; two bosses rebuild the arena.
  • New mechanics are new special kinds any boss can use, never per-boss AI in server/game/sim/bossMechanics.ts.
  • Leash 22–32 tiles: leave it and the boss walks home, heals and clears its arena changes.
  • Party life ×1.35 per extra player (Bone King 6,771 → 9,141 with two), so twice the damage doesn't halve the fight.

Hazards you read, not luck you survive

Acts 1–3 scatter hazards around players. Acts 4–6 use patterns with a safe spot that moves each volley: ring, cross, lines, checker, broadside.

server/game/sim/bossMechanics.tsTypeScript
case 'ring': {
  const radii = volley % 2 === 0 ? [3.5, 10] : [6.8, 13]
  for (const rr of radii) {
    if (rr > R + 1) continue
    const n = Math.max(6, Math.round((2 * Math.PI * rr) / step))
    for (let i = 0; i < n; i++) {
      const ang = (i / n) * Math.PI * 2 + volley * 0.3
      add(cx + Math.cos(ang) * rr, cy + Math.sin(ang) * rr)
    }
  }
  break
}
Pattern Behaviour
ring rings at 3.5 and 10, then 6.8 and 13: last volley's safe band is next volley's hit
cross arms rotate half a gap per volley, delayed by distance so they sweep outward
lines alternates horizontal and vertical, shifting half a gap
checker squares flip
broadside Captain Vane's cannon line walks through one player, 180 ms per impact

The Winter Queen uses four of five across four phases: Act 5's finale is a pattern exam.

The Winter Queen, a huge ice figure, stands over a frozen courtyard while ice hazards burst around a small hero
The Winter Queen at the top of the Frostbound Spires. Her phases cycle through ring, cross, checker and lines volleys, and she shields herself when a phase starts.

The Drowned Choir: three voices, one life

The Choir plus an alto and a basso six tiles to each side, sharing one pool:

server/game/sim/bossMechanics.tsTypeScript
export function spawnLinked(w: World, boss: SimMonster): void {
  for (const l of boss.boss?.linked ?? []) {
    const def = getMonster(l.monster)
    if (!def) continue
    const spot = w.nav.nearestWalkable({ x: boss.x + l.dx, y: boss.y + l.dy }, 6) ?? { x: boss.x, y: boss.y }
    const m = makeMonster(w, def, boss.level, 'boss', [], spot.x, spot.y, { packId: boss.packId, noLoot: true })
    m.linkedTo = boss.id
    m.leash = boss.leash + 6
    m.hpMax = boss.hpMax
    m.hp = boss.hp
    w.addMonster(m)
  }
}
  • Damage to a member goes to the primary (linkedPrimary); syncLinked copies life back so all bars move together
  • Primary dies, members die, same killer credited, only the primary drops loot
  • Cleave hitting two voices counts twice, on purpose: stand in the middle

Toll of the Deep: 30-tile nova, 3.2 s wind-up, 2.2× damage plus stun. Deal 5% of max life to the singer before it lands and the cast breaks, stunning the singer 2.5 s. One voice chimes at a time, with a 3.5 s breath between:

server/game/sim/bossMechanics.tsTypeScript
/** The Choir chimes one voice at a time, with a short breath between chimes. */
export function canStartAbility(w: World, m: SimMonster, a: MonsterAbility): boolean {
  if (!a.interrupt) return true
  const primary = m.linkedTo ? w.monsters.get(m.linkedTo) : m
  if (!primary) return true
  if ((primary.abilityReady.get('__chime') ?? 0) > w.now) return false
  const group = [primary, ...linkedMembers(w, primary)]
  return !group.some((o) => o.pending?.ability.interrupt)
}

A bell rings over one singer, the party swaps to it, and either "Toll of the Deep is broken!" or everyone eats a stun. Floods at 60%, two drowned priests at 25%.

The Drowned Choir's cathedral: glowing cyan singers, bell tolls and a party fighting in the flooded nave
The Drowned Choir mid-fight. Each glow is a voice or a toll wind-up, and all three bodies share one life bar.

The Architect rebuilds the room

arena_shift: every 7–10 s, the floor becomes a new randomly rotated pattern (spokes, rings, islands, maze). Later phases use abyss instead of walls.

Four square tile maps: walls radiating in spokes, two concentric wall rings with gates, abyss islands, and a wall maze, each with an orange dot in the middle
The four patterns, generated by calling the real arenaPattern on the real Mirror Halls arena (radius 14 tiles). Every open tile can still reach the middle.

New tiles show as a warn layer for ~2 s, then commit:

server/game/sim/bossMechanics.tsTypeScript
case 'arena_shift': {
  rt.shiftIdx++
  const pat = s.patterns[rt.shiftIdx % s.patterns.length]
  if (!pat) return
  const tiles = arenaPattern(w, m, pat)
  const warn = new Map<number, DynTile>()
  for (const i of tiles.keys()) warn.set(i, 'warn')
  setLayer(w, `boss:${m.id}:warn`, warn, w.now + s.telegraphMs)
  rt.shift = { commitAt: w.now + s.telegraphMs, tiles }
  w.emitNear(m.x, m.y, 'fx', { kind: 'arena_shift', src: m.id, x: m.spawnX, y: m.spawnY, r: arenaRadius(m), ms: s.telegraphMs, t: w.now })
  return
}
The Architect's arena mid-shift: glass panels and walls rise out of the floor around a hero. Captured in-engine for the trailer.

Dynamic tiles: one composite, three consumers

server/game/sim/arena.ts merges named, expiring layers (pattern, warning, bone prison, collapsing edge, flood) into one composite whenever something changes. Priority: wall > abyss > warning > water.

  1. Nav grid. Wall blocks movement and sight; abyss blocks movement. The original arrays are saved on first change, so clearing restores the exact floor. Units with paths through changed tiles re-plan.
  2. Units on it. Pushed to the nearest walkable tile within 8. Dropped onto abyss: −20% max life. Shoved by a wall: free.
  3. Clients. ZoneState.dyn carries base-36 index plus a one-letter code per tile, sorted, sent only on change. Clients decode into the renderer and their prediction nav grid, or heroes would walk through new walls for a few frames.

ensureConnected keeps it fair: BFS from the center, carve a straight corridor from any unreached open tile toward the center, repeat up to 60 times.

The sim test spawns the Architect in the real Mirror Halls, checks warnings come first, then that walls block nav and the wire string decodes to the same tiles, BFSes for reachability, kills the boss and checks every wall is walkable again.

The Unmaker borrows the whole game

Each phase names the boss it quotes ("I remember a king who built a throne out of what I left behind. Here. Have his prison.") and reuses its mechanic:

A life-bar timeline of the Unmaker's eight phases, from 100% to 12%, each labeled with the boss it echoes and its mechanic
The Unmaker's eight phases, generated from its BossDef. The Bone King's prisons at 85%, the Sunless King's eclipse at 70%, the Ember Lord's meteors at 55%, the sea at 45%, the Queen's frozen floor at 35%, the mirror knights at 25%, and the collapse at 12%.
  • Bone prison: a wall ring around every player for 3.5 s
  • Flood: a water layer that slows waders
  • Mirror knights: one per player; mirrorCopy swaps in a dark-glass version of that player's class, keeping its life ratio
  • 12%, void_collapse: edge turns to abyss 1.5 tiles every 4 s, radius 18 → 7, next ring warned; boss +35% speed, void rifts open. A DPS race with nowhere to kite.
The Unmaker fight on its floating island. The dark gaps in the orange floor are abyss tiles. Captured in-engine for the trailer.

The kill credits every hero in the zone, grants Lanternbearer, broadcasts "{name} has unmade the Unmaker" server-wide, and Marrow's Echo gives a six-line epilogue. Its sim test runs every phase, the collapse and the story completion.

How long the fights take

Solo, expected level, pure uptime, no dodging, in seconds:

Boss Monster level Warden Stalker Emberwright
Gravekeeper Mordrin 6 45
The Bone King 15 39
The Sunless King 28 34 35 26
Slagheart 36 48 44 142
The Drowned Choir 54 62 67 83
The Leviathan 55 90 92 115
The Winter Queen 65 136 125 154
The Architect 70 151 151 179
The Hollow Saint 72 155 155 279
The Unmaker 75 260 250 343

Act 1 tests pair each boss with one class; from Act 2 every class fights every boss. The test Emberwright is pure fire:

  • Slagheart (90% fire, 100% poison resist): 142 s vs 44. Like D2 immunities, it pushes a second element.
  • Hollow Saint: 12% more life than the Architect (1,400 vs 1,250) and 25% fire resist: 1.12 × 1/0.75 ≈ 1.49, predicting ~267 s from 179. Measured 279.
  • Unmaker: 4–6 minutes solo before dodging.
The Sand Colossus's arena at night: a stone giant among obelisks with a glowing ring hazard on the sand
The Sand Colossus, the Act 2 finale, mid-hazard. Acts 1–3 scatter their hazards around the players; Acts 4–6 switched to readable patterns.

Scatter versus patterns

Scatter and patterns share hazardPoints, so moving the Bone King's ash storm to ring is a data change that would teach the pattern two acts early.

The rule that holds dynamic tiles together: bosses never write the nav grid. They set and clear named layers, and one composite step owns every consequence, so a bone prison inside a flood, or a reset mid-shift, resolves the same way every time.