Effect instances, slots and joint attach

Read in PDUWP.exe 1.3.25854.2; data checks over the 476 effect files that have an .eft. Confidence per line. This section corrects “Skill effects” above in three places: the second u16 of the 0x14 chunk is the element’s joint, not a running index; the .eft per-model entries hold a draw layer; and joints carry rotation, scale and a name tag that attaches them to the owner character’s joints.

Instance table (H). The effect context (pointer at 0x1405bb2e0) holds 256 instances of 0xF0 bytes at +0x60. Spawn = 0x14018d2f0(owner player, effect id, slot, matrix or none). It returns no handle (and asks for the load) while the effect’s files are not loaded.

Instance Field
+0x00 handle = index, slot << 12, counter << 16
+0x08 stop flag (0x14018d3d0): emitters stop spawning, the instance ends when its elements are gone
+0x0C frame (float, ticks)
+0x10 length = the largest end frame of the slot’s elements (0x14018aee0)
+0x14 loop flag = slot flag bit 2, or the slot is 1
+0x1C, +0x20, +0x24 owner, effect id, slot
+0x40 pointer to the owner matrix: the owner model’s root matrix, or the caller’s matrix when the owner has no joint table
+0x50 live matrix (the spawn matrix; 0x14018d440 rewrites it, as the flight effect’s shot does each tick)
+0x90 copy of the spawn matrix, never rewritten
+0xD0 the owner matrix’s translation at spawn
+0xDC owner-rooted flag = slot 0 and (effect id < 1000 or no matrix was passed)

.eft (H). Slot entry (0xF4 + 0x1C × slot): u32 flags (bit 0 = present, bit 2 = loop; only three slot 1 entries have bit 2), then the s16 model list ended by −1. The 0x14-byte entries at the file start are per model: their second u32 is the draw layer, 29 → draw pass 0x1E, 27 → draw pass 0x1C (1023 and 516 models; pass 0x1C is skipped while a context flag at +0x11590 is clear). What separates the two passes on screen was not followed (L: 27 before, 29 after the translucent world).

Slots (H for 0..3, M for 4/5). Present in 426 / 139 / 138 / 187 / 67 / 71 of 476 files.

Slot Played Where
0 cast start on the caster, owner-rooted (below)
1 flight, always looped the shot’s matrix, rewritten each tick
2 shot end (“Shot end”) the shot’s end matrix, fixed
3 release (0x140259310, called by the release routine 0x140262798 for ground and air; id = the cast profile’s effect, up to 3 handles) the caster’s matrix (action component +0xBE0), fixed at spawn; elements tagged with body joints ride them
4 looping character effect: started by 0x140259540 when the skill in use reaches its release and stays active (two copies, both forced to loop, the second started half a length in); also the status effects below and the rain kind caster matrix; elements on body joints
5 the end of a slot 4 effect (0x1402598d0: slot 4 gets the stop flag, slot 5 is spawned once); also a hit on a character (0x1402729c0) and the rain kind’s start as slot 4

Per skill kind in the data (files with the slot / skills with a file): straight 0, 1, 3, 2 (44 / 43 / 38 / 35 of 44); multishot 0, 1, 3 (8) and 2 (5); melee 0 and 3 (21), 2 (9); blade 0 and 3 (11), 2 (6); pursuit 0, 3; lobbed 0, 1, 3, 2; rain all six; defense 0 (38), 4 and 5 (42 of 42); environment 0 only (28); status as their shot kind, a few with 4 / 5.

Joints (H layout, M sign of the turn). Skeleton chunk 0x3, 0x40-byte records: position 3 f32, rotation 3 f32 in radians, scale 3 f32, u16 flags (0x4 mesh, 0x10 has translation, 0x20 has rotation, 0x100 named; the builder ignores them), two u16, s16 parent (not used for effects: the hierarchy is flat), u32 name tag. The tag is the six-character base-40 name (0x140284690: 0–9 = 1..10, letters = 11..36 without case, _ = 37, first character highest); rhand = 0xADB07630, the hand tag already known from the blade code.

Each draw (0x140188fd0 → 0x140189420) builds one matrix per joint:

The owner’s joint table (0x14018a7d0, set up with the body model) lists every named joint of the character skeleton, sorted by tag. Every element reads its joint’s matrix (0x14 chunk: u16 material, u16 joint; handler 0x140295ef0), so particles, lights, trails and meshes all sit on a joint, not only meshes.

Joint names used by player effects (count of joints): rhand 1169, body1 985, raddha 645, body2 352, rninou 252, rtekub 193, rfoot 192, neck 188, rkata 169, lninou 161, rsword 146, lhand 141, lkata 138, head 132, lfoot 124, ltekub 115, knees, hip, thighs. All are joints of the player body model (pc00a: body1 9, body2 10, lkata 11, lninou 12, ltekub 14, lhand 17, laddha 23, rkata 33, rninou 34, rtekub 35, rhand 38, raddha 44, rsword 46, neck 56, head 57, hip 68, lfoot 73, rfoot 87). The names barier, hou01, h_NN, c_02, wshoto, damage, hit_00 exist only in the boss skeletons: those are boss effects (out of scope).

Joint pairs (M). 0x14018aaf0 answers “which owner joints for this element joint” with one joint of the same tag, or two for 14 pair names: LHRH (both hands), LFRF (both feet), RKRH / LKLH (shoulder + hand of one side), B1RH / B1LH / B1RF / B1LF (body1 + a hand or foot), LARA, RKRA, B1RA, B1LA, NERA, NELA (the …addha joints with shoulder, body1 or neck). Its second caller (0x1401130e0, an element routine) was not identified (L: a beam or trail stretched between two joints).

Mesh matrix sources (corrects “Effect drawing”, M). int(raw_m[12]): 3 / 4 = the owner matrix (+0x40, the caster’s root, live); 5 = the spawn matrix copy (+0x90), used flagged, so its position only; 7 = the owner matrix at the owner’s spawn-time place; 8 = the owner matrix’s axes at the live matrix’s position. Particle source 3 = the acceleration turned by the owner matrix.

Status character effects (H table, M play). 0x14025cbd0 walks three entries {status slot, effect id}: 8 → 518, 11 → 519, 33 → 521. While the status is on it keeps one slot 4 instance alive on the character (caster matrix); when it ends it sets the stop flag and plays slot 5 once.

The fire shot (eft0061), what differs from ours:

Implementation notes for the rebuild

  1. Give every element (not only meshes) its joint transform: local = T·Rz·Ry·Rx·S from the joint’s position, rotation (radians) and scale; effect.json now carries joint on every element and name / tag on every joint.
  2. Named joint → multiply by the owner character’s bone of that name each frame (full bone transform, rotation included), for slots 0, 3, 4, 5. Unnamed → the instance root.
  3. Cast effects (slot 0): root = the caster’s root transform with the position frozen at the cast start; stop following the hand with the whole effect (follow_bone): only the named joints follow.
  4. Spawn slot 3 at the release on the caster (caster transform), not at the projectile.
  5. Hit slot: apply the joint rotations and offsets (petals upright, flash 1 m up).
  6. Mesh sources 3 / 4 / 8 = the caster’s root transform (8 with the effect’s own position); 5 = the spawn transform’s position.
  7. Defense: play the defense skill’s own effect, slot 0 at the cast, slot 4 looping on the caster while the defense is up (two copies half a length apart), slot 5 once when it ends, and retire the see-through disc. Same pattern for statuses 8 / 11 / 33 with effects 518 / 519 / 521.
  8. Not settled: the order of an element’s own scale / offset against its joint matrix (mesh setup 0x1401a5940 / 0x1401a5ff0), the draw-layer difference, the particle rand seed.

The fire shot in the packs, and what the rebuild draws (effects1)

The game plays the pack entry, not the loose file (see “Effect packs”). For the fire shot its slots hold 15 / 9 / 2 / 5 elements (loose: 15 / 9 / 5 / 3), so the petal and three-smoke statements above are about the loose revision:

Bones for named joints: effectconv.py --bones <character .alr> <out.json> writes {"format": "pd-bones", "version": 1, "joints": {name: bone index}} from the character’s skeleton (the converted models name their bones joint_<index>); the data build puts one per character model under <data>/effect/bones/<model>.json. Built in pd_effect.gd: notes 1–7 above (joint matrices for every element kind, named joints on the owner’s bones with the bone’s basis taken without the skeleton’s 0.1 scale, slot 0 owner-rooted, slot 3 via PdEffect.play_release, all mesh matrix sources, defense slots 4 / 5 in defense_look.gd, status effects in status_look.gd).