A2: Player figure and animation

The islander is built in headless Blender (tools/models/figure.py,
`make figure`, `make art`) as twelve rigid parts with their origins at
their joints: an oilskin coat, a sou'wester, sea boots, a bedding roll
and the canvas wing-sail. Debian's Blender can't write glTF, so the
figure is jointed rather than skinned.

FigureRig hangs the parts on pivots, paints them from Palette with the
coat in the player's own oilskin, and plays FigurePoses' hand-written
key poses through one AnimationTree: idle, walk and run by speed,
crouch and creep, air, skydive, glide, swim and aboard; long, short and
carried holds; reload and use layers; fire, boathook swing, keg throw
and building as one-shots; and a flinch when health drops. The chest
takes a third of the pitch and the held item all of it.

Figures animate from replicated state only: positions, look, health,
the held item and the FLAG_ bits (reloading and using now reach
mirrored players), with actions from FX. Every boathook swing is now a
sim "swing" event, sent as a SHOT with no item, so misses are seen and
heard; the new FX kind PLACE shows pieces placed. Protocol version 4.

Tests: test_figure_rig (15), plus swing and PLACE cases in test_harvest
and test_net_fx. make check passes (604 tests); make client-check
passes. Captures: figure_states, figure_actions, figure_close
(make figure-captures), client_glide and client_landed.

Closes #42

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 17:35:53 -05:00
co-authored by Claude Opus 5.5
parent da0c65f3ce
commit 07738330b5
66 changed files with 6230 additions and 88 deletions
+40 -2
View File
@@ -578,7 +578,45 @@ numpy), a `.json` with the grip (the origin), the left hand's support point and
bounds, and a 128 px Cycles icon in `assets/icons/items/`. Each surface's material is
a `Palette` name; `TRIM2_`/`TRIM3_` surfaces are the tier treatment. `ItemModels`
loads them, keeps the surfaces a tier shows and paints them from `Palette` (tier 0
faded). `EntityView` puts the held item in each figure's right hand (`HAND`), turned
with the player's pitch, and draws items lying in the world with one MultiMesh per
faded). `EntityView` puts the held item in each figure's right hand, pointed along
the player's look, and draws items lying in the world with one MultiMesh per
model and tier. The hotbar shows the icons.
## Player figure (A2)
`tools/models/figure.py` builds the islander in headless Blender as twelve rigid
parts (pelvis, torso, head, upper arms, forearms, thighs, shins and the wing-sail),
each an OBJ whose origin is the joint it turns about, plus `figure.json` with the
joints and hand points (`make art` rebuilds these and the items). OBJ has no
skeleton, so the figure is jointed rather than skinned.
`FigureRig` hangs the parts on a tree of pivot nodes (`hips/waist/spine/...`) and
paints them from `Palette`, `COAT` in the player's own oilskin. `FigurePoses` holds
every animation as key poses (joint rotations in degrees and a hip lift) and turns
them into `Animation` resources with position and rotation tracks. One
`AnimationTree`, in manual mode, plays them:
- `move`: a Transition between ground (a BlendSpace1D of idle, walk and run by speed,
time-scaled with speed), crouch (still and creeping), air, skydive, glide, swim and
aboard;
- `holding`: the arms' carry for the held item (long in both hands, short in one, or
carried in front), filtered to the arms and off while the hands are busy;
- `reload` and `use`: arm-and-head layers faded in while the FLAG_ bits say so;
- `act`: a OneShot on the upper body for fire (long or short), a boathook swing, a
keg throw and building;
- `hit`: a OneShot flinch of the chest and head when health drops.
The spine takes a third of the look's pitch and the hand is turned so the item points
along the whole of it, whatever the arm is doing.
Figures animate from replicated state only. `FigureRig.drive()` reads a `SimEntity`
as `ClientMirror` fills it from snapshots: position (speed comes from movement when
velocity isn't replicated), look, health, the held item and the FLAG_ bits, with
reloading and using now copied into `reload_ticks` and `use_ticks` as 1 or 0. One-off
actions come from FX records (`EntityView.hear()`, fed by `ClientSession`): a SHOT
with an item fires it, a SHOT with no item is a boathook swing (`Harvest.swing` now
reports every swing as a `swing` event, hit or miss), and PLACE (new in protocol 4)
is a piece placed. Being in the air waits `AIR_DELAY` before it shows, so steps down a
slope don't flicker. `EntityView.animate_live = false` lets captures pose figures
exactly.