Skip to content

Motion: a ladder volume a first-person body climbs (volume: ladder, ladder_speed) - #132

Merged
larelgit merged 2 commits into
mainfrom
claude/ladder-volume
Nov 22, 2026
Merged

larelgit merged 2 commits into
mainfrom
claude/ladder-volume

Conversation

@larelgit

Copy link
Copy Markdown
Owner

What

A climbable ladder as a level volume, for a first-person body in the manner of Half-Life. The manual's new section "Ladders" has the rules, the limits and the tests.

  • The volume. A new kind, VolumeKind::Ladder { face }. In a level file it is a node with "volume": "ladder" and "face": [x, y, z]: the way out of the ladder toward the side it is climbed from, in the node's space. It is shaped by its collider as water and updraft are, and the level check names a missing or vertical face.
  • Who climbs. A body whose locomotion gives a ladder_speed. The default is 0, the body does not climb, so no NPC does unless its definition says so. Two more options: ladder_jump_speed (2.5 m/s) and ladder_by_look (off; Half-Life's rule, the forward input goes along the look's pitch). All three are left out of the written form at their defaults.
  • The climb (MotionMode::Ladder, driven by the existing Intent only):
    • The body takes hold when it pushes into the ladder from its front against something solid: on the ground, in a fall, or swimming. It also takes hold when it walks off an edge inside the volume, which is the way down from the top.
    • There is no gravity on it. Into the ladder is up, away from it is down, the rest slides sideways, and no input hangs.
    • At the top it walks off level onto the floor; at the foot it stands on the ground. Neither reports a landing.
    • A jump lets go with a push out of the face, and the body takes hold of no ladder while it goes on pushing into that one.
  • Around it. Animation sets get the mode name and the locomotion state ladder; the describer shows ladder ↑3.5m/s; the jump and glide tools answer for the mode; physics_overlay draws the volume orange. The navmesh leaves the volume out, as it does every sensor.

State and determinism

  • The ladder is found again each tick from what the capsule touches. Beside the mode, the only thing kept is LadderLetGo, a reflected marker (registered, net_predicted) on a body that jumped off a ladder, until it stops pushing into it.
  • No resource was added and no field of MotionState or LocomotionInput, and the new enum variants are the last ones.
  • A body with no ladder_speed moves as it did, to the bit, in a world with a ladder (a_body_with_no_ladder_speed_is_not_affected_by_a_ladder).
  • A climb and a jump off go on bit for bit from what a snapshot holds (a_climb_and_a_jump_off_go_on_the_same_from_what_a_save_holds).

Checked

Run locally on Windows, after a rebase onto main at b7e5a0fe:

  • cargo test -p shards_motion: 478 passed, with the 17 new tests of tests/motion/ladder.rs and the reader guard (--test readers).
  • cargo test -p shards_level: 111 passed, one of them new (the node, a turned node, the messages).
  • cargo test -p shards_action: 589 passed.
  • cargo clippy -p shards_motion -p shards_level -p shards_action -p shards_npc -p sandbox --all-targets -- -D warnings: silent.

Not run locally

  • The sandbox's tests: the state audit and the 28 reference replays. The machine had no room for that build; this PR's CI is their first run. No replay was recorded again, and none should need to be.
  • The whole workspace (cargo test --workspace), the template's tests, --check-content and the worldgen report.
  • A game built against the branch, and anything in a window: the climb was only driven in headless tests, so its feel is checked by numbers alone.
  • A co-op client's prediction of a climb. It runs the same controller code and was not tried on a stand.

Not built

  • A body that faces its movement (face: Move) is not turned to the ladder.
  • path_to, clearance and move_to path=true do not know a ladder.
  • NPCs do not use ladders.
  • No sandbox scenario or reference replay uses a ladder yet.

Seen on the way, not changed here

Two shards_action tests (the_example_in_the_docs_is_valid_content, the_layers_example_in_the_docs_is_valid_content) fail on a Windows checkout with core.autocrlf=true: they search their own source for \n and the file has CRLF. They pass with LF endings, which is how the count above was taken.

🤖 Generated with Claude Code

A new volume kind, VolumeKind::Ladder { face }: a level node with
"volume": "ladder" and "face": [x, y, z] (the way out of the ladder, toward
the side it is climbed from, in the node's space), shaped by its collider as
water and updraft are.

A body whose locomotion gives a ladder_speed (default 0: it does not climb,
so no NPC does) takes hold of a ladder when it pushes into it against
something solid, on the ground, in a fall or swimming, and when it walks off
an edge inside the volume (the way down from the top). On it there is no
gravity: into the ladder is up, away from it is down, the rest is sideways,
no input hangs. At the top it walks off level onto the floor, at the foot it
stands on the ground, and a jump lets go with a push of ladder_jump_speed
(2.5 m/s). ladder_by_look is Half-Life's rule: the forward input goes along
the look's pitch.

The state is the new MotionMode::Ladder and nothing else: the ladder is found
again each tick from what the capsule touches, so no component, resource or
field of MotionState was added, a body that does not climb moves and hashes
as it did, and the three options are left out of the written form at their
defaults. Driven by the existing Intent only.

Animation sets get the mode name and the locomotion state "ladder", the
describer shows "ladder ↑3.5m/s", the jump and glide tools answer for the
mode, physics_overlay draws the volume orange. The navmesh leaves the volume
out as it does every sensor.

Tests: tests/motion/ladder.rs (14) and shards_level's colliders.rs (the node,
a turned node, the messages). Not run here: the sandbox's tests and the
reference replays (the machine had no room for that build).

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
A body that jumped off a ladder and went on pushing into it was back on it
at once: the rule "not while it moves away" lasts only until the air control
has taken the jump's speed back, which under accel: Projected is two ticks,
so for a player who climbs with the key down the jump did nothing.

The jump is now remembered: the controller puts the marker LadderLetGo on
the body, and a body that has it takes hold of no ladder. It comes off once
the body no longer pushes into a ladder it touches from the front (the input
was let go, or it fell clear of the volume) or is out of the air, so the
next push takes hold as ever: jump and hold the key to fall to the foot, let
it go and press again to catch the ladder on the way. The marker is
reflected, registered and net_predicted, and only a body that jumped off a
ladder ever has it. With it a ladder_jump_speed of 0 lets go too.

Tests (tests/motion/ladder.rs, now 17): the jump with the push held under
both models of the air, the push let go and taken again in the fall, and a
climb and a jump off put back from what a snapshot holds (Transform,
MotionState, LocomotionInput, the marker) going on bit for bit. The manual
also says how thick a ladder's volume may be: thinner than twice the body's
radius, or a body against the wall is never in front of it.

Not run here: the sandbox's tests (the state audit and the reference
replays).

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@larelgit
larelgit merged commit 52b217f into main Nov 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants