Stage destruction: support chains and the collapse family
Continues “Stage objects: other families”.
Read from the executable (the link pass, the
link tests of every component, the support-lost
and break handlers, the collapse component) and
computed over every versus stage file with
converter/stageobj.py
(ShapeHead, MeshShape,
Triangle, Vertex on
top of the structs already there).
H = read in the code and
checked against the stage data,
M = read in the code only,
L = skimmed. Nothing here was
checked against footage. This section
corrects the geometric test
given under “Support links and chain collapse”
above (it is a ray against the other’s
triangles, not shifted triangles) and the class
2 / 53 note there.
The link pass (M code, H that the result fits the Palace’s geometry)
Stage setup runs slot 63 (0x1401fc940) on
every object S, in table order,
against every other object X, in
table order: when S.slot14(X) or
else X.slot15(S) is true, slot 11
(0x1401fc850) links them with S as the
supporter and X as the dependant:
S goes into X’s supporter list
(+0x140, 4 entries), X into S’s
dependant list (+0x160, 16 entries), and
X is marked resting (+0x100 = 1,
+0x108 = 0). The link is dropped when either
list is full. Slot 12 (0x1401fc900) takes an
object out of its supporters’ dependant
lists.
So slot 14 asks “do I carry X?” and slot 15 “do I stand on S?”. Both are a flag predicate on the other object followed by a geometric test.
Flags. Each component’s constructor ORs one bit into the object’s flag word (+0x50):
| Bit | Component | Classes (table 2) |
|---|---|---|
| 0x01 | ceiling variant (ARollF /
ACrmF of the “Ceil” classes) |
12, 13 (not on versus stages) |
| 0x02 | AWall | 7, 8 |
| 0x04 | faller (ARollF /
ACrmF of the “Rep” classes, and
class 26) |
22, 23, 26, 42, 43 |
| 0x08 | ATchR | 17, 18 |
| 0x10 | APl | 27, 28 |
| 0x20 | APl2 | 29, 30 |
| 0x40 | AOn | 1–6, 37, 38 |
| 0x80 | AHri | 17 |
| 0x100 AVer, 0x200 AVerU, 0x400 ATch, 0x1000 AHit, 0x2000 AHitif, 0x8000 + 0x80000 ACol, 0x10000 ARoll, 0x20000 ACrm |
Tests per class family (slot 14 / slot 15 routine; predicate = mask on the other’s flags):
| Family | Classes | “I carry X” (slot 14) | “I stand on S” (slot 15) |
|---|---|---|---|
| AVer + AOn | 2 / 1–6 | X & 0x40, ray up (0x1401da7e0) | S & 0x75, ray down (0x1401da920) |
| AVer + AWall | 2 / 7, 8 | X & 0x0F, ray up | S & 0x06, ray down |
| faller | 2 / 22, 23, 26 | X & 0x7A, ray up | S & 0x32, ray down |
| AVerU + APl | 2 / 27, 28 | X & 0x5D, ray up | S & 0x15, ray both ways (0x1401dad10) |
| ATch + ATchR | 2 / 17, 18 | never | S & 0x77, touch (0x1401dd130) |
| none | 2 / 48, 53, 54, 58, 1 / 4, 1 / 15, 4 / 16 | never | never |
The ray test (0x1401fe590; arguments: own body list, a direction, the other’s body list, a one-way flag, a length factor that is always 1.0). For every mesh shape (type 3) of the caller’s current-state collision list and every mesh shape of the other’s: the segment from the caller mesh’s bounding sphere centre to centre + d̂ · radius (both-ways: from centre − d̂ · radius) is tested against the other’s bounding sphere and then against each of its triangles (0x1401d2620: the two ends lie on different sides of the triangle’s plane, or on it, and the crossing point is inside the triangle; two-sided). d̂ is the caller’s own Y axis (row 1 of its matrix): + for “up”, − for “down”. The shapes are the world-space copies the object built at setup, so the centre and the triangles are already placed.
The touch test (0x1401fe490 → the sphere / mesh pair routine 0x1401d7fd0): the bounding sphere of a mesh of the touch object against the triangles of the other: the spheres overlap, the triangle’s plane is nearer than the radius, and either the centre’s projection lies in the triangle or one of its edges passes through the sphere. It is generous: a railing links to whatever deck its 8–12 unit sphere reaches.
The faller classes’ link pass (slot 63 override 0x1401eafe0) first does two more both-ways ray tests against the arena’s own collision list (0x1405322c0) and against the objects of a second list (0x140531c10, filled only by the class 2 / 17 constructor), recording up to four “neighbours” (0x1401eaf40; the arena as the value 1). No reader of that record was found and no listed object passes its predicate on the versus stages (L: looks like an unused anchor rule).
Losing support (M)
- Break (slot 26) and kinesis grab (slot 18) both end in “release dependants” (slot 24 / 25, 0x1401fc9c0; the faller classes’ 0x1401eb380 does the same): the object unlinks itself from its supporters, then for each of its dependants removes that dependant’s collision and calls its support lost handler (slot 27), all in one go.
- One lost supporter is enough. The handler does not look at the dependant’s other supporters, and the hit counter plays no part (a 3-hit deck section falls at once).
- Support lost, crumble family (0x1401e83c0; classes 3, 8, 18, 23, 28, 48, 53): once only (taken byte); the state’s kind 2 / id 0xFF effects at the object (no contact point); effects released; its own dependants released (the chain); the break attack sphere (below); the break sound; then pieces from the pieces state with no impulse and the object’s own stored point as the centre, or, without a pieces state, the object is deleted. With no impulse the piece launch rule of “Breaking” gives each velocity component the pseudo-random −0.1..+0.1, so the pieces simply drop.
- The faller crumble (2 / 23) differs from the plain crumble in one thing besides its link masks: its “make pieces” (slot 30, 0x1401e9440) always uses that stored point and no impulse, also when a shot broke it. A deck section never flies away from the hit; it drops.
- Support lost, roll family (0x1401ebf90; classes 1, 2, 4, 17): as “Breaking” for that family, with no impulse.
- The chain is not sent over the net. Only the first break is an event (message 7, code 0x47, with its stage clock stamp); every peer runs the same link lists from it.
- With bit 1 of 0x140530ccc set (the pre-destroyed stage state) the effects, attack sphere and sound are skipped.
The break attack sphere (M code, H data)
Every break and every support-lost handler calls 0x1401e7300. When float 0 of the first joint of the object’s state 0 model is non-zero it creates a short-lived attack body (collision category 0x400, the same category as a flying piece’s) at the object’s position: a sphere of radius 0.7 × the length of the model’s bounding box diagonal, attack value = that float as a byte. This is the “float 0 on the state 0 model (one stage only)” of the joint parameter table. Only st06 definition 16 carries it (value 3; class 2 / 3, 10 placed): those objects hurt what stands next to them when they go. What the 0x400 body does to a character is still not followed.
No camera shake, rumble or sound cue is
started by the break, support-lost or collapse
handlers themselves: they spawn the state’s
effect records, the attack sphere and the row’s
break sound, nothing else. Any shake on a
collapse therefore comes from an effect record
type (the EF00 constructor table,
left to the effects decode).
The collapse family (2 / 6, 2 / 26; M)
The ACol component (constructor
flags 0x8000 | 0x80000; init 0x1401eb3e0, tick
0x1401eb610, draw 0x1401eb6e0, break
0x1401e7cd0, support lost 0x1401e7aa0, hooks
0x1401f3020 / 0x1401f3120 / 0x1401f31a0 for 2 /
6 and 0x1401f3230 / 0x1401f3350 / 0x1401f33c0
for 2 / 26). It is an animated collapse,
not pieces:
- Setup. One 0xC0-byte record per joint of the model’s skeleton; every collision shape of the state’s list is tied to the joint whose index is the shape head’s 4th byte (the “pad” byte of the 12-byte head; 0xFF = none), so the collision moves with the joints. The state’s kind 0 / id 0xFF effects are spawned as standing effects.
- Break or support lost. Once only:
kind 2 / id 0xFF effects (at the contact for a
break, at the object for support lost), effects
released, the component’s start hook, dependants
released, attack sphere, break sound. The start
hook switches the object to state
1 and starts state 1’s animation (the
definition’s
OAstream) at time 0; the end time is the stage clock’s elapsed ticks plus the animation’s length (float at +8 of the stream). Without a state 1 the object is deleted. - Update (slot 68). Animation time = elapsed stage clock − start; at the end the pose holds. The object is then deleted unless the first joint of its state 0 model is named 0xC3500000 (the same name code that keeps a resting piece): such an object stays as the collapsed wreck, with its collision in the final pose.
- Being on the stage clock, the collapse plays at the same time on every peer.
- Data. st02 list 0: nine class 2 / 26 objects (definitions 0–8, placements 0–8; one joint intact, 7–16 joints in state 1) with no supporter; five of them carry others (17 class 2 / 2 objects and one 2 / 3). st02’s other lists do not have them. st06: one class 2 / 6 (definition 2, two joints), no links. Not read: the animation lengths, the per-joint record’s use in the draw, and whether the moving collision hurts a character.
The special object 1 / 15 (L)
st02 ×1 (definition 23: 6 joints intact, 24 in the pieces state). A crumble breakable with no link test whose pre-update (slot 65, 0x1401e77b0) re-poses the joints named 0x4B085FC0 (the “stays in place” joints) of its pieces model each tick; 0x1401eb800 belongs to it. Not followed further.
Class 2 / 53 (correction)
It has neither a hit component nor a link test, and its flag word has none of the bits a link predicate asks for, so on st05 it is never linked (0 links on that stage) and shots cannot break it. The earlier “breaks only when its support goes” is wrong; what, if anything, breaks it (its class update is the floating props’ 0x1401f3c40) was not followed.
The links in the data (H for the lists as computed; the rule itself is M)
stageobj.py runs the link pass
above on each placement list and writes it as
support_links (pairs supporter,
dependant; placement indices). Links per stage,
list 0 / list 2: st02 28 / 10, st03 78 / 31,
st04 61 / 13, st06 2 / 2, st05, st07, st08, st24
none.
The Palace (st03), list 0. The upper bridge is four deck sections (class 2 / 23) on four pillars (class 2 / 28), with railings (class 2 / 18) on the deck. Deck top at y = 109, pillars y 50–100, game units.
| Placement | What | Hits | Supporter | Dependants |
|---|---|---|---|---|
| 0 | deck, x 94..200 (definition 0) | 2 | pillar 4 | pillar 4; railings 140, 141, 142, 147, 148, 161, 171, 172, 173, 174 |
| 1 | deck, x 20..95 (definition 1) | 3 | pillar 5 | pillar 5; railings 138, 139, 140, 143, 165, 167, 171 |
| 2 | deck, x −105..−37 (definition 2) | 3 | pillar 6 | pillar 6; railings 136, 137, 160, 163, 164, 168, 169, 170 |
| 3 | deck, x −200..−94 (definition 0) | 2 | pillar 7 | pillar 7; railings 136, 144, 149, 150, 160, 162, 168, 170, 176, 177 |
| 4, 5, 6, 7 | pillars at x = 140, 50, −50, −140 (z = −50; definition 3) | 1 | its deck | its deck |
- A pillar and its deck section hold each other (the pillar’s up ray finds the deck; its both-ways “stand on” ray finds it again from the other side). One hit on a pillar brings down its deck section and every railing on it in the same tick; breaking a deck section (2 or 3 hits) also takes its pillar. Neighbouring deck sections are not linked: the other three stay up.
- Railings 136, 140, 160, 168, 170 and 171 sit across a joint and fall with either section. Four more railing ends (147–150) are also held by a wall railing piece (class 2 / 8: placements 115, 112, 121, 122). Railing 166 (over the gap between decks 1 and 2) and the two class 2 / 18 objects 91 and 92 have no supporter.
- The rest of the stage: 10 class 2 / 3 stands (definition 4 → definition 5) with 16 class 2 / 18 objects on them (placements 9–35), three class 2 / 17 objects on crates (94 on 93; 97 on 88 and 89; 100 on 58 and 59), and three crate-on-crate links (88 → 89, 89 → 54, 96 → 93). The 30 wall railing pieces (2 / 8) stand on nothing and carry only the four railing ends above.
- List 2 (147 objects) has no deck sections and no pillars; its 31 links are the stands, crates and 15 of its 17 class 2 / 18 objects.
st04 has the same construction: 7 class 2 / 23 sections, 4 of them on class 2 / 28 supports (mutual, as on the Palace), carrying 17 class 2 / 3 and 12 class 2 / 1 objects; the longest chain is 8 objects.
Implementation notes for the rebuild
- Converter:
stageobj.pynow writessupport_links[list] = [[supporter, dependant], …](objects.jsonversion 2). Nothing else is needed from the files for the chains. - Game: at stage load take the pairs of the active placement list. On a break or a kinesis grab of object S, in the same tick and before S’s pieces are made visible: for each dependant X not yet taken: mark it taken, remove its collision, play its break effects (kind 2, id 0xFF) at the object and its break sound, recurse into X’s dependants, then make X’s pieces with no impulse about the object’s own point (or remove X when it has no pieces state). No hit counting, no check for other supporters, one pass, depth first in list order.
- Class 2 / 23 (Palace and st04 deck sections): pieces always with no impulse, also on a direct break.
- Net: nothing to add. Apply the chain locally when the timed break event (message 7, code 0x47) is applied; the order is deterministic from the link list.
Built (collapse, 11-13). The Godot
side follows these notes
(stage_objects.gd link /
release_dependants, stage_object.gd
lose_support); the per-stage results of the
links, computed by
tests/test_collapse_stages.gd on
the converted stages (list 0; the +10 / +20
variants give the same numbers as their base
stage):
| Stage | Objects placed | Links | Objects that carry others | Longest chain (objects, intact stage) | Collapse family | Attack spheres |
|---|---|---|---|---|---|---|
| st02 | 216 | 28 | 15 | 5 | 9 (placements 0–8) | 0 |
| st03 | 179 | 78 | 36 | 12 | 0 | 0 |
| st04 | 158 | 61 | 33 | 9 | 0 | 0 |
| st05 | 62 | 0 | 0 | — | 0 | 0 |
| st06 | 266 | 2 | 2 | 2 | 1 (placement 16) | 10 |
| st07, st17 | 4 / 0 | 0 | 0 | — | 0 | 0 |
| st08 | 49 | 0 | 0 | — | 0 | 0 |
| st24 | 0 in list 0 | 0 | 0 | — | 0 | 0 |
stageobj.py writes a non-finite
float as null (st02 has effect
records whose parameter 0 holds a NaN bit
pattern, so that word is not a float for that
record type).
- Break attack sphere: only st06 definition 16 needs it; its effect on a character is in “Stage attack bodies and landings” (hurt).
- Collapse family (st02 ×9, st06 ×1): switch to state 1, play its animation once on the stage clock, move the collision with the joints (shape head byte 3 = joint index), then delete or keep by the first joint’s name. Needs the state 1 animation streams exported per joint; not ready to build until the lengths and the stream export are checked.
- Not ready: special object 1 / 15, class 2 / 53, the effect record types the handlers spawn (effects decode).