Stage objects: classes, hits and breaking
Read from the executable (class tables, the
object base class and the crumble / roll class
families) and checked against all stage files
with a struct reader (StageHeader,
Placement, ObjectDef,
Esper-RE’s armature chunk and
joint_t). What is only skimmed is
marked.
Loading (0x140203720) and spawning (0x140203dc0).
- The placement list is header list
variant + 1when that list exists, else list 0. The variant byte (0x140531dcf) is the low byte of a per-battle setting written by the battle setup code; which menu setting it is was not traced. Lists 0, 2 and 3 exist in our files (the Palace’s list 2 has fewer breakable pieces than list 0). - Each
OB00record becomes a 128-byte runtime definition: three model pointers, then the animation, collision and effect list pointers. The three slots are object states, not stage variants (this corrects the earlier note): state 0 = intact, state 1 = broken pieces, state 2 = wreck / remains. The object keeps a current state index and uses that state’s model, collision list and effect list. - Per placement: the constructor is
class_tables[table][class](table array 0x1402dc4f0; table 1 → 0x1403ee620, 2 → 0x1403ee870, 3 → 0x1403ee720, 4 → 0x1403eeae0). Table 2 class N is the class the game calls “Rep NN”; table 3 holds the town props (chairs, units, doors); table 4 holds the readable objects and class 16, the jump pad. The new object then gets its models, animations, effects and collision per state, the definition’s parameters (below), the placement’s phase and argument, position and rotation, and is initialised. - Phase and argument (placement bytes 6 and 7) are ignored by the base class and by every class the Palace uses. Phase is read by the jump pad (stored as a float parameter of the pad), by the falling classes, the st01 “ruin” classes, the readables and doors; argument only by the town unit / chair / door classes.
Object parameters live in the
model. Each state’s model has a
skeleton chunk (type 3); the 16 bytes Esper-RE’s
joint_t calls pad2 are
four floats per joint. The
definition builder (0x1401e24d0) scans every
joint of each state model and keeps, per state,
the last non-zero value of each float as a byte,
plus a flag byte (bit 0–3: that float is
non-zero somewhere, bit 4: a joint with name
code 0x4F588000 exists).
| float | on the state 0 model | on the pieces model (state 1) | on the wreck model (state 2) |
|---|---|---|---|
| 0 | (one stage only) | attack value of that piece
(2, 3 or 4): when non-zero the flying piece
carries an attack body (category 0x400,
pdStageColPtr_StObjAtck) while it
moves faster than 1 unit per tick; what that
body does to a character is not traced |
2 or 3 |
| 1 | sets a flag bit on the object (value 2 or 3 where set; effect not followed) | (rare) | 2 or 3 |
| 2 | hits to break (0 counts as 1) | — | — |
| 3 | sets object flag 0x2000000 (effect not followed) | — | — |
In every stage file the hit count is 1, 2 or 3. On the Palace (179 placements in list 0): 30 pieces of one class (table 2 class 8) take 2 hits, four pieces of class 23 take 2 or 3, everything else breaks on the first hit.
What hits an object (base class, 0x1401fd6e0, every tick).
- A stage object’s collision body has category
0x100 and accepts categories 0x04 and
0x40 (mask 0x44; a few classes use mask
1 instead). Shots create a second body of
category 0x04 just for objects
(0x1401631e0; accepted targets 0x1900), which
carries the shot’s collision callback.
Category 0x40 is the body of
the effect element class
pdvkDestroy(0x14021d610, accepted targets 0xF00): a destruction sphere that an effect can carry. - The handler walks the contacts of the current state’s body (at most 8 different other bodies per tick) and takes those whose contact type is 2 or 3 and whose category is in the object’s mask.
- Hits left ≤ 1 (or the object’s “force break” flag 0x20000000): the object breaks.
- Hits left > 1: a category 0x40 contact is ignored (a destruction sphere only breaks objects on their last hit; it does not wear down tougher ones). Any other contact plays the object’s hit reaction and takes one hit off: a routine indexed by the contact’s material byte (0x14021d3f0, not followed), the object’s hit sound, and every effect record of the current state’s effect list with kind 1 and id 0xFF, spawned at the contact point along the contact direction. (The reaction is skipped, but the hit still counts, when the other body is of kind 1 and lacks category bit 0x2000.)
- Object flag 0x2000 sets the counter to 255. In the two network modes the hit or break is also sent as a message (0x1401fce70, 0x1401fccd0, 0x1401fcb70 / 0x1401fca10) and the receiver applies the same counter logic (0x1401fd5xx).
Breaking (crumble family 0x1401e85b0, roll family 0x1401ec350). Runs once per object:
every effect record of the current state with kind 2 and id 0xFF is spawned at the contact point (92-byte records, as in
EF00);the object’s collision bodies are removed, so shots and bodies pass from this tick on;
the break sound is played at the contact point. Sounds come from the object sound table (header 0x0F8, one s16[8] row per definition; 0x1401fc750): word 0 = hit sound, word 1 = break sound (the Palace rows have no hit sound and a break sound on every breakable definition);
if the object has a pieces state, the object switches to it and every joint of the pieces model that has a mesh becomes its own flying piece (0x1401e8960; corrected 11-13: only the joints whose parent is joint 0, see “Broken pieces: the start pose”):
- joints named 0x4B085FC0 stay where they are (the stump that remains); name 0xC3500000 marks another special piece;
- velocity (game units per tick) = ½ · (impulse + d̂ · L) · F, where d̂ is the unit vector from the contact point to the piece, dist that distance, impulse the reversed contact direction, L its length, and F = √(1300 / dist) for dist > 200, else 2.54951 (= √(1300 / 200)); when the impulse is nearly zero (L² < 0.1) each component gets a pseudo-random −0.1..+0.1 (byte hash of the object’s serial plus a running counter that starts at 0 per break and advances only for pieces that take the jitter: h = low byte of s·33 + 33 + (s >> 1), value h · 0.2 / 256 − 0.1); the result is scaled by a per-model factor and, if longer than 1.5, set to length 1.5;
- gravity is (0, −0.5, 0) (vector at 0x140461660) times a per-model factor, applied as acceleration / 30 per step (11-13, climb: the factor and the launch factor are the floats +0x38 and +0x34 of an effect record of type 31 in the object’s own state-0 effect list; without that record both are 1; see “The launch / gravity factor record” below. Gravity is 1.0 in every record of the game);
- only when the global at 0x1403e0304 ends in 5 (value mod 10; corrected 11-13, climb 3: this is not a tick counter but a value set per battle that the stage setup also tests by its last digit, a stage number by its use (M); the piece routine’s test is for 5, so not on the Palace, st03) the piece also gets a second acceleration vector (random direction, length 0.5) that replaces gravity once the piece is older than 30 ticks;
- the piece’s attack value is its joint’s float 0 (see the table above); object flag bit 2 delays the piece’s stage collision by 8 ticks.
Crumble family (Palace classes 3, 8, 18, 23, 28 of table 2): without a pieces state the object is deleted (flag 0x80000). Roll family (classes 1, 2, 4, 17): corrected 11-14 (playfix): not this path at all; the state-2 model flies as one box and the object switches to state 1 or is deleted, see “The roll break: one flying box”.
Sound row value → cue
(stageobj, 11-10). 0x1401fc750 reads
word k of the object’s row (0 =
hit, 1 = break); a negative value plays nothing.
Otherwise the value and the contact point go
into a stage-wide queue (0x140201ce0: at most 64
entries of value + position). The queue pass
(0x140201d30) does nothing but count down while
a cooldown runs (entries queued meanwhile are
dropped); with entries and no cooldown it sets
the cooldown to 30 passes,
plays the first entry and then every later one
that is at least 500 units
(float at 0x1402f81b8) from all already played,
at most 5, and empties the
queue. The played cue is
table[2·value + r] of the u32 table
at 0x1402dc640, r = one random bit
(rand15·2 >> 15), on sound slot 0 = the
common bank (same call as the
aura point sound), at the queued position with
volume / pitch 0x1000. Table by value: 1–6 →
cues 8–13; 8 → 14; 9 → 16; 17–23 → cue = value
or 155 + value; 24–29 → the pairs 179/180 …
189/190; (stagefx 11-15) 36–39 → the
pairs 191/192 … 197/198 (used by row word 2, the
piece impact sound); every other entry −1. The
Palace’s rows (17, 19, 20, 21, 22, 26) all have
both cues in the common bank.
Pieces model per joint
(stageobj). Each index buffer of the
pieces model names its joint
(transform_idx, as in Esper-RE’s
idxbuf_header); its vertices are in
that joint’s space and the bind matrix puts them
in model space.
pdconv --split-joints <models>
writes such a model as one node
model_<m>_j<k> per
joint (geometry still baked in model space, node
extras pd_joint and
pd_bind, the joint’s bind matrix in
glTF space); everything else of the glTF (the
.bin, accessors, materials, shadow volumes)
stays byte-identical (checked on st03: same
.bin, same primitives per model). On st03 the 22
pieces models have 2–11 joints with a mesh. A
pieces model at its bind pose does not always
match the intact model: the definition 0 pieces
model of the Palace is modelled already cracked
(bounds y 83.6–115.2 vs 97.7–110.9 intact) and
most bridge pieces are 1–2 units taller; 1 of 22
matches the intact bounds within 5 %.
Lifetime of the objects. Objects are spawned only by the stage setup (callers 0x1401d1870 and 0x140204e60) and removed with the stage (0x140203d20 ← 0x1402045d0 ← 0x1401d1b90). No respawn path during a battle was seen: a broken piece stays broken until the stage is loaded again.
Broken pieces: an 8-point
box (class
pdStageObjRollBase, tick
0x1401f9900). A piece is not a rigid body with a
spin; it is eight points (the corners of the
piece’s box, set from its matrix by 0x1401f8440)
moved by position-based steps, and the drawn
matrix is rebuilt from the points each tick
(edges from point 0 to points 1, 2 and 3).
The box is the stored bounds of the joint’s first index buffer chunk (corrected 11-13, “Broken pieces: the start pose”), changed per axis: an axis longer than 5 units is inset by 15 % of its length on both sides; one shorter than 1 unit becomes −0.5..+0.5. The piece also keeps the volume of the unchanged box (its “size”). Point numbering: 0 the low corner, 1–3 its three neighbours, 7 the far corner; the 12 edges are the byte pairs at 0x1403e1178, the 6 faces the byte quads at 0x1403e0f48.
Per tick, two sub-steps of:
- per point: velocity = current − previous position; a point whose velocity² is below 0.005 adds one to its slow counter (a byte that is never reset), and counts as resting once the counter is above 16; then velocity += acceleration / 30;
- when all eight points rest, the piece goes inactive (nothing below runs any more);
- new position = current + velocity; the piece is deleted when point 0 is at or below y = −100 or 800 units or more from the origin;
- once the piece is older than its collision delay (0, or 8 ticks): stage collision (0x1401f8cd0). Each corner looks up its cell of the stage’s triangle grid and goes through that cell’s triangles, passing over grid records whose first byte is 0x10, 0x11, 0x12 or 0x14 (the mesh attribute; confirmed 11-13, climb: the grid’s record byte is the shape record’s attribute byte). Corrected 11-13 (climb 3): after the grid each corner is also tested against the up-facing triangles of some intact stage objects (“Broken pieces: the object pass” below); characters are not seen. The grid itself is described under “Broken pieces: the Palace climb re-check”. A corner P that is behind a triangle’s plane (n·(P − V0) < 0) by less than 2 units, and whose projection on the plane lies inside the triangle, is moved to that projection; then half of its velocity’s x and z are taken off its position (0x1401f7870). No ray and no test of the direction of motion. A piece whose size is above 2200 does the same with its 12 edge midpoints (0x1401f7570): both points of the edge move by what puts the midpoint on the plane, each then loses half its own velocity’s x and z; a size above 800 adds the 6 face centres (0x1401f7280, four points each);
- twice (0x1401f9590): 28 distance constraints (rest lengths from the box in the joint’s space, which is the launch pose as long as the joint chain has no scale): both points move half the length error toward the rest length. Corrected 11-14 (collapse 6): the 28 are not every pair of points; they are a fixed table (12 edges, 4 body diagonals, 6 face diagonals twice), see “Broken pieces: test order, constraint table and rest”.
A piece that starts inside the stage (checked 11-13 on the Palace bridge): the step is one-sided and has no motion test, so a corner that is already behind a face by less than 2 units at the launch pose is moved onto it at once, and the move becomes velocity on the next sub-step (velocity = current − previous). A piece wedged between faces of opposite facing is squeezed out upward: in our build Palace deck section 1, broken by losing its pillar, has a piece that starts inside the tree’s faces (attributes 10 and 31, which the pieces test) and climbs. Updated 11-14 (collapse round 5): the start pose is decoded since round 4 (“Broken pieces: the start pose”), and the footage contradicts the climb (climb 3). With every decoded rule built (collision delay, jitter, object pass, collapse 6), that piece still rises 36.6 units in our build (25.6 in round 5, 64 in round 4, 44 before the decoded pose; the collapse-6 port: 38.1). Updated 11-14 (collapse round 7): shipped as a known gap, built as decoded with a cause still missing: PLACEHOLDERS “Palace deck section 1 high throw”. See “Broken pieces: the object pass, delay and jitter”, “Measured in the rebuild”. With no impulse the launch is the jitter alone (added after the scaling, |j| ≤ 0.1·√3 ≈ 0.17 u/tick), i.e. a rise of ≤ 0.5 u under the piece gravity of 1/30 u/tick².
End of a piece. A moving piece counts its ticks and is deleted after 300. An inactive (resting) piece is deleted as soon as it is older than 32 ticks, which it almost always already is; only pieces made from a joint named 0xC3500000 stay where they came to rest. There is no fade: the alpha the draw computes for a piece that is being removed comes out as full.
Not followed: the consumer of its attack body, the two flag bits set by floats 1 and 3, the roll / touch / wall / float behaviours of the other class families, how a character uses the jump pad’s parameter, the kinesis pick-up of objects (0x140268ee0 → 0x14012e160), and which battle setting picks the placement list (11-14: the list rule itself is decoded, “test order, constraint table and rest”; what sets its selector byte is not).
Broken pieces: the start pose (docs 11-13, piecepose)
Where the eight points of a piece are when it
is made. Read in the executable (make pieces
0x1401e8960, joint matrices 0x1401fe9c0, joint
table 0x1401cb510, box 0x1401f7dd0, piece vtable
at rva 0x48c640) and computed from the Palace’s
stage file with
converter/piecebox.py (structs:
Esper-RE’s idxbuf_header as
IndexBuffer, Joint,
Armature; synthetic test
converter/tests/test_piecebox.py).
H = read in the code and
checked on st03’s data, M =
code only. Nothing here was checked against
footage.
Short answer. The start pose has nothing to do with the object’s stored point. A piece starts where its joint puts it in the pieces model: the object’s matrix, times the joint’s matrix from the model’s armature records, applied to a box taken from the joint’s first index buffer. The stored point is only the centre the launch direction is measured from.
Which joints become pieces (H). Make pieces goes through the joints of the pieces model that have at least one index buffer:
| Joint | What happens |
|---|---|
| parent below 0 (the root) | nothing: never a piece |
| parent = joint 0, name 0x4B085FC0 | the stump: stays, its matrix is copied to the object’s second joint table |
| parent = joint 0, any other name | a piece (name 0xC3500000: the piece that stays where it rests) |
| parent above 0 | never a piece. Its entry gets flag bits 0x12; if the top of its parent chain (the first joint whose parent is 0 or below) is a stump or the 0xC3500000 joint, the same entry of the second joint table gets the bits too. What draws it afterwards was not read (L) |
On st03 the joints of the 22 pieces models are 22 roots, 80 with parent 0 (10 of them stumps) and 44 deeper ones. Deeper joints mostly carry the shadow volume of their parent piece (model 36: one per piece); 11 carry drawn meshes (models 35, 47–52), one of them under a stump (model 35 joint 16).
The joint table (H).
0x1401cb510 builds, per model, one 0x40-byte
entry per joint: byte 0 the joint index, byte 1
flags, +0x08 the joint’s armature record,
+0x10 four slots for its index
buffers, +0x38 a flag word; a 4×4
matrix per joint follows the entries. A chunk of
type 2 (index buffer) is filed under the joint
named by the low byte of its
transform_idx (file offset 0x42),
in file order, at most four per joint.
The box (H). 0x1401f7dd0
reads aabb_min /
aabb_max (chunk offsets 0x18 /
0x24) of the joint’s first
index buffer only. Not the union of the joint’s
buffers, and not the vertices. These bounds are
in the joint’s own space. Per axis, with L = max
− min:
- |L| > 5: min += 0.15 · L, max −= 0.15 · L;
- |L| < 1: min = −0.5, max = +0.5 (the axis is re-centred on the joint’s origin);
- else unchanged.
The piece’s size (compared with 2200 and 800 by the collision step) is the product of the three L before this change. The eight points are numbered: 0 = (min, min, min), 1 = (max, min, min), 2 = (min, max, min), 3 = (min, min, max), 4 = (min, max, max), 5 = (max, min, max), 6 = (max, max, min), 7 = (max, max, max). The 28 rest lengths are measured here, in the joint’s space, and the piece also keeps 0.3 × their mean (+0xd8, use not read). Both position buffers of every point get the corner, the per-point slow counter is cleared.
On st03 the first buffer’s stored bounds equal the vertex bounds of everything drawn for the joint on most pieces (same size on 5 of deck section 1’s 6 pieces), but not on all: a joint whose first buffer is a small part gets a small box (deck section 1 joint 11: size 1,990 instead of 15,464, so it tests no edge midpoints; deck sections 0 and 3 joint 9: 5,757 instead of 39,087, joint 11: 92 instead of 17,465; deck section 2 joints 1 and 3).
The matrix (H). 0x1401fe9c0 returns one world matrix per joint of the object’s current model, and make pieces copies joint k’s into the joint entry and hands it to the piece:
- the object’s matrix: its position (object + 0x1e0) and its three angles (+0x1ec, already in angle units), i.e. the placement;
- per armature record, in file order: local = T(position) · Rz · Ry · Rx · S(scale), the angles taken as float radians × 5215.189 (= 32768 / 2π), truncated, looked up in the sine table (0x14054ca90, cosine 0x2000 entries on); world = parent’s world · local, with the object’s matrix for a parent below 0.
These are the model’s own armature records, with no animation and no inverse bind. So the pieces start in the pose the pieces model was built in, which is not the intact model’s pose: the Palace’s deck pieces of section 1 are stored as flat slabs and their joints turn them by 21°–45°. Corrected 11-13 (climb): the joints of sections 0, 2 and 3 are not turned, but their slabs are tilted all the same: the tilt is in the vertices (their boxes are the axis-aligned bounds of a tilted slab, 13–17 units thick against 5–7 for section 1). At the break tick every deck section is replaced by tilted slabs that fan out in a V; the reference footage shows exactly this on the first frame after the hit.
The piece’s “set from matrix” (vtable slot 9, 0x1401f8440) multiplies both position buffers of the eight points by this matrix and returns the box centre p0 + ½(p1 − p0) + ½(p2 − p0) + ½(p3 − p0).
Launch, previous position, first tick (H).
- Velocity is set by slot 10 (0x1401f87b0): previous = current − velocity for all eight points (the two buffers are a current / previous pair, their indices the bytes +0x40a / +0x40b, swapped every sub-step). Before it previous = current. No other write to the points before the first tick.
- The launch rule of “Breaking” uses the box centre returned by slot 9 as the piece’s position (not the joint’s origin) and the contact point it was given.
- No first-tick special case: the tick adds one to the age (+0x402) first and runs the stage collision when age > delay (+0x408). The delay is 0, or 8 when the object’s flag bit 2 (0x4) is set (slot 14). A piece of a support-lost object is made by the same routine and collides with the stage like any other.
- The joint’s float 0 (truncated to a byte) is passed to the piece’s init (slot 8, 0x1401f7060): non-zero makes the piece’s attack body (category 0x400). It is not a collision setting.
The stored point (M). The “object’s own stored point” of a support loss and of the faller crumble’s break is filled by 0x1401e81b0 → 0x1401fc4b0: the centre of the union of the stored bounds of all index buffers of the object’s current model, taken as they are (no joint matrices), put through the object’s matrix. It is not the placement origin. When it is refreshed (four places in 0x1401e5e20) was not followed, so whether a support loss measures from the intact model’s centre or the pieces model’s is open. With no impulse it only turns the ≤ 0.44 u/tick jitter launch.
Palace deck section 1 (placement 1, class 2 / 23, pieces model 36; placement at the origin, unrotated), start pose computed from the stage file:
| Joint | Size | Box centre | y of the corners | Tilt | Corners behind stage faces |
|---|---|---|---|---|---|
| 1 | 7,116 | (69.6, 104.5, −28.3) | 94.2–114.8 | 33° | 0 |
| 3 | 9,170 | (36.1, 104.8, −54.2) | 95.3–114.2 | 45° | 1 (attribute 31, 1.35 deep) |
| 5 | 8,926 | (41.9, 104.8, −73.7) | 96.8–112.8 | 21° | 2 (attributes 10 and 31, 0.73 deep) |
| 7 | 2,539 | (32.6, 103.2, −22.7) | 96.5–109.9 | 35° | 0 |
| 9 | 4,759 | (49.5, 104.1, −41.3) | 94.9–113.3 | 39° | 0 |
| 11 | 1,990 | (93.2, 110.0, −68.6) | 104.8–115.3 | 24° | 0 |
“Behind” is the piece step’s own test (behind the plane by less than 2, projection inside the triangle, attribute not 16, 17, 18 or 20) against the stage collision list. So in the game’s own start pose the joint 5 piece starts with two corners inside the tree’s faces, the same two faces and depths as in the rebuild’s pose (the two poses are the same box for this joint). Running the decoded step on the game’s pose (a line-by-line port, jitter launch from the box centre) lifts that piece’s centre by 36 units (its highest corner by 43) before it falls; with the stage collision off it does not rise. The joint 3 piece rises 3 units. Railing 167 (model 56, joint 1): four corners behind attribute 8 faces, up to 1.99 deep, rise 5–8 units. The rise is the decoded behaviour for the decoded start pose (H for the pose; the height itself depends on the parts of the step that are still open: the per-model gravity factor, the sphere pass and the second acceleration). Corrected 11-13 (climb): a 36–44 unit climb is not what the game shows; see the re-check below. The pose and the push-out stand, the height does not.
Implementation notes for the rebuild
- Piece joints: only joints whose parent is
joint 0 and that are not stumps. Do not make
pieces from deeper joints (st03:
model_35_j16,model_47_j4/5/6,model_48…50_j2,model_51_j2/j4,model_52_j2/j4fly as pieces today).model_35_j16hangs under the stump and stays with it; what the game draws for the others is not decoded (keep them with their parent piece until it is, and list that in PLACEHOLDERS.md). - Box: the stored
aabb_min/aabb_maxof the joint’s first index buffer (file order), not the vertex bounds of the joint’s whole node. The converter has to export it per joint (objects.json or a node extra);piecebox.pyshows the read. - Matrix: placement × the joint chain from the
armature records (what
pd_bindalready is); keep it. Rest lengths from the box in the joint’s space. - Launch position: the box centre in the
world, not the joint’s origin
(
xf.origintoday, which for the Palace decks is far from the piece). - Stored point: the centre of the model’s
index buffer bounds through the placement
matrix, not
placement.origin. - previous = current − velocity and collision from the first tick are already right. Do not add a start correction: a piece that starts inside stage faces is pushed out by the step, as in the game.
Built (collapse round 4).
stageobj.py writes
objects.json version
3: per joint box =
[aabb_min, aabb_max] of its first
index buffer (game axes, the joint’s space; null
when the joint has none) and meshes
= its buffer count (at most four); per state
bounds = the union of all its
model’s buffer bounds (model space, no joint
matrices), whose centre through the placement is
the stored point. Same reader as
piecebox.py
(IndexBuffer now lives in
stageobj.py). The rebuild mirrors Z
for both (game → its own axes). Checked on st03
with
godot/tests/test_piece_pose.gd:
deck section 1 makes the six pieces of the table
above, with the sizes and box centres given
there (within 0.05 u).
Broken pieces: the Palace climb re-check (docs 11-13, climb)
Why this exists: the rebuild’s deck section 1 sends one slab 36–44 units up the tree. The playtester’s Rebirth footage (private recording, all four pillars) shows no slab on or above the tree; every slab is on the floor and at rest within about 2 s of the hit. The chain of “the start pose” was read again in the executable and run again on the stage file. H = read in the code and checked on st03, M = code only, L = from footage or a guess.
What was re-checked and holds (H).
- Pose, joints, box: as “the start pose” says. The inset constants are 5.0, 0.15 and ±0.5 (0x1402f7f18, 0x1402f7cf0); the box comes from the first index buffer when the piece has a joint entry, and from the union of all buffers only when it has none.
- No first-tick skip for a crumble piece, collision from tick 1 (delay 0 or 8).
- The push-out (0x1401f7870) uses the normal stored in the triangle record (the 20-byte record: 3 × u16 corner, u16 pad, f32[3] normal), not the corner order. On st03 all 2,723 stored normals equal (b − a) × (c − a), so nothing changes.
- Attribute filter: only 16, 17, 18 and 20 are passed over. The tree’s attributes 10 and 31 are tested. There is no test of the direction of motion and no mask on the piece.
The pieces’ triangle grid (H; new). Built once per stage from the arena’s shape list (header slot 0x94) by 0x1401d2c20 (setup) and 0x1401d3040 (fill):
- origin = the lowest x, y, z of all vertex records; cell 30 × 20 × 30 units; counts = int(extent / cell) + 1 per axis (st03: origin (−220.7, −0.1, −304.3), 15 × 14 × 21);
- only mesh records whose flag byte has bits 0 and 1 both set are entered (st03: all of them, flags 3). Bit 0 alone or bit 1 alone gives a side value of 2 or 1 and the cell-add routine (0x1401d29b0) returns at once for those;
- a triangle is entered in every cell of its bounds (grown by 0.5) whose box (grown by 0.5) it overlaps (0x1401d65a0); a cell keeps one record per attribute, each with its triangles;
- a corner tests only the triangles of its own cell (index truncated, not floored); a corner outside the grid tests nothing. Edge midpoints and face centres look up their own cell.
A port with this grid gives the same result for deck section 1 as the earlier port with a looser grid: the grid is not the cause.
Not for the deck: a start spin (M; new). Piece vtable slot 11 (0x1401f8960) stores a vector at piece + 0x78 and arms a 3-count (+0x84 / +0x85). While armed (the first four sub-steps) 0x1401f8850 adds p × w to every point, p being the point’s previous position in stage coordinates. Only the roll family’s piece routines (0x1401ec909, 0x1401ece92) and one base routine (0x1401fc95a) use it, with three pseudo-random components from the same byte hash as the jitter launch (scale not read). The crumble family (the Palace decks, class 2 / 23) never uses it: a deck slab gets no angular start, no pivot and no per-piece gravity. Its tumble is what eight free points with distance constraints do when single corners are stopped by the floor.
The support-loss launch is
impulse-free (H). Class 2 / 23
(Rep23): break = 0x1401e85b0,
support lost = 0x1401e83c0, make pieces =
0x1401e9440 (stored point, zero impulse), no
fall slot. The V in the footage is the pieces
model’s own pose, not a launch.
A different class has a two-stage
fall (M; new, not on the Palace). The
component ACrmFT (vtable rva
0x47e388; built by 0x1401daf10): its break
(0x1401e9450) only starts a counter and spawns
the state’s kind 3 effects; its fall slot 28
(0x1401e9550) then lowers the object by 5 / N
units per tick for N ticks (N = the word at
component − 0xe, source not read) and after that
does the real break: collision off, kind 2
effects, dependants released, break sphere,
sound, pieces with zero impulse. Its support
lost is the plain 0x1401e83c0. Which table /
class number uses it was not looked up.
What the footage shows (L). Wider frames of the pillar with the tree behind (hit 386.4 s): the slabs are in the V on the first frame after the hit, hang for about 0.3 s, and reach the floor about 1.0–1.1 s after the hit (pillar 1 the same). Several pieces are thrown up and sideways: some are a few units above deck level 0.5–0.9 s after the hit and one large piece is still in the air 1.5 s after it, leaving the frame toward the camera side. So a pop exists in the game, but a small one; nothing rises tens of units or stays on the tree. Which of the flying pieces are deck slabs and which are the pillar’s own (those take the shot’s impulse) cannot be told from this angle.
Timing (M code, L factor). Gravity 0.5 / 30 per sub-step, two sub-steps per tick, 30 ticks per second = 60 units/s². The deck (y ≈ 104) is 52 units above the floor (y ≈ 52): 1.32 s of free fall at factor 1. The footage’s 1.0–1.1 s would be a factor of about 1.5–1.9. The port run on the climbing slab (joint 5):
| Gravity factor | Rise of the centre | Below y = 60 after | Lands |
|---|---|---|---|
| 1.0 | 31–33 | 5.0 s (it rides the tree) | 250 units away |
| 1.5 | 19 | 1.9 s | 190 units away |
| 2.0 | 14 | 1.5 s | 150 units away |
| 3.0 | 13 | 1.2 s | at the deck |
The climb comes from the first sub-step: one corner, three edge midpoints and two face centres of that slab lie 0.2–1.9 units behind faces of attributes 10 and 31 whose normals point up and toward +z; putting them on the planes moves the slab’s centre 0.7 units in one sub-step, and a Verlet point keeps that as speed (about 1 unit per sub-step, 60 units/s). The rise is then speed² / 2g, so it scales with 1 / factor.
Conclusion. No error was found in the pose, the box or the push-out; the tree faces are tested. What “the start pose” got wrong is its last step: it took the 36–44 unit height as the game’s behaviour while the gravity factor was still a placeholder 1.0. The best lead for the difference was that factor. Corrected 11-13 (climb 2): that lead is refuted. The record is decoded (“The launch / gravity factor record” below): the Palace deck sections and railings have none, so both factors are 1.0 for them, and the gravity factor is 1.0 in every record of the game. The table above for factors 1.5–3 describes nothing the game does. The difference between the port (31–33 unit rise, 5 s) and the footage (small pop, floor within ~2 s) is not explained by any decoded value. Corrected 11-13 (climb 3): the 31–33 unit figure itself came from an arbitrary launch vector and no collision delay. With the game’s own 8-tick delay and launch jitter the result for this slab ranges from 1 to 73 units depending on the object’s index; see “Broken pieces: the object pass, delay and jitter” below.
Implementation notes for the rebuild
- Keep the decoded pose, box and push-out. Do not add a start correction and do not filter attributes 10 / 31.
- Do not treat the 36–44 unit climb as
verified behaviour: the test that expects it
(
test_collapse_rise) should expect a pop, not a height. A piece that is still above its start height 2 s after the break does not match the footage; the cause is open. - Gravity and launch factors: read them per object from the type 31 effect record (next section). For the Palace decks both are 1.0, decoded. Do not tune from footage.
- Piece grid, if the build wants the game’s exact cells: 30 × 20 × 30 from the lowest vertex, triangles entered by the grown-box overlap, flags bits 0 and 1 both set, lookup by truncation, nothing outside the grid. On st03 it changes no result.
- Roll-family pieces (classes 1, 2, 4, 17) get the four-sub-step spin; crumble pieces get none. (Scale of the spin vector still to be read.)
- Deck sections of the other three Palace placements also start as tilted slabs; that is the model, keep it.
Broken pieces: the object pass, delay and jitter; the Palace map (docs 11-13, climb 3)
The object pass (“sphere pass”,
H). Inside the corner loop of the stage
collision (0x1401f8cd0), after a corner’s grid
triangles, 0x1401d3a10 walks a global list
(0x1405302f0) of collision groups. For every
shape record of type 3 (a mesh) in a group whose
bounding sphere (centre, radius of the mesh
record) contains the corner, it calls the
piece’s callback (0x1401f8b40, the
pdStageColCallback part of the
piece at +0x48). The callback runs the ordinary
corner test (0x1401f7870: behind by less than 2,
projection inside → onto the plane, minus half
the x / z velocity) on every triangle of that
mesh whose stored normal has y >
0, and sets a “touched an object” byte
(+0x40d) on a hit.
- Who is in the list. An object’s current-state collision group, while the object’s class flags (base + 0x50) have bit 0, bit 2 or 0x1000000 (0x1401fbdb7; taken out again by 0x1401fbf40). Bit 2 is the faller flag: on the Palace that is the four deck sections (class 2/23). Pillars (class 2/28) are not in it and have no up-facing triangle anyway.
- What it is not. No sphere shapes, no piece against piece, no clamp of speed or position, no time limit. Only corners; the edge-midpoint and face-centre passes do not use it. It does not bound the pop: it adds floors (a slab can land on a neighbouring intact section, or be pushed by it).
- Skipped for a piece with flag 0x8 = the object’s class flag 0x80 (0x1401e8dae). The deck classes do not have it. (11-14: only class 2/17 has it; class list in “test order, constraint table and rest”.)
- Sleep. A piece whose eight points rest goes inactive only if the touched byte is clear (0x1401fa567). Corrected 11-14 (collapse 6): “stays awake, so it falls when that object breaks” was wrong. The touched byte only keeps the active flag; the piece is deleted at rest all the same and never moves again. See “Broken pieces: test order, constraint table and rest”.
Lifetime, settle, fade (H; re-read, agrees with “End of a piece” above). A point rests after more than 16 slow sub-steps (speed² < 0.005, counter never reset). When all eight rest, an ordinary piece (flag 1; every joint except the ones named 0xC3500000) is deleted at once if it is older than 32 ticks, else at tick 33. A piece that keeps moving is deleted after 300 ticks (10 s); one below the height limit or 800 units out at once. The draw’s fade byte (+0x404) is never counted up, so there is no fade. So “at rest” in footage means “gone”: a slab that settles anywhere, also on the tree, disappears.
Collision delay (H). Slot 14
sets the delay to 8 for objects with class flag
bit 2 (0x1401e930a). The deck class gets that
bit from its floor component’s constructor
(0x1401dd4b0, called by the class 2/23
constructor 0x1401dda80). So deck slabs
skip the stage collision and the object pass for
their first 8 ticks (16 sub-steps, 2.3
units of free fall); constraints still run.
This corrects “the start pose” and the
build’s COLL_DELAY := 0 comment,
which say the bit is not set on the Palace
objects.
Launch jitter, exact inputs (H code, M for the index). With a near-zero impulse (support lost: always) the routine first scales the impulse (× 0.5 × F) and then adds one jitter value per component: value(a) = h(a) × 0.2 / 256 − 0.1, h(a) = low byte of a × 33 + 33 + (a >> 1), a = low byte of (object index + counter). The counter starts at 0 for each break and the three components use counter, counter + 1, counter + 2, but it advances by 2 per piece that takes the jitter (the z of one piece and the x of the next share a value; 11-14: the advance is inside the L² < 0.1 branch, and L is the break’s impulse, the same for every piece of a break, so it is all pieces or none). The object index is the word at object + 0x48, given at creation (0x14020416f): the running number of the placement in the order the setup creates objects. For the first placement list that is the placement number (deck sections 0–3, pillars 4–7). 11-14 (collapse 6): H now. Only one placement list is created per battle and the counter starts at 0 and counts every placement of it, created or not (see “test order, constraint table and rest”); the deck sections exist only in st03’s list 0, as placements 0–3.
Deck sections recomputed (port: exact grid, delay 8, the jitter above, object pass against the still-intact sections; index = placement number). “Floor” = centre below y = 60; “gone” = deleted at rest.
| Section | Slabs | Rise | Floor | Gone |
|---|---|---|---|---|
| 0 (x ≈ 147), others intact | 7 | 0–0.1 | 1.07–1.30 s | 1.9–2.6 s (one 3.4 s) |
| 3 (x ≈ −147), others intact | 7 | 0–0.2 | 1.07–1.37 s (one 2.7 s) | 1.9–3.0 s (one 4.2 s) |
| 1 (x ≈ 57), section 0 already broken | 6 | joint 5: 10.4; others 0 | 1.13–1.97 s; joint 5 3.5 s; joint 9 settles at y 64 | 1.8–6.6 s |
| 1, section 0 still intact | 6 | joint 5: 31.6 (settles on section 0 at y 113); joint 11: 10.7 | up to 9.4 s | |
| 2 (x ≈ −71), others intact | 4 | 0–0.1 | two slabs settle at deck height (y 105–111) inside 1 s and are deleted; the others 4 s or settle at y 64 | 1.1–5.2 s |
- The end sections behave like the footage’s numbers (floor after ~1.1–1.3 s, gone by ~2 s). The two middle sections, which have the tree behind them, do not come out clean in the port: slabs slide on or settle in the tree faces for 3–6 s.
- Joint 5 of section 1 is chaotic in the jitter: object index 0 → 31, 1 → 10, 2 → 1, 3 → 42, 4 → 73, 5 → 66, 6 → 47, 7 → 28 units of rise; over a 3 × 3 × 3 sweep of the jitter range 0 to 107 (median 41). The earlier “31–33 / 36–44 units” came from a made-up launch vector and delay 0; it was never a property of the game. With the decoded inputs the port says a 10 unit pop and 3.5 s, still longer than the footage’s ~2 s, and that depends on the index being 1. Corrected 11-14 (collapse 6): this port still had two errors (constraint table, triangle order inside a cell), and this table’s numbers for sections 1 and 2 are replaced by the table in the next section.
The Palace deck row, top-down (H from st03). Game space, y up; looking along −z (from the open floor toward the tree) +x is on the left of the screen (left-handed space; the converter flips z for Godot).
| Placement | What | x | z | y |
|---|---|---|---|---|
| 0 | deck section 0 (definition 0) | centre 147, mesh radius 81 | −50 | 100–109 |
| 1 | deck section 1 (definition 1) | centre 57, mesh radius 48 | −50 | 100–109 |
| 2 | deck section 2 (definition 2) | centre −71, mesh radius 45 | −50 | 100–109 |
| 3 | deck section 3 (definition 0 turned half round) | centre −147, mesh radius 81 | −50 | 100–109 |
| 4 / 5 / 6 / 7 | pillars under sections 0 / 1 / 2 / 3 | 140 / 50 / −50 / −140 | −50 | 50–100 |
The tree (attributes 10 and 31) stands behind the row, on the −z side: attribute 10 spans x −112..67, z −259..−31, y up to 279 (mean x −28, z −138); above deck height its nearest faces are at z −57 to −80 for x between −80 and 80. Attribute 31 above deck height is almost all at x 0..80, z −40..−168 (up to y 235): the big limb behind section 1. Sections 0 and 3 have no tree face near them at deck height. So from the floor in front, left to right: pillar 4 (clear), pillar 5 (tree limb right behind), pillar 6 (trunk behind), pillar 7 (clear).
Footage match (M). In private recording 2 the four hits go left to right on screen with the camera looking at the tree (frames before each hit looked at, none published). With +x on the left: hit 1 (370.3 s) = pillar 4 / section 0, hit 2 (386.4 s) = pillar 5 / section 1, hit 3 (410.0 s) = pillar 6 / section 2, hit 4 (418.2 s) = pillar 7 / section 3. The left / right assignment rests on the handedness argument only; if it were mirrored, hit 2 would be section 2. Either way hits 2 and 3 are the two tree sections.
Measured in the rebuild (collapse
round 5, 11-14; H for the build, L for the
footage). The three causes built
(delay, jitter, object pass with the mesh
records’ stored bounding spheres, collision.json
sphere), the Palace pillars shot by
the Player in the footage’s order (each section
after the previous one’s pieces are gone;
test_deck_sections.gd):
| Section | Rise of each slab (u) | On the floor (s) | Gone (s) | Footage |
|---|---|---|---|---|
| 0, others intact | 0–0.1 | 1.07–1.30 | 1.9–3.3 | floor ~1.1 s, at rest ~2 s |
| 1, section 0 broken | one slab 25.6, others ≤ 0.03 | 1.13–4.53 (one stays at y 64) | 1.8–5.7 | small pop, at rest ~2 s |
| 1, others intact | 26.4 and 60.7 (one settles on section 0) | 1.13–5.3 | 1.8–10.0 | — |
| 2, sections 0 and 1 broken | ≤ 0.06 | one at 2.6; two rest on intact section 3 at y 105–111 (deleted at 0.87 / 1.0 s since round 6; round 5: 10.0), one at y 61 | 0.87–5.3 | side-on private recording 9: floor ~1.1 s |
| 3, others broken | 0–0.2 | 1.07–1.37 | 1.9–3.1 | floor ~1.1 s, at rest ~2 s |
Superseded 11-14 (collapse round 6): the tree-section numbers of this table came from the build’s flipped point numbering, all-pairs constraints and file-order cells; see “Measured in the rebuild, round 6” at the end of “test order, constraint table and rest”.
Object-pass pop of a prop (round 5 build, INFERRED / unverified). With the object pass, st03 object 170 (class 2/18, a prop lying on deck section 3) rises 14.4 units when its section breaks; with the pass off it rises 0.06. Its pieces slip under the intact section’s top within the 2 unit band and are pushed up. Built as decoded; whether the game passes class 2/18 pieces this way and whether a rise that large comes out of the 2 unit band is not decoded or checked against footage. Collapse 6: class 2/18 has no class flag, so its pieces do take the pass (H); round 6 (collapse-6 decode built) measures 14.0 units; the height is still not checked.
Implementation notes for the rebuild
- Collision delay: 8 ticks for pieces of
objects with class flag bit 2 (classes 2/22,
2/23, 2/26), else 0.
COLL_DELAY := 0is wrong for the Palace decks. - Launch jitter: add it to the scaled impulse (do not replace the impulse before scaling); advance the counter by 2 per jittered piece with components at +0, +1, +2; seed with the object’s creation index (placement number in the played list).
- Object pass: after a corner’s grid triangles, test it against the up-facing triangles of the state-0 collision meshes of intact objects with class flag bit 0 or 2, when the corner is inside the mesh’s bounding sphere; a hit keeps the piece active at rest, but it does not move again and is deleted by the age rule like any resting piece (round 6).
- Delete a resting piece at once (age > 32); no fade. Already decoded; listed here because it is what the footage’s “at rest” shows.
test_collapse_rise: with 1–3 in place, expect for section 1 a pop of about 10 units for joint 5 and nothing else rising; the end sections must be on the floor inside 1.4 s and gone by about 3 s. Do not assert the old 36–44 units.- The second acceleration never applies on the Palace (stage value ending in 5 only).
Broken pieces: test order, constraint table and rest (docs 11-14, collapse 6)
Why this exists: the build (collapse round 5) lifts one slab of Palace deck section 1 by 25.6 units, the port of climb 3 by 10.4, with the same index and rules. Both were run from the same start, and the tick and the routines under it were read again. H = read in the code and checked on st03 or on the build, M = code only, L = footage or a guess.
Which side was wrong: both.
- The build numbers the eight points
with the z bit flipped. Its box
is in the converter’s mirrored space (z’ = −z),
and it numbers the corners by (x, y, z’) where
the game numbers them by (x, y, z). Build point
0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 is game point 3 /
5 / 4 / 0 / 2 / 1 / 7 / 6. The shape is the
same, but the corners, edge midpoints and face
centres are tested, and the constraints applied,
in another order, and each test moves points
that the next test reads. Checked
(H): the build’s own
Piece/PieceCollisioncode, run alone on the game’s start pose, gives 10.38 units with the game’s numbering and 25.64 with the flipped one, the build’s 25.63. The two runs are equal to the last digit through tick 8 and differ from tick 9, the first collision tick (2.3 units between the two after that one tick). - The port (and the build) had two more errors, below: the constraint table and the order of the triangles inside a grid cell. With both corrected the port says 38 units for that slab, not 10.
The 28 constraints are a table, not all pairs (H). The box routine (0x1401f7dd0) copies 28 byte pairs from 0x1403eebd0 into the piece (+0x248, 8 bytes per entry: point a, point b, rest length at +4) and measures each rest length; +0xd8 is 0.3 × their mean. The constraint pass (0x1401f9590, piece vtable slot 7, called twice per sub-step) goes through them in this order:
| Entries | Pairs | What |
|---|---|---|
| 0–11 | 0-1, 0-2, 0-3, 7-6, 7-5, 7-4, 6-2, 6-1, 3-5, 3-4, 1-5, 2-4 | the 12 edges |
| 12–15 | 0-7, 1-4, 6-3, 2-5 | the 4 body diagonals |
| 16–21 | 2-1, 6-5, 7-3, 4-0, 4-6, 0-5 | one diagonal of each face |
| 22–27 | 2-1, 6-5, 7-3, 4-0, 4-6, 0-5 | the same six again |
The other diagonal of each face (0-6, 2-7, 1-7, 2-3, 1-3, 4-5) has no constraint. Per entry: d = a − b; when |d| < 0.00001 the points’ stored velocities are used to get a direction (a’s is added, then b’s subtracted, each only while the length is still below the limit); a −= d̂ · ½(|d| − rest), b += the same.
Order of the tests inside the collision step (H). 0x1401f8cd0 (slot 6) clears the touched byte, then:
- corners 0 to 7 in the game’s numbering; per corner first its grid cell, then the object pass (unless piece flag 0x8);
- size > 2200: the 12 edge midpoints in the order of the table at 0x1403e1178;
- size > 800: the 6 face centres in the order of the table at 0x1403e0f48.
Midpoints and centres: the cell is looked up once from the mean of the points, but the mean is taken again before each triangle (0x1401f7570, 0x1401f7280), so an earlier triangle’s push is seen by the next one.
Order of the triangles inside a cell (H for the lists, M for the fill order). The grid’s add routines (0x1401d29b0 for the attribute record, 0x1401d28b0 for the vertex set and the triangle) put every new entry at the head of its list. The fill (0x1401d3040) goes through the shape records, their triangles and the cells in ascending order. So a cell is read back as: attribute records in the reverse order of their first triangle in that cell; inside an attribute the vertex sets in the reverse order of their first; inside a vertex set the triangles in reverse file order. Climb’s port and the build test in file order. Run on deck section 1’s slab (index 1): file order 11.9 units, the game’s order 38.1 (grouping by attribute alone changes nothing there; the reversal does).
Rest ends a piece, touched or not (H). The rest test comes first in each sub-step, before the points move. When all eight points rest (0x1401fa567):
- touched byte clear → the active flag (+0x40c) is cleared; touched byte set → it stays;
- then, in the second sub-step of the tick, in both cases: an ordinary piece (flag 1) or one past 300 move ticks gets flag 4 and age + 1, and is deleted once its age is above 32;
- the sub-step ends there. The slow counters are never reset, so the test is true in every later sub-step: a resting piece never moves again, active or not.
So a slab that comes to rest on an intact deck section is deleted like one on the floor: at once when it is older than 32 ticks, else at tick 33 or a few ticks earlier (while it is active its age counts twice per tick). It does not wait for the 300-tick limit and it does not fall when the section under it breaks. The only pieces that outlive their rest are the joints named 0xC3500000, and they stay frozen where they rested. The touched byte changes nothing that can be seen. Wrong before: climb 3’s “stays awake, so it falls when that object breaks”, and the build’s rule made from it (a touched piece is never at rest, so it lives to 300 ticks). Climb 3’s port was right here.
Class flags (H for bits 0, 2 and 0x80; table 2 is the class table at 0x1403ee870).
| Bit of base + 0x50 | Set by | Classes | Effect on pieces |
|---|---|---|---|
| 0 | 0x1401e0cf0 | 2/12, 2/13 (on no versus stage) | the intact object is a floor of the object pass |
| 2 | 0x1401dd4b0 | 2/22, 2/23, 2/26, 2/42, 2/43 (the last two on no versus stage) | floor of the object pass; its own pieces wait 8 ticks |
| 0x80 | 0x1401dd1b0 | 2/17 only (st03 × 3) | its own pieces skip the object pass |
| 0x1000000 | not found: no class constructor writes it as a constant | floor of the object pass (L: who sets it was not followed) |
A class 2/18 prop (st03 object 170, lying on deck section 3) has none of these bits: it is not a floor, its pieces have no delay, and its pieces are tested against the intact deck sections like every piece except class 2/17’s. That the build’s pass moves them is the decoded rule; the height it gives them (14.4 units) is subject to the numbering and order errors above and was not recomputed.
Which placement list, and the object index (H). The stage setup (0x140203747) takes one list only: list L + 1 of the stage file’s eleven list slots (offsets at header 0x04
- 4 i, counts at 0x30 + 4 i), L being the byte at 0x140531dcf; when that slot is empty, list 0. The second list slot of the object table is always cleared. The creation loop (0x14020406a) starts its index at 0 and adds one per placement, also for one it does not create; that index is the word at object + 0x48 and the object table slot. st03 has lists 0 and 2 only and the deck sections and pillars are in list 0 only (placements 0–3 and 4–7), so a deck section’s jitter index is its placement number. Who sets the selector byte (five writers, 0x140128990, 0x140128fc0, 0x140187650, 0x140192780) was not followed.
The jitter counter (H). It
advances by 2 only inside the L² < 0.1 branch
(0x1401e8f79), L² being the break’s impulse, so
within one break either every piece advances it
or none does. The build’s
_make_pieces is right. On stages
whose stage value ends in 5 the
second-acceleration block (0x1401e9145) uses the
same hash and advances the same counter by 2
more per piece (M; never on the
Palace).
Deck sections recomputed (port with the table, the cell order, the game’s numbering; double precision, not the build). Broken in the footage’s order.
| Section | Slabs | Rise | Floor | Gone |
|---|---|---|---|---|
| 0 (index 0, others intact) | 7 | 0–0.1 | 1.07–1.30 s | 1.9–2.6 s (one 3.6 s) |
| 1 (index 1, section 0 broken) | 6 | joint 5: 38.1; others 0 | 1.13–1.77 s; joint 5 never (comes down at deck height near (165, 102, 14)); joint 9 rests at y 64; joint 7 falls out of the stage | 1.7–3.4 s; joint 5 7.3 s |
| 2 (index 2, section 3 intact) | 4 | 0–0.1 | two slabs rest on section 3 (y 105–111) inside 1 s and are deleted at rest; the others 2.1 s and 4.7 s | 1.1–5.4 s |
| 3 (index 3, others broken) | 7 | 0–0.2 | 1.07–1.37 s | 1.9–2.1 s (one 3.5 s) |
- Joint 5’s rise by index 0–15: 20, 38, 0, 56, 45, 51, 46, 51, 31, 6, 0, 62, 64, 47, 45, 21 units. For index 1 it is stable against start changes up to 0.001 units (37.4–38.1), so single-precision rounding is unlikely to change it, but that was not run in single precision.
- Against the footage (L): not settled. The decoded rules, with the decoded index, throw this one slab up about 38 units and toward +x / +z (the open floor, the camera side in private recording 2). The footage notes say pieces go “a few units above deck level … nothing rises tens of units or stays on the tree”, and also “one large piece still in the air 1.5 s after the hit, leaving toward the camera side”. A piece that only falls is on the floor after 1.3 s, so the footage does show one piece thrown up; whether by 38 units cannot be read from that angle. Nothing was tuned. Still not ported exactly: the order of the object pass’s own lists (a new group goes to the head of the global list, 0x1401fbdd0), single precision, and the near-zero branch of the constraint.
Implementation notes for the rebuild
- Number the eight points in the game’s axes: the z bit of a corner is set for the game’s larger z, which is the smaller z in the mirrored space. Everything indexed by point (corner loop, the edge and face tables, the constraint table, “point 0” of the bounds test, the drawn matrix from points 0–3) uses that numbering. The drawn matrix then needs the z edge negated.
- Constraints: the 28-entry table above, in that order, twice per sub-step; rest lengths per entry. Not all pairs.
- Triangles of a cell: reverse order of insertion at all three levels (attribute, vertex set, triangle), insertion in file order. With a lookup grid that is not the game’s, at least keep the per-attribute grouping and the reverse file order; for 1:1 use the game’s grid (30 × 20 × 30 cells, “the Palace climb re-check”), since a corner only sees the triangles filed in its own cell.
- Rest: when all eight points rest, stop moving the piece for good, whether or not it touched an object floor; delete an ordinary piece once its age is above 32 (age + 1 per tick at rest; + 2 while touched). Remove the “touched pieces stay awake” rule.
- Object pass floors: classes 2/12, 2/13 (bit 0) and 2/22, 2/23, 2/26, 2/42, 2/43 (bit 2). Pieces of class 2/17 skip the pass. Every other piece takes it, also those of props without any flag (class 2/18).
- Jitter: keep the build’s counter (advance inside the low-impulse branch). The index is the placement number in the one list that is created: decoded, no longer a guess.
- Tests: do not assert a height for deck section 1’s slab from any earlier table. With 1–4 in, the build should reproduce this section’s table (38 units for joint 5 at index 1 is the port’s value, to be confirmed by the build in single precision); the end sections must not change.
Measured in the rebuild, round 6
(collapse round 6, 11-14; H for the
build). Notes 1–6 above built (game
point numbering, the 28-entry table, the game’s
grid read back to front, rest ends a piece
touched or not, the pass classes, the jitter
counter) and collision.json flags /
vset per mesh (collconv); single
precision, Godot. Footage order,
test_deck_sections.gd:
| Section | Rise | Floor | Gone | Port above |
|---|---|---|---|---|
| 0 | 0–0.1 | 1.07–1.30 s | 1.9–2.57 s, one 3.57 | 1.9–2.6, one 3.6 |
| 1 | joint 5: 36.6; others ≤ 0.03 | 1.13–1.77 s; joint 5 never (ends at y 111); joint 9 rests at y 64; joint 7 out of the stage | 1.73–3.33 s; joint 5 6.23 s | 38.1; joint 5 7.3 s |
| 2 | ≤ 0.06 | two rest on section 3, deleted at 0.87 / 1.0 s; the others 2.1 s and 4.7 s | 0.87–5.4 s | the same |
| 3 | 0–0.2 | 1.07–1.37 s | 1.9–2.13 s, one 3.57 | 1.9–2.1, one 3.5 |
The build reproduces the port’s table; joint 5 differs by 1.5 units and 1.1 s (single against double precision, and the object pass list’s order after breaks, neither ported exactly). Collapse r7 (playtester 11-14): shipped as a known gap. The full private recording 2 note says the pieces are thrown “a few units above deck level”, one large piece is still in the air 1.5 s after the hit, and “nothing rises tens of units or stays on the tree” (slabs and pillar pieces cannot be told apart from that angle; that the pillar is section 1 is likely, not proven). Joint 5’s 36.6 unit throw and the slab left at deck height contradict that note, so the decode is still missing a cause. Built as decoded, nothing tuned (PLACEHOLDERS “Palace deck section 1 high throw”, INFERRED / gap).
The launch / gravity factor record (docs 11-13, climb 2)
What it is (H). The two
factors of the piece launch are an
effect record of type 31 (0x1F)
in the object definition’s own effect list for
state 0 (OB00 effects[0], an
EF00 list of 92-byte records). The
stage setup hands each object its three effect
lists (0x140204230: virtual slot 37 with the
state number and the list). The break
component’s version of that slot
(pdStageObjABrk, 0x1401da160; the
component is the second virtual base of every
crumble / roll class) does one extra thing for
state 0: it walks the list’s records and keeps a
pointer to the first one whose type byte is 31,
or null. Every class constructor starts that
pointer as null.
| Record offset | Struct field (EffectEntry) |
Meaning |
|---|---|---|
| +0x00 | type = 31 |
marks the record; the effect spawner has no constructor for it |
| +0x34 | params[0] |
launch factor: the launch impulse × this, before the 1.5 length cap |
| +0x38 | params[1] |
gravity factor: piece gravity = (0, −0.5, 0) × this |
| rest | zero in every record; nothing reads it |
No record: the impulse is not scaled and the gravity setter is not used, so the piece keeps the gravity its constructor gave it (0x1401f7c07: the same vector (0, −0.5, 0) for both the gravity and the second acceleration). There is no other per-object physics value in the record: all eight readers (crumble 0x1401e8b18; 0x1401e9fac, 0x1401ea562, 0x1401edead; roll family 0x1401ec909, 0x1401ecbf3, 0x1401ece92, 0x1401ed172) take only +0x34 and +0x38. Damping, the half-speed push-out, the rest counter and the bounds are the same constants for every piece.
Values in the files (H, 29 of the 30
stage layouts read; st00 has another header and
was skipped; read with
stageobj.py’s structs). 21
records in 7 stages; the gravity factor is
1.0 in every one:
| Stages | Definitions | Classes | Launch | Gravity |
|---|---|---|---|---|
| st03, st13, st23 (Palace and its variants) | 11 (12 placements, the small props at y = 50 around (±100, 50, 10 / −110)) | 2/3 | 0.5 | 1.0 |
| st04, st14 | 36–41 | 2/1 | 2.0 | 1.0 |
| st24 | 15–20 | 2/1 | 2.0 | 1.0 |
The Palace. Deck sections (definitions 0–2, class 2/23), pillars (3, class 2/28) and railings (definition 24, model 56) have no type 31 record: launch 1.0, gravity 1.0. Only definition 11 has one (launch halved).
Deck 1 recomputed (port, factor 1.0 decoded). Same as before: joint 5 rises 31–33 units (corner 38), stays above y = 60 for 5.0 s and lands about 250 units away; joint 3 rises 1.4, the other four slabs do not rise; a slab that is not pushed reaches the floor in 1.32 s. The footage (small pop, ~1.0–1.1 s fall, everything at rest on the floor within ~2 s) still disagrees, by 3–5 frames of 15 fps footage on the fall and by tens of units on the rise. The per-object factor cannot be the reason. Re-read while here, no change: two sub-steps per tick, gravity × 1/30 per sub-step, the second acceleration replaces gravity only with flag 0x10 after tick 30, a piece is removed when its first point is below the height limit or more than 800 units out.
Implementation notes for the rebuild
objects.jsonalready carries the record: a state-0 effect oftype31. Launch factor =params[0], gravity factor =params[1]; no such effect = 1.0 and 1.0. ReplaceStageObject.LAUNCH_SCALE/Piece.GRAVITY_SCALEwith that lookup.- On the Palace this changes only definition 11 (pieces launched at half speed).
- Never play type 31 as an effect.
- The deck climb stays a WRONG row: do not change gravity for it.
The roll break: one flying box (playfix 11-14, H code and data)
Corrects step 5 of “Breaking” for the roll family (table 2 classes 1, 2, 4, 17): a roll object never makes per-joint pieces and never stays as its wreck in place. Read from the break (0x1401ec350), the support-loss handler (0x1401ebf90), the make-pieces slot 30 (0x1401ec800), the class constructors and the piece setup; checked on the Palace boxes (definitions 10, 13, 14: states 0 and 2, no state 1).
- Two state bytes in the roll component (component + 0x10 and + 0x20; the component constructor 0x1401db570 sets both to 0xFF). Every roll class constructor (2/1 0x1401dc3b0, 2/2 0x1401dc590, 2/4 0x1401dc980, 2/17 0x1401dd1b0) sets them to piece state 2 and target state 1.
- Break order: state effects of kind 2, bodies removed, dependants released, the break attack sphere, the break sound; then, when the piece state is not 0xFF, slot 30 with the contact direction scaled by −1 (float 0x1402f82e0); then the state switch: target 0xFF → the object is deleted (flag 0x80000); otherwise the object switches to the target state, and when that state has no model it is deleted as well. On the Palace boxes: one flying box, the intact box gone.
- Slot 30 (0x1401ec800) makes
ONE 8-point box piece drawn with the
piece state’s model (nothing
when that state has no model, or when bit 1 of
the global at 0x140530ccc is set; the setter of
that bit was not traced). The piece starts at
the object’s matrix; its box is the model’s
stored bounds (the same setup as the crumble
pieces: inset, thin axes, volume
sizebefore the inset). The contact point is not used. Velocity, game units per tick:- v = I · √(1200 / max(size, 200)) (floats 0x1402f8220, 0x1402f80dc), I the impulse;
- v.y += h(s + 3) · 0.6 / 256, with s the object’s serial byte and h the jitter’s byte hash (h(a) = low byte of a·33 + 33 + (a >> 1));
- × the launch factor of the type 31 record, then capped to length 1.5 when |v|² > 2.25;
- start spin w (piece slot 11): component k = h(s + k) · 0.0006 / 256 − 0.0003;
- gravity (0, −0.5, 0) × the gravity factor, as for the crumble pieces; the piece’s attack value is float 0 of joint 0 of that model (2 on the Palace boxes).
- Spin (0x1401f8850, from the piece tick 0x1401f9900): slot 11 arms a counter of 3; at the start of each sub-step while armed the counter steps, and the sub-step on which it passes 3 disarms it, so the spin runs on the first four sub-steps. Each of the eight points moves by w × q (q = that point’s previous position, stage coordinates, game axes) before the velocities are taken, so the move becomes velocity.
- Support loss (0x1401ebf90): the same slot 30 call with the impulse (h(s) / 256 − 0.5, 0, h(s + 1) / 256 − 0.5), skipped when bit 1 of the roll byte at component + 0x21 is set (writer not found; bit 0 of that byte is set by slot 22 when the piece state’s flag byte has bit 1, and keeps a deleted object’s record). Then the same state switch.
Shot end on a stage object (playfix r2 11-15, H code)
What a shot’s attack object does when its flight meets a placed stage object (tables, chairs, boxes), read in PDUWP.exe:
- Flags at the init (0x14026e9b7..0x14026ebba): every attack-object class sets flag 0x200 (test the stage each tick). For class 2 (shots with a caster) 0x14026ec50 also sets 0x400 when the caster is simulated on this machine (the same “local” word the body push reads).
- Each tick the post-update 0x14026e720 calls the stage test 0x14026ca50 (call at 0x14026e80b) with the 0x400 flag; a non-zero answer means the shot has ended.
- The stage test 0x14026ca50: set 0 with collision word 0x6A = 3 → no stage test. With 0x400 (and not set 0 with 0x6A = 1) a segment cast 0x1401633b0 from the last position to the new one in the probe whose group stage objects accept (mask 0x44); otherwise the cast 0x140163680, which still stops on object triangles but leaves no hit on them. On a contact: 0x6A = 2 flies on; otherwise the shot is put at the contact and the end routine 0x14026cd70 runs (reason 1: “Shot end”).
- Every object on the step is hit. The cast first runs the world query 0x1401d5860 over the whole segment, which leaves a contact on every body it overlaps, and only then takes the nearest triangle as the stop point (0x140163e80). Each stage object reads its own contact list in its tick (0x1401fd6e0, up to 8 other bodies). So in the tick a plain shot ends, every stage object whose triangles the tick’s segment crosses takes a hit, also those behind the stop point; objects past that tick’s step are not hit.
- Shape: a segment, no radius (the 5 u radius is the character test). An object beside the line is not hit; a chair next to a table is hit only when the line passes through it.
- Category 0x400 bodies (flying pieces, break spheres) are not in the object mask 0x44: a breaking table does not hit the chairs beside it.
Build: projectile.gd
_crossed_objects (every object on
the ending tick’s step, hit after the nearest
one), _on_sphere (the shot’s sphere
ignores stage-object bodies),
_end_on_stage (these hits land
after the physics step, as the sphere’s signal
put them before: a break’s pieces are first
stepped in the next tick; the tick order against
the game’s attack update is not decoded); test
test_props_table_chair.gd. The 0x6A
variants and the remote-caster rule are not
built (PLACEHOLDERS “Shot vs stage objects: 0x6A
variants”).