Stage 5: bosses that move, attacks that warn, and a second boss
ci / verify (push) Successful in 49s
ci / verify (push) Successful in 49s
Boss movement is a property of the PHASE, not of the boss -- a fight that
stands still and then starts hunting you is one boss with two phases. Four
modes (STATIC, ORBIT, CHASE, WAYPOINTS) handled generically in
SimWorld._move_boss, so a boss that moves is still data. BossDef.stationary
is gone rather than kept beside the phases: a flag claiming the boss stood
still while a phase walked around would be a second source of truth and the
wrong one, so moves() is derived.
CHASE holds a distance instead of closing, because a boss standing on top of
you is a boss whose bullets cannot be read. Waypoints are fractions of the
arena so one phase works in rooms of different sizes. Every mode is speed
clamped in one place -- ORBIT computes an absolute destination and would
otherwise snap onto its circle on the first tick -- and movement slides
against geometry so a boss cannot walk through the pillars its own arena was
designed around.
The room clamp moved to after movement, where it is finally load-bearing. It
was a no-op while every boss stood still, which is exactly when an invariant
is cheapest to establish: boss rooms deliberately do not lock, so walking out
is always an escape, and that only holds if the boss cannot follow.
TelegraphedStrikeEmitter marks spots and fills them a moment later. The moment
between is the feature: a burst at your feet is a coin flip, the same burst
with a second of notice is a question. It stays stateless like every other
emitter -- they are shared resources and two bosses of the same kind must not
stomp each other -- so strike positions are derived from the volley number and
a test asserts the burst lands where the marker promised. Markers are drawn
through fog and through walls, unlike everything else in the view, because a
warning you cannot see is an unavoidable hit with extra steps.
The Cantor of the Vault fights in the choir vault: static, then a four-corner
circuit, then a chase, then orbiting while marking. It exists to prove the
format stretched, and a test asserts it uses both new mechanisms.
Which boss a run has now comes from its SEED rather than its depth. Depth is a
dev flag nothing in play raises, so the arena was keyed to something no player
can change and the second boss was unreachable in an actual game.
Two things found while finishing:
- tools/export_content.gd had a hand-maintained boss list and had already
gone stale, silently not writing the Cantor. Content.ALL_ENEMIES and
ALL_BOSSES now feed the export tool, the renderer and five tests that each
kept their own copy.
- diag_loot failed intermittently after another diagnostic. Taking over from
the bot cleared its input queue but not its HELD input, so a starved server
coasted on the bot's last movement vector for half a second and walked the
player off the item it had been placed on. The press arrived correctly,
which is why "the press reached the simulation" passed while everything it
should have caused failed.
check.sh clean, 409 tests, SMOKE PASS (19 assertions), all four diagnostics
green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -97,7 +97,18 @@ const ENEMY_IDLE: Array[Rect2] = [
|
||||
Rect2(368, 40, 16, 16), # goblin -> stalker
|
||||
Rect2(288, 336, 16, 16), # red flask -> practice target
|
||||
]
|
||||
const BOSS_IDLE := Rect2(16, 428, 32, 36) # big demon
|
||||
## BossDef.visual -> first idle frame. Same convention as ENEMY_IDLE.
|
||||
const BOSS_IDLE_FRAMES: Array[Rect2] = [
|
||||
Rect2(16, 428, 32, 36), # big demon -> the Warden of the Fold
|
||||
Rect2(144, 428, 32, 36), # big ogre -> the Cantor of the Vault
|
||||
]
|
||||
## The first boss's strip, kept as a name because plenty of code and tests read
|
||||
## "the boss sprite" and only one of them cares which boss.
|
||||
const BOSS_IDLE := BOSS_IDLE_FRAMES[0]
|
||||
|
||||
|
||||
static func boss_idle(visual: int) -> Rect2:
|
||||
return BOSS_IDLE_FRAMES[clampi(visual, 0, BOSS_IDLE_FRAMES.size() - 1)]
|
||||
## The hub's quartermaster. A different character strip from the knight the
|
||||
## player wears, so an NPC never reads as another player standing still.
|
||||
const NPC_IDLE := Rect2(128, 36, 16, 28)
|
||||
|
||||
+26
-3
@@ -63,6 +63,7 @@ func _draw() -> void:
|
||||
if _visible(e["pos"]):
|
||||
_draw_enemy(e)
|
||||
_draw_boss()
|
||||
_draw_telegraphs()
|
||||
for p in client.remote_players():
|
||||
if _visible(p["pos"]):
|
||||
_draw_remote_player(p)
|
||||
@@ -95,8 +96,7 @@ func _draw_debug() -> void:
|
||||
## Aggro radius by visual index. Read from the content definitions rather than
|
||||
## hardcoded, so the overlay cannot drift from what the server actually uses.
|
||||
func _aggro_for(visual: int) -> float:
|
||||
for id in [Content.ENEMY_DRIFTER, Content.ENEMY_TURRET,
|
||||
Content.ENEMY_STALKER, Content.ENEMY_DUMMY]:
|
||||
for id in Content.ALL_ENEMIES:
|
||||
var def := Content.enemy(id)
|
||||
if def.visual == visual:
|
||||
return def.aggro_range if not def.emitters.is_empty() else 0.0
|
||||
@@ -254,12 +254,35 @@ func _draw_enemy(e: Dictionary) -> void:
|
||||
Color(0.95, 0.55, 0.55, 0.35), 1.5)
|
||||
|
||||
|
||||
## Attacks that have been announced but not yet landed.
|
||||
##
|
||||
## Drawn through fog and through walls, deliberately. Everything else in this
|
||||
## view respects line of sight, but a warning you cannot see is not a warning --
|
||||
## it is an unavoidable hit with extra steps, and the entire reason telegraphs
|
||||
## exist is to make the strike a decision. The marker is inside the boss arena
|
||||
## you are already standing in, so this hides nothing a player could not walk
|
||||
## two paces and see.
|
||||
func _draw_telegraphs() -> void:
|
||||
for t in client.telegraphs:
|
||||
var at: Vector2 = t["pos"]
|
||||
var r: float = t["r"]
|
||||
var left := float(int(t["until"]) - client.server_tick_est)
|
||||
var progress := clampf(1.0 - left / float(int(t["ticks"])), 0.0, 1.0)
|
||||
# Fills up as the moment approaches, so the warning reads as a clock and
|
||||
# not merely as a place.
|
||||
draw_circle(at, r, Color(1.0, 0.35, 0.3, 0.10 + 0.14 * progress))
|
||||
draw_arc(at, r, -PI * 0.5, -PI * 0.5 + TAU * progress, 40,
|
||||
Color(1.0, 0.5, 0.35, 0.9), 3.0)
|
||||
draw_arc(at, r, 0.0, TAU, 40, Color(1.0, 0.45, 0.35, 0.35), 1.5)
|
||||
|
||||
|
||||
func _draw_boss() -> void:
|
||||
var b := client.boss_state()
|
||||
if b.is_empty() or not _visible(b["pos"]):
|
||||
return
|
||||
var pos: Vector2 = b["pos"]
|
||||
var src := Art.frame(Art.BOSS_IDLE, Art.anim_frame(_anim_time, 0))
|
||||
var visual := client.boss_def.visual if client.boss_def != null else 0
|
||||
var src := Art.frame(Art.boss_idle(visual), Art.anim_frame(_anim_time, 0))
|
||||
_draw_sprite(Art.TILESET, src, pos)
|
||||
var r: float = client.boss_def.radius if client.boss_def != null else 42.0
|
||||
draw_arc(pos, r, 0.0, TAU, 48, Color(1.0, 0.4, 0.5, 0.5), 2.0)
|
||||
|
||||
Reference in New Issue
Block a user