Files
isaac-port/notes/entities/pass2_haunt.md
T
shweetandClaude Opus 5.5 ad8f933086 Salvage Repentance+ 1.9.7.17 decompilation toolkit, notes and name database
Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes
indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that
build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:08:19 -04:00

10 KiB

Group haunt: notes

Decompiles: ./decompile.sh 0x00481410 (THE_HAUNT, Haunt and Lil Haunt), f_00495610.c (RAG_MEGA, all three variants), f_005135d0.c (KNIGHT: 41.x, 254, 283), f_00539b90.c (HOMUNCULUS: 228 and 251). FireProjectiles modes from decompile.sh '^Entity_NPC::FireProjectiles$': mode 5 is 5 shots at 0, +-12 and +-24 degrees; mode 9 is N in a ring (vel.x = speed, vel.y = N).

haunt (260.0)

Skin phase (state 4, while lil haunts parented to it remain): MoveRandomlyBoss(0), then friction *0.9, and the shared *0.96 at the end of the AI. Changed wander-like hover 0.15/0.9 to drift, speed 0.5, retention 0.864. It spawns its lil haunts on init at radius 50 (was 60).

No-skin phase (state 3): y is pinned to room top + 30 every tick (line 788). x accelerates by field_0x334 (starts at +0.3) each tick, which flips on a wall hit (plus a 15 kick), under friction 0.96. Changed to move line, speed 0.3, retention 0.96, bounds y 170..170 (was hover 0.25, y 170..200).

  • Dash (AngryNoSkin): Isaac within 40 of its row, 1/40 a tick: vx = |vx| toward him + (10 + rand*5). Now period 1, one_in 40, line {row, within 40}, impulse 10, lunge_spread 5, retention 0.96 (was period 7, 1/12, range 200, lunge .6). Moved before the attack roll, as in the AI.
  • Attack roll: stateFrame > 60 and 1/60 a tick, then a coin picks spit (state 8) or laser (state 9); stateFrame is reset when it returns to state 3. Now spit period 1, one_in 60, pick_next 1, cooldown 60 and laser rolled false, cooldown 60. The laser no longer needs Isaac in its column (no such check in the AI).
  • Spit (subtypes 0/1): on Shoot, mode 5 with velocity (0, 10): five shots straight down, 12 degrees apart, speed 10. Was five aimed shots .25 apart at 8. Now direction [0,10], count 5, spread 0.2094, speed 10.
  • Laser subtype 0: one thick laser at 90 degrees (down), timeout 10; pink: 135 and 45. Kept the beams.
  • Black (subtype 1) state 9 throws spiders instead of a laser (1, plus a coin for a second): kept, now reached by pick_next from the spit.
  • Peel: retention 0.48 (friction *0.5 and *0.96 while it plays), cooldown 60.

Not expressible / left:

  • The record opens with AngrySkin to spawn the lil haunts. In the AI the haunt spawns them silently on init, and AngrySkin is the transition once they are gone (alpha fades from 0.5 and y eases toward room top + 20, then Peel). Proposed: spawn_on_init (attack-free spawn of the partner ring on the first tick), so AngrySkin can move to the phase opening.
  • Pink spit (subtype 2) is a sweep: every second frame between Shoot and Stop, one aimed shot at speed 10 turned by ((v2 * .5 * s + .5) * 120 - 60) degrees, s = +-1 alternating every 4 frames, v2 += .125 a shot, so shots alternate sides and widen out to +-60 degrees. Only its speed was fixed (8 to 10). Proposed shots[] field sweep {every: 2, step: 0.125, range: 120, alternate_every: 4} for aimed shots between release and stop.
  • Dash sets vx to |vx| toward Isaac before adding 10..15. impulse adds to the signed velocity instead. Proposed attack flag impulse_keeps_speed (turn the current speed toward the impulse axis first).
  • The real dash is not an attack, so it does not block the 60-tick attack clock. Here the attack cooldowns also hold it back after a spit or laser.
  • Line move bounces only off walls. The record has grid_collision false, so the lead should check that the room walls still reflect it (the AI's grid class is 3, walls only). If they do not, the x bounds clamp it with no bounce. The same check applies to rag_mega's bounce.

lil_haunt_260_10 (260.10)

  • Orbit (state 3): its position is set to the parent + 50 * (cos, sin) of (i1 / count * 360 + 2 * roomFrame - 40) degrees. Radius 60 -> 50, spin 0.05 -> 0.0349 rad/tick (2 deg). (The real orbit sets the position directly, while orbit's speed pulls it there. The speed was left alone.)
  • Detach: slot 0 after 90 frames since spawn (was 60); others once fewer than 3 remain. kin_below was kept. The black version keeps kin_below 2, because I could not read what parent+0x30 means for it.
  • Chase (state 4): accel 0.5 toward Isaac + lead, friction *0.95 * 0.96 -> retention 0.912 (was 0.95).
  • Shoot: stateFrame > 90, dist < 200, 1/50 a tick; on Shoot one shot at Isaac + 5 * his velocity, speed 10; stateFrame then resets, so add cooldown 90, period 1; friction *0.5 while shooting -> retention 0.48.
  • Not expressible: the chase lead is Isaac's velocity * distance * 0.5, which grows with distance (line 299). Proposed lead_per_distance. I am not sure FUN_00435a50 is a sqrt here, so lead 8 was kept.

rag_mega (409.0)

  • Movement: when not feared, velocity += sign(vx, vy) * 0.4 on each axis (zero vy goes negative) under friction 0.8, which is the Boom Fly bounce. MoveRandomlyBoss runs only when feared. wander .4/.9 -> bounce .4/.8.
  • Ragling (Attack01): if the ragling count is 0 it is chosen with no roll, else 1 in (100 * count), only while count < 3. They spawn on frame 20 at pos + (0, 10) with velocity (0, 10). Now two attacks: one with no roll, gated on no live raglings and no remains; one with one_in 150 (the mean of 1/100 and 1/200) and the cap below 3. spawn_at [0,10], spawn_velocity [0,10]. Cooldown 30 and spawn_offset 30 were removed, since the AI rolls every tick in state 4.
  • Pillars (Attack02): 1/70, only while a ragling lies dead (state 16, here rag_mans_ragling_remains), so when type_count remains above 0 was added. Three pillars spawn with velocity 10 at (r + 0/120/240) degrees, r random. They slide at speed 10 (was 2.5). The "fixed angles" in the record are only half wrong: the 120 degree spacing is right, but the whole star should turn by one shared random angle. Proposed spawn_cone/shared: true (one draw for the whole release). Note that the AI plays "Rebirth" for this attack (a 40 frame animation with no events; the spawn is on stateFrame 20). Attack02 was kept, since it has the Spawn event at frame 19.
  • Cover: 1/45. It is not invulnerable during Cover; it becomes so when Covered starts, for 60 + rand(30) ticks, then Uncover, vulnerable again past frame 20 (the Open event). untouchable was removed from Cover. Covered is now repeat {limit 1, limit_random 2} (60 or 90 ticks). Uncover lost its cooldown 30.
  • Out of scope, for the lead: entities2.xml gives Rag Mega radius 35 (record 30). The pillar record (rag_megas_rebirth_pillar) is move still with fade life 90. In the AI the pillar keeps its spawn velocity (friction 1), is removed when it touches a wall or its 24-frame "Rebirth Pillar" ends, revives any ragling in state 16 within 40, and heals other NPCs within 40 by 25% of max hp a tick. The record uses a revive radius of 60.

Knights (floating_knight 254, bone_knight 283, loose_knight 41.2, brainless_knight 41.3, black_knight 41.4)

Charge test (all): every 3 ticks by index, target = Isaac + his velocity * rand * 16 (the record had prediction_duration 8). Cell centre within 20 on an axis, dist < 200, CheckLine (skipped for the floating knight). The charge then adds a unit axis vector each tick under the walk friction, and the cross axis eases 10% a tick to the cell centre. The lane charge already models this.

  • floating_knight: charge acceleration 0.85 -> 1. No line check -> flight_line true (closest available).
  • bone_knight: charge vector * 1.65 (variant 1 and type 283) -> speed_multiplier 1.3 -> 1.65.
  • brainless_knight: friction 0.88 instead of 0.8, both walking and charging -> lane and charge retention 0.88.
  • loose_knight: prediction only.

Not expressible (proposed):

  • lane/walk: "roam": the Repentance knights walk with MoveRandomlyAxisAligned (roam_step), not Flash's corridor wander. Walk speeds: default 0.75, loose 0.6, brainless 0.75 (with 0.88 friction), black 0.66, selfless 1.25, bone 0.75. Change the record speeds only once roam is used. They are Flash-tuned for corridor wander now.
  • Floating knight walk (type 254): every 30 + rand(15) ticks it picks one of 4 directions at random, accelerates 0.75 a tick under friction 0.8, and reverses on a grid hit. Proposed lane/walk: "axis_turns" {period 30, period_random 15, speed}. Its charge skips the line check: proposed charge/sight: false.
  • Bone knight: the charge ends when it passes Isaac (dot(Isaac - (pos - dir * 40), v) < 0). Proposed charge/stop_past: 40. It also leaves creep every 7 ticks by index (changed creep period 6 -> 7).
  • Black knight (nothing changed): walks by FindGridPath(Isaac, 0.66) steering at its roam speed. Its charge vector is 0.7, growing by 0.07 a tick toward 4 (terminal near 16) under friction 0.8. On a head-on wall hit (speed > 8, wall normal dot > 0.9) it shakes the screen, spawns 3 fire jets at dir + 180 + (-90, 0, 90) degrees (back and both sides, not the wall side), bounces back by 5 * the normal speed, hops (z velocity -5, gravity 1.1), and is stunned 45 ticks with friction 0.88. Under 8 speed the charge just ends. The record uses charge_speed 7 and 4 cardinal jets. Proposed: charge ramp {start 0.7, step 0.07, cap 4} plus wall_next gated on min_speed 8, and bolt directions: "off_wall" (the 3 headings away from the struck wall).

homunculus (228.0) / begotten (251.0)

  • Leashed walk: FindGridPath(Isaac, 1.5) with friction *0.8 every tick -> move path, speed 1.5, retention 0.8 (was chase 0.3/1). Leash: pos + vel past 100 from the anchor clamps it there (was 70).
  • Breaking free (to state 8): only while at the leash limit. Either stateFrame > 60 + rand(30), on IsFrame(30) and 1/5, or hurt at the limit 1/4, or the rock anchor breaks. Now {after_tick 75, clock {period 30, to 1}, one_in 5}, {hurt, one_in 4}, {unanchored}. Homunculus keeps its flag gate. Its after_tick 240 + no Mr. Fred gate was dropped: the AI has no Mr. Fred test. Begotten's per-tick 1/150 after 90 was dropped, and it now gets unanchored too.
  • On breaking free: FireProjectiles mode 9 (10, 6), a ring of 6 at speed 10 (speed was unset). Begotten also darkens for 150 ticks (already there).
  • Free (state 8): FindGridPath(Isaac, 2) -> patch speed 2 (homunculus 0.55, begotten 0.6).
  • Not expressible: the "at the leash limit" requirement. Proposed gate leash_taut: true (open only on ticks the leash clamped it). The ring fires from the anchor moved 60 toward it, not from itself. Proposed attack at_anchor: 60.