Surface marks: craters, debris and the hard landing
What leaves a crater on the stage, where it
goes and why a hard landing on the Palace’s
upper level puts it on the underside. Read in
PDUWP.exe and checked against
Map/st03.dat and the playtester’s
Rebirth and Xbox (xemu) footage (private
recording). The underside crater is
original behaviour (the same on the
Xbox build, private recording 5), not a PC-port
difference: the rebuild reproduces it.
The chain (M code, H for the Palace check)
Probe. The ground probe 0x140163b50(position, radius, value) sets the shared sphere probe E (group 0x4) and queries the world. Callers:
Caller Centre Radius landing, jump / fall with drop > 80 (0x140254d35) the body position (feet, state + 0x12e40) 10 thrown landing, drop < 40 / 40–80 / > 80 (0x140254ec7 / f00 / ee9) the same 10 / 15 / 20 a blast starting (skill object state 3, 0x14026dc83), unless the record’s word 0x52 is 0 and its word 0x6A is 3 the blast centre (object + 0x140) the blast radius passed in a reaction routine (0x140259cbd, the action-row 0x3A / 0x3B path, not followed) body position + centre height 20 one story boss (0x14012fa81) — — The other source is the segment cast 0x1401633b0 (probe B, also group 0x4) used by three skill-object routines (0x140269f5c, 0x14026a39b, 0x14026caeb): a shot striking the stage.
Contacts on the arena. Arena mesh bodies hit group 0x4 only, so probes B and E are the only shapes that leave contacts on the arena’s side. The arena is one body per shape record of the stage file’s list, chained in file order (0x1401d4070). The sphere–mesh routine (0x1401d7fd0) walks a mesh’s triangle records in order and makes a contact when
|n · (C − v0)| < R(absolute: both sides of a face count, no back-face test) and the projected point lies in the triangle or an edge is within R of the centre. Contact point =C − n (n · (C − v0))(the centre projected on the triangle’s plane; it can lie outside the triangle), contact normal = the triangle’s stored normal. Each new contact is put at the head of the pair’s list, and the pair’s list at the head of the body’s list (0x1401d5130).One contact per probe. Once per stage tick (0x140202710, stage state 5) the routine 0x1402021f0 walks the arena bodies in chain order and their contact lists:
- contacts from a sphere (type 1): the first one met per sphere shape is kept (up to 7 shapes). So the mark goes to the lowest-numbered mesh that has any triangle in range and, within it, to the last triangle in range. Not the nearest one, and not the face the character stands on.
- contacts from a segment (type 5): per segment and query, the contact nearest to the segment’s start is kept (up to 8): the first surface the shot reaches. Each kept contact goes to the mark routine with the mesh attribute as the surface material. A stage object owning the touched shape can veto it (its method at vtable + 8 answering 1 adds 33 to the material, which the mark routine rejects). Stage objects reach the same mark routine from their own hit handlers (0x1401eaa20, 0x1401eac80; not followed).
Net. In battle modes 4 and 5 each mark made this way is also queued for sending (at most 16 per tick; record of 0x1C bytes: material, veto flag, position as rounded s16, normal × 10 as s16) and the receiver replays it through the same mark routine (0x1402020f0, called from 0x14027c7e0). M, the message id was not looked up.
Why the underside (H on the
data). The Palace’s upper level is a
slab: top faces at y ≈ 108.9–111.4, the
ground-floor ceiling under it at y ≈ 99.9,
9 units apart, both in the
collision set with stored normals up and down. A
landing probe of radius 10 centred on the feet
therefore touches the top face (distance 0)
and the ceiling face (distance 9.01).
Which one gets the mark is decided by file order
alone. Sampled with the rule above
(converter/markprobe.py): at
(−166.4, 108.9, −277.0) mesh 87 (ceiling)
precedes mesh 168 (top) → underside; at (164.3,
108.9, 167.2) mesh 919 (ceiling) precedes 930 →
underside; at (−36.9, 109.0, −65.5) mesh 403’s
last triangle in range is a ceiling one →
underside; at (−163.1, 108.9, 180.5) mesh 107
(top) comes first → top. On the ground floor (y
≈ 50) nothing lies under the floor, so the
crater is on the floor. The mark then sits 1
unit off the ceiling, facing down, exactly as
filmed. Where the first mesh in range is a wall
the mark goes on the wall; where its attribute
has no mark kind there is no mark at
all (no fall-back to another
contact).
A blast skill’s crater is the same object (same routine, same list; the one filmed on the walkway in a private recording sits on top). It differs only in the probe: a segment contact is the first surface reached, and a blast probe is centred on the blast with the blast’s radius, so it can pick a different triangle than a body landing at the same place (M; that clip’s spot on the walkway was not replayed).
Mark routine 0x14021d3f0(material, contact) (M)
Material 2..32 → mark kind through a table of 31 bytes (0x14021d5ec; stages whose number ends in 8 use 0x14021d5c0, which differs at 4 and 24):
| Mesh attribute | Kind |
|---|---|
| 2, 3, 4, 5, 6, 21, 25, 27 | 0 |
| 7, 8, 9, 10, 13, 24, 26, 28, 29, 30, 32 | 1 |
| 1, 11, 12, 14–20, 22, 23, 31 | none: nothing happens |
| stages ending in 8: 4 and 24 | none |
Then: position = contact point + normal × 1 unit; a matrix whose Y axis is the normal (0x14023ece0), turned about it by a random angle (rand / 32767 of a full turn); the service 0x1402422a0(matrix, kind):
- Mark list (the per-battle “crash” object, 0x14052deb0; add 0x1401c9210): 32 marks of 0x70 bytes (matrix, kind, active flag, age), a ring: the 33rd overwrites the oldest. Four kinds can be registered (0x140242110): kind k uses entry 0x40 + k of the system model table (0x140530390, {model, animation}); each kind keeps the model’s bounds and a radius (largest of |centre| + radius over the model’s parts, 0x1401c8c10). Entries from 24 up are filled in the loader’s second pass, from the stage’s own files, not st00 (the mapping: “Crater and debris models”, MD00 pairs).
- Refused when close: a new mark whose position is inside an existing active mark’s kind radius is not added (0x1401c9250 loop). The caller is told (result 0).
- Life (update 0x1401c8e60): a kind with an animation ages 0.5 per tick and is removed at the animation’s length; a kind without one stays until the ring overwrites it, or until the camera’s position enters the mark model’s bounding box (then it is removed). The Palace’s kinds carry none (H, “Crater and debris models”); st07 / st17 do.
- Draw: 0x1401c91e0 → 0x140289b60 with the kind table and the mark list: a stencil carve, see “Crater and debris models”.
What plays with it (0x14021d740(position, normal, added, kind)):
| When | What |
|---|---|
| always (also when the mark was refused, or the kind has no model) | one debris request to the debris manager (0x14021cb30 + 0x14021ca30): debris kind 15, count 1, fade start 50.0, the launch vector along the normal turned by a random matrix, a second vector (0, −1, 0) scaled from it; the kind’s own parameters replace the caller’s. Layout as “Crash debris (type 9)”; update and draw in “Crater and debris models”. Also every time: the smoke model, entry 0x45, with the mark matrix (corrected docs 11-14 crater) |
| mark added | two one-shot system models (0x14022e7d0): entry 0x0E with the mark matrix scaled × 2; entry 0x4A + 3 × kind + facing at the position (facing 2 = floor when n.y > 0.7071, 0 = ceiling when n.y < −0.7071, both unrotated; 1 = wall, turned to the normal laid flat), fade start 30.0 |
| mark added | two dust sprites in the stage particle pool (0x140242840): position ± 2.5 per axis, velocity = normal × 0.15, acceleration = the stage wind × 0.02, spin +2 and −2 per tick, colour and alpha from the stage parameter bytes, size 3.0; remaining fields L |
| mark added | a positional sound by material (table 0x1402f5da0 indexed material − 2; stages ending in 7 always 0xC7): 4, 5, 7 → 8; 6, 8 → 9; 9, 10, 11, 23–32 → 10; 12 → 13; 13 → 16; 14 → 11; 15, 16 → 15; others none |
| mark added | the stage’s destroy sphere (radius 15, targets 0xF00) is placed at the position and queried once: stage objects within 15 of a new crater take a destroy contact |
So a landing next to an existing crater (inside its radius) throws debris and smoke only: no new crater, no sound, no dust.
Corrections to earlier text
- “Stage attack bodies and landings” said the landing leaves no surface mark because 0x140245350 hangs off an unset singleton. That routine is indeed dead (it would run its worker with a null object), but it is not the mark path: the mark is made from the arena’s side of the same probe, as above. The same probe also reaches stage objects (the prop-breaking contact), unchanged.
- “Destruction effect services”: the hit reaction routine 0x14021d3f0 is this mark routine; its callers include the arena contact pass 0x1402021f0, not only object hit paths.
Implementation notes for the rebuild
- Keep the stage collision’s mesh order,
triangle order and stored normals in the
converted data (
collision.jsonkeeps the order; the stored normal equals the winding normal in file coordinates on every Palace floor and ceiling face, so with the JSON’s mirrored Z it is the opposite of the JSON winding). - Mark query for a sphere (centre C, radius
R): walk arena meshes in file order; in the
first mesh with a triangle passing
|n·(C − v0)| < Rand (projection inside, or an edge within R), take the last passing triangle; point = C projected on its plane, normal = its normal. For a shot’s segment: the nearest contact to the segment start. - Callers: fall landing with drop > 80 (R 10), thrown landings (R 10 / 15 / 20), blast start (blast centre and radius, with the record test above), shot impacts.
- Attribute → kind by the table; none → stop. Mark at point + normal × 1 unit, Y axis = normal, random spin. Refuse inside an existing mark’s radius. Ring of 32; remove when the camera enters the mark’s bounds (or at the animation’s end for animated kinds).
- With an added mark: the three one-shot models, two dust sprites, the material sound and the radius-15 destroy contact; always: one debris request of kind 15.
- Netplay: marks are events sent to the peers (position rounded to whole units, normal to tenths), not re-derived there.
- Needs converting first: the stage-pass system models (entries 0x40–0x43, 0x45, 0x4A–0x4F; 0x0E is an st00 entry) and the debris kinds (stage file slots 0x2C–0x3F).