feat(modapi): world shapes: sphere, capsule and box casts and overlaps through the game's own shape query #2663

Merged
HumanBean merged 2 commits from ChloeNow/Longshot:feat/modapi-world-shapes-rs into mod-api 2026-11-28 04:31:41 +00:00
Contributor

Depends on #2662 (world.ray and rayAll by kind). This branch is stacked on it: review only the commit after
494e1325. Once #2662 merges, this rebases onto mod-api with git rebase --onto origin/mod-api 494e1325 and the
base stays mod-api.

Summary

#2662 gives mods rays by kind. This adds what other engines offer next to them: shapes swept through the world and
shapes placed in it, against the game's own collision (Unity's SphereCast/CapsuleCast/BoxCast, their Alls and
OverlapSphere/Capsule/Box; Unreal's sweeps and overlaps; Godot's cast_motion and intersect_shape).

  • Casts: sphereCast(from, to, radius, options?), capsuleCast(from, to, radius, height, options?) and
    boxCast(from, to, halfExtents, options?): the nearest thing the shape touches as its centre goes from from to
    to. Each has an All: everything it touches on the way, nearest first, each thing once, at most 16.
  • Overlaps: overlapSphere(center, radius, options?), overlapCapsule(center, radius, height, options?),
    overlapBox(center, halfExtents, options?): what the shape touches where it is now. Empty means the place is clear.
  • The rays' options (RayOptions): the same kinds (ground, objects, characters, water on; Link off) and ignore.
  • What it touched (ShapeHit, new): the point on the surface, its normal, the shape's centre at that moment (where
    it can go and no further), the distance its centre went, the kind, the actor's key, and inside (touching at the
    start; every hit of an overlap).
  • Capsules stand upright (along the world's up, as Link's body does); boxes lie along the world's axes.

Each is asked and cast as a ray is: in the same slots, by the physics step on its own thread, settling a Promise a frame
later. The step builds the game's own shape query as its AI builds one on its stack (QueryPhysicsCastShapeEntitySphere,
f_82ac68d0): the game's constructor, the game's class for each shape (its destructor checked against the build's),
and the game's own builder for the shape (sphere f_803bd550, capsule f_80d1eba0, box f_8047e6f0; the radius in
s0, the stepping thread's own put back after), which makes a Havok convex shape in the query's own arena, so nothing
goes on the heap. It runs with f_805efbc0 (Havok's castShape, or its closest points for an overlap). Every hit comes
from the one query's collector, its kind from the hit body's own layer: no second query. The collector is the same hit
list, of the same records, as #2662's every-hit ray query's, so both are read by one reader (contacts_of).

Read first: shape_query and shape_cast in game/crates/game-core/src/rays.rs and the SQ_/CT_
offsets in layout/rays.rs; the shapes.* named locations in game/sites/sites.toml; then the shapes' functions and
cast_ask in game/crates/api/src/services/world.rs, and the schema's functions (world.toml) and ShapeHit
(types.toml). docs/dev/reference/world.md's Shapes has the query's layout and the run.

This is #2438's change, made again on the Rust mod API's rays; #2438 (the C mod API) can close. Part of #1958's Modding
API; targets mod-api.

Testing

Tested: Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24. In the game (a quick build before the shape availability and dimensions fix,
rebased on #2662's every-hit rayAll and current mod-api, the shapes' hits read by the same reader;
dev.py game-tests, the repository's kokiri-start, in Link's house), a probe mod's test passes: a sphere of 0.3 m
swept down onto his floor stops with its centre 0.30 m above it, a capsule 1 m tall 0.50 m above it, a box of half
extents 0.2 m 0.20 m above it (each ground: the sizes reach the game's builders); with player: true a sphere stops
0.30 m above his head with his key; sphereCastAll gives him once (his two bodies), then the floor; overlapSphere at
his chest gives him, his key and inside; a small box overlap above his head, nothing. Checks: cargo test -p game-core (rays: #2662's ray tests, and the shape query through the game's functions faked, a collector of Link's two bodies and the floor:
each thing once, the nearer body kept, kinds from the bodies' own layers, the distance and centre along the sweep, the
radius in s0 and the site's own put back, the overlap's closest-points flag, a class that is not the build's own
refused, and the calls in order with the destructor last), -p api (a shape's hit with its centre, a miss's at the
sweep's end; the sizes checked and a capsule of twice its radius or less a sphere), -p modtool, -p game-sites,
-p sites; cargo check --workspace --all-targets; cargo run -p schema-gen -- --check; rustfmt. Tests that fail on
mod-api itself and here, on Windows: api's a_content_mods_changed_module_runs_again_and_its_outputs_are_served
and modtool's eden_and_ryujinx_mods_are_found_with_their_switches.

Still to test:

  • Characters, objects and water touched in this port (as for #2662's rays), and a box's sweep along a wall
  • Linux, and clippy with warnings as errors: mise run rust and mise run test (by hand, or CI)

Measurements

Nothing measured here: a shape costs one query of the game's (its build, its run, its destructor) on the physics
step's thread, after its step, and with none asked nothing runs. The C version measured about 0.15 ms a shape.

Risks

Only mods that cast shapes reach this code. The shape query is the game's own, built as its AI builds it; a build whose
classes or functions differ (a destructor that is not the build's) gets no shapes: has() false, nothing cast. The
test game has no world to cast against (as for the rays). The generated docs' schema hash conflicts with any other
schema change: whichever merges later needs cargo run -p schema-gen again.

Checklist

Ready for review

  • One topic, on current mod-api; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

> **Depends on #2662** (`world.ray` and `rayAll` by kind). This branch is stacked on it: review only the commit after > `494e1325`. Once #2662 merges, this rebases onto `mod-api` with `git rebase --onto origin/mod-api 494e1325` and the > base stays `mod-api`. ## Summary #2662 gives mods rays by kind. This adds what other engines offer next to them: shapes swept through the world and shapes placed in it, against the game's own collision (Unity's `SphereCast`/`CapsuleCast`/`BoxCast`, their `All`s and `OverlapSphere`/`Capsule`/`Box`; Unreal's sweeps and overlaps; Godot's `cast_motion` and `intersect_shape`). - **Casts:** `sphereCast(from, to, radius, options?)`, `capsuleCast(from, to, radius, height, options?)` and `boxCast(from, to, halfExtents, options?)`: the nearest thing the shape touches as its centre goes from `from` to `to`. Each has an **`All`**: everything it touches on the way, nearest first, each thing once, at most 16. - **Overlaps:** `overlapSphere(center, radius, options?)`, `overlapCapsule(center, radius, height, options?)`, `overlapBox(center, halfExtents, options?)`: what the shape touches where it is now. Empty means the place is clear. - **The rays' options** (`RayOptions`): the same kinds (ground, objects, characters, water on; Link off) and `ignore`. - **What it touched** (`ShapeHit`, new): the point on the surface, its normal, the shape's centre at that moment (where it can go and no further), the distance its centre went, the `kind`, the actor's key, and `inside` (touching at the start; every hit of an overlap). - Capsules stand upright (along the world's up, as Link's body does); boxes lie along the world's axes. Each is asked and cast as a ray is: in the same slots, by the physics step on its own thread, settling a Promise a frame later. The step builds the game's own shape query as its AI builds one on its stack (`QueryPhysicsCastShapeEntitySphere`, `f_82ac68d0`): the game's constructor, the game's class for each shape (its destructor checked against the build's), and the game's own builder for the shape (sphere `f_803bd550`, capsule `f_80d1eba0`, box `f_8047e6f0`; the radius in `s0`, the stepping thread's own put back after), which makes a Havok convex shape in the query's own arena, so nothing goes on the heap. It runs with `f_805efbc0` (Havok's `castShape`, or its closest points for an overlap). Every hit comes from the one query's collector, its kind from the hit body's own layer: no second query. The collector is the same hit list, of the same records, as #2662's every-hit ray query's, so both are read by one reader (`contacts_of`). Read first: `shape_query` and `shape_cast` in `game/crates/game-core/src/rays.rs` and the `SQ_`/`CT_` offsets in `layout/rays.rs`; the `shapes.*` named locations in `game/sites/sites.toml`; then the shapes' functions and `cast_ask` in `game/crates/api/src/services/world.rs`, and the schema's functions (`world.toml`) and `ShapeHit` (`types.toml`). `docs/dev/reference/world.md`'s Shapes has the query's layout and the run. This is #2438's change, made again on the Rust mod API's rays; #2438 (the C mod API) can close. Part of #1958's Modding API; targets `mod-api`. ## Testing **Tested:** Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24. In the game (a quick build before the shape availability and dimensions fix, rebased on #2662's every-hit `rayAll` and current `mod-api`, the shapes' hits read by the same reader; `dev.py game-tests`, the repository's `kokiri-start`, in Link's house), a probe mod's test passes: a sphere of 0.3 m swept down onto his floor stops with its centre 0.30 m above it, a capsule 1 m tall 0.50 m above it, a box of half extents 0.2 m 0.20 m above it (each `ground`: the sizes reach the game's builders); with `player: true` a sphere stops 0.30 m above his head with his key; `sphereCastAll` gives him once (his two bodies), then the floor; `overlapSphere` at his chest gives him, his key and `inside`; a small box overlap above his head, nothing. Checks: `cargo test -p game-core` (`rays`: #2662's ray tests, and the shape query through the game's functions faked, a collector of Link's two bodies and the floor: each thing once, the nearer body kept, kinds from the bodies' own layers, the distance and centre along the sweep, the radius in `s0` and the site's own put back, the overlap's closest-points flag, a class that is not the build's own refused, and the calls in order with the destructor last), `-p api` (a shape's hit with its centre, a miss's at the sweep's end; the sizes checked and a capsule of twice its radius or less a sphere), `-p modtool`, `-p game-sites`, `-p sites`; `cargo check --workspace --all-targets`; `cargo run -p schema-gen -- --check`; rustfmt. Tests that fail on `mod-api` itself and here, on Windows: `api`'s `a_content_mods_changed_module_runs_again_and_its_outputs_are_served` and `modtool`'s `eden_and_ryujinx_mods_are_found_with_their_switches`. **Still to test:** - Characters, objects and water touched in this port (as for #2662's rays), and a box's sweep along a wall - Linux, and clippy with warnings as errors: `mise run rust` and `mise run test` (by hand, or CI) ## Measurements Nothing measured here: a shape costs one query of the game's (its build, its run, its destructor) on the physics step's thread, after its step, and with none asked nothing runs. The C version measured about 0.15 ms a shape. ## Risks Only mods that cast shapes reach this code. The shape query is the game's own, built as its AI builds it; a build whose classes or functions differ (a destructor that is not the build's) gets no shapes: `has()` false, nothing cast. The test game has no world to cast against (as for the rays). The generated docs' schema hash conflicts with any other schema change: whichever merges later needs `cargo run -p schema-gen` again. ## Checklist ### Ready for review - [x] One topic, on current `mod-api`; the title is a Conventional Commit. <!-- stacked on #2662 --> - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). <!-- Windows run as Testing says; clippy and Linux: CI --> - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. <!-- Windows built and played; Linux: CI --> - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(modapi): world.ray and rayAll: what a ray hits by kind, which actor, one passed through
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
35dd1e3505
world.ray was Preview, and has("world.ray") had no answer (the feature table had no line for it). A first run of the
step-thread cast shows it works, and that its "scenery" preset (48) is every layer, Link included: a ray down
through Link stopped on his head, as would a colliding camera rig's.

- ray(from, to, options?) and rayAll (new): the nearest hit, or every hit along the ray, nearest first, each body
  once, at most 16.
- RayOptions: ground, objects, characters, water on, player (Link) off by default; ignore, an actor's key whose
  bodies the ray passes through (their collision group, as f_80e86ac0 puts it in a ray's filter).
- RayHit: kind (RayKind), actorKey (for a mod with actors.read), inside, beside position, normal, distance.
- The camera rig's ray asks for the ground alone (Ask::scenery).
- has("world.ray") and has("world.rayAll") follow game_core::rays::features.

game_core::rays sets the filter's entity layers by kind (each checked a bit at a time in the C mod API's run, #2422),
tells a hit's kind by casting again with one kind at a time until the same body is hit, and for rayAll casts the
other kinds from just past each hit while stepping through the hit body with its own kind alone (an overlapping body
of that kind met at once is the same thing: Link's two bodies are one hit). A hit's actor is the listed actor one of
whose bodies has the hit's handle, found as the answer settles. A slot's ask and answer sit behind a lock each that
only the state's owner takes.

Tests: game-core's rays (the query with the kind's layers and the body handle; a made-up world answered as the
game's executor: the kind by a one-kind cast, every hit along the ray, Link's two bodies one hit with the floor at
his feet, Link passed through by his group, a ray from inside him, nothing asked a miss with no cast); api's world
(the answers as RayHits, the actor's key only with actors.read, rayAll's list) and features.

This replaces #2422, which made rays on the C mod API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(modapi): world shapes: sphere, capsule and box casts and overlaps through the game's own shape query
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
6ec3436c1c
Beside #2662's rays: sphereCast, capsuleCast and boxCast (a shape's centre swept from one place to another, the
nearest touch), each with an All (every thing touched on the way, nearest first, each once, at most 16), and
overlapSphere, overlapCapsule and overlapBox (what the shape touches where it is). The rays' options (kinds, ignore);
ShapeHit (new): the contact, its normal, the shape's centre then, the distance it went, the kind, the actor's key,
inside. Capsules stand upright, boxes along the world's axes.

They are asked and cast as the rays are, in the same slots, by the physics step on its own thread. The step builds
the game's own shape query as its AI's sphere query (f_82ac68d0) does: the game's constructor, the class for each
shape (its destructor checked against the build's), the game's builder for the shape (the radius in s0, the
stepping thread's own put back after: a Havok convex shape in the query's own arena), the run (f_805efbc0: Havok's
castShape, or its closest points for an overlap), the destructor. Every hit comes from the query's collector, each
body's nearest and an actor's several bodies once; a hit's kind is its body's own layer. The functions are the named
locations shapes.*; has() for each follows game_core::rays::features' SHAPES.

Tests: game-core's rays (the shape query through the game's functions faked: a collector of Link's two bodies and
the floor, each thing once, kinds from the bodies' layers, the distance and centre along the sweep, s0 put back, the
overlap's flag, a class not the build's refused, the calls in order); api's world (a shape's hit with its centre, a
miss's at the sweep's end, the sizes checked, a short capsule a sphere).

This replaces #2438, which made shapes on the C mod API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, RTX 4060 Laptop, a quick build of this head: a probe mod's test passes in Link's house (dev.py game-tests, kokiri-start): a 0.3 m sphere, a 1 m capsule and a 0.2 m box swept down onto his floor each stop their own size above it; a sphere stops 0.3 m above his head with his key; sphereCastAll gives him once then the floor; overlapSphere at his chest gives him, inside. Stacked on #2662.

Tested in game: Windows 11, RTX 4060 Laptop, a quick build of this head: a probe mod's test passes in Link's house (dev.py game-tests, kokiri-start): a 0.3 m sphere, a 1 m capsule and a 0.2 m box swept down onto his floor each stop their own size above it; a sphere stops 0.3 m above his head with his key; sphereCastAll gives him once then the floor; overlapSphere at his chest gives him, inside. Stacked on #2662.
ChloeNow force-pushed feat/modapi-world-shapes-rs from 6ec3436c1c
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 2bc2dcace2
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 7s
2026-11-28 01:51:22 +00:00
Compare
Author
Contributor

Rebased on #2662's new head (694a2438: rayAll is now the game's own every-hit ray query) and current mod-api. The shape query's collector is the same hit list, of the same records, as that query's, so the shapes read their hits with #2662's contacts_of (one reader, not two). In the game on 2bc2dcac: the shape probe passes with the same numbers as before, and #2662's ray probe passes on it too.

Rebased on #2662's new head (`694a2438`: `rayAll` is now the game's own every-hit ray query) and current `mod-api`. The shape query's collector is the same hit list, of the same records, as that query's, so the shapes read their hits with #2662's `contacts_of` (one reader, not two). In the game on `2bc2dcac`: the shape probe passes with the same numbers as before, and #2662's ray probe passes on it too.
ChloeNow force-pushed feat/modapi-world-shapes-rs from 2bc2dcace2
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 7s
to a68c64dbc3
All checks were successful
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Successful in 6s
2026-11-28 02:26:06 +00:00
Compare
Author
Contributor

Rebased on #2662's 494e1325 (current mod-api): a68c64db, only the generated docs made again; the same checks pass.

Rebased on #2662's `494e1325` (current `mod-api`): `a68c64db`, only the generated docs made again; the same checks pass.
Owner
@rebase
Member

I rebased this pull request onto mod-api (67a113a710): the new head is 7ba8253220.

Conflicts resolved

  • docs/dev/reference/world.md: Kept the base branch’s updated ray documentation and every-hit findings.
  • docs/modding/permissions.md: Kept the base branch’s schema stamp and permissions.
  • docs/modding/reference.md: Kept the updated every-hit reference and schema stamp.
  • docs/modding/scripting.md: Kept the base branch’s schema stamp and feature list.
  • game/crates/api/src/services/features.rs: Kept separate availability checks for ray and rayAll.
  • game/crates/game-core/src/layout/rays.rs: Kept the every-hit query layout.
  • game/crates/game-core/src/rays.rs: Kept the base branch’s native every-hit query implementation and its coverage.
  • game/modapi/schema/types.toml: Kept the updated inside-field description.
  • game/modapi/schema/world.toml: Kept the updated rayAll description.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `mod-api` (67a113a710ac): the new head is 7ba8253220f3. **Conflicts resolved** - docs/dev/reference/world.md: Kept the base branch’s updated ray documentation and every-hit findings. - docs/modding/permissions.md: Kept the base branch’s schema stamp and permissions. - docs/modding/reference.md: Kept the updated every-hit reference and schema stamp. - docs/modding/scripting.md: Kept the base branch’s schema stamp and feature list. - game/crates/api/src/services/features.rs: Kept separate availability checks for ray and rayAll. - game/crates/game-core/src/layout/rays.rs: Kept the every-hit query layout. - game/crates/game-core/src/rays.rs: Kept the base branch’s native every-hit query implementation and its coverage. - game/modapi/schema/types.toml: Kept the updated inside-field description. - game/modapi/schema/world.toml: Kept the updated rayAll description. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed feat/modapi-world-shapes-rs from a68c64dbc3
All checks were successful
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Successful in 6s
to 7ba8253220
All checks were successful
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Successful in 12s
2026-11-28 04:23:34 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. Shape availability can be advertised for a class that the cast then refuses. The reported game run demonstrates several basic cases, but the remaining collision kinds and Linux still need testing. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Adds asynchronous sphere, capsule, and box sweeps and overlaps for mods using the game's collision queries. It reuses the ray queue and hit reader, but adds query lifecycle and compatibility checks that need correction.

Should fix (2): not blocking, but worth doing before merging.

  • L1 game/crates/game-core/src/rays.rs:260: The feature bit checks that class slots exist but does not check their contents or destructors, although the query rejects a mismatched class. (more on the line) Do: Make shape feature availability reflect the same class and destructor validation used by the query, with a test for a mismatched class.
  • L2 game/crates/api/src/services/world.rs:360: Positive dimensions are checked before conversion to f32, so values too small to represent become zero. (more on the line) Do: Validate the converted f32 dimensions as positive and finite, or impose a documented representable minimum; cover both radius and box extents in tests.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The shape query still needs its untested collision cases and Linux checked in game. When: The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. Do: Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions.
  • L4: The physics-step cost of this implementation is unmeasured at the allowed request rate. When: A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. Do: Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene. (@fix does its part first: Bound or spread the work processed in one physics step if the allowed burst causes a frame-time spike.)

@fix can do L1, L2 and L4.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • game/crates/game-core/src/rays.rs:660: Can the builder fail or leave a null holder after initialization, and does the initialized query then own resources that require destruction?

Checks: Still running: PR description / Title and description (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Unproven across the advertised feature: the author's Windows run reports correct floor distances for all three shapes and player hits for a sphere. Objects, characters, water, a box sweep along a wall, and Linux have not been tested. This is not a performance change; the cited approximately 0.15 ms per shape came from the earlier C version, not a comparison of this head.

Other systems: Shapes share the physics-step queue, per-mod limit, and actor lookup with rays. A mod can request up to 64 casts per frame, so query cost can affect frame pacing; the cost on this implementation has not been measured. No GPU-specific rendering code or saved data changes are apparent.

Switches: None.

Reviewed: 7ba8253220 against 67a113a710: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the commit and diff, the changed world service, shape query and related layout and call code, and the world reference. Reviewed the schema and location changes; skimmed the generated modding reference and other documentation changes. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. The full contents of every changed code file were not independently read in full.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance.
  • The change adds no environment switch and does not modify the renderer API or third_party.
  • The reported Windows probe exercises sphere, capsule and box floor casts, a player hit, an all-hit sweep and an overlap.

Testing: Read-only review; no tests, builds, scripts, or game runs were executed. The author reports game-core, API, schema and other checks, with two named failures also occurring on the base.

Overlaps and merge order: Depends on #2662; merge that dependency first and rebase this change. The author identifies #2438 as the older C API version that this replaces.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Approve.** Shape availability can be advertised for a class that the cast then refuses. The reported game run demonstrates several basic cases, but the remaining collision kinds and Linux still need testing. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Adds asynchronous sphere, capsule, and box sweeps and overlaps for mods using the game's collision queries. It reuses the ray queue and hit reader, but adds query lifecycle and compatibility checks that need correction. **Should fix (2)**: not blocking, but worth doing before merging. - **L1** `game/crates/game-core/src/rays.rs:260`: The feature bit checks that class slots exist but does not check their contents or destructors, although the query rejects a mismatched class. (more on the line) **Do:** Make shape feature availability reflect the same class and destructor validation used by the query, with a test for a mismatched class. - **L2** `game/crates/api/src/services/world.rs:360`: Positive dimensions are checked before conversion to f32, so values too small to represent become zero. (more on the line) **Do:** Validate the converted f32 dimensions as positive and finite, or impose a documented representable minimum; cover both radius and box extents in tests. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The shape query still needs its untested collision cases and Linux checked in game. *When:* The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. **Do:** Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions. - **L4**: The physics-step cost of this implementation is unmeasured at the allowed request rate. *When:* A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. **Do:** Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene. *(`@fix` does its part first: Bound or spread the work processed in one physics step if the allowed burst causes a frame-time spike.)* `@fix` can do L1, L2 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `game/crates/game-core/src/rays.rs:660`: Can the builder fail or leave a null holder after initialization, and does the initialized query then own resources that require destruction? **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven across the advertised feature: the author's Windows run reports correct floor distances for all three shapes and player hits for a sphere. Objects, characters, water, a box sweep along a wall, and Linux have not been tested. This is not a performance change; the cited approximately 0.15 ms per shape came from the earlier C version, not a comparison of this head. **Other systems:** Shapes share the physics-step queue, per-mod limit, and actor lookup with rays. A mod can request up to 64 casts per frame, so query cost can affect frame pacing; the cost on this implementation has not been measured. No GPU-specific rendering code or saved data changes are apparent. **Switches:** None. **Reviewed:** 7ba8253220f3 against 67a113a710ac: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the commit and diff, the changed world service, shape query and related layout and call code, and the world reference. Reviewed the schema and location changes; skimmed the generated modding reference and other documentation changes. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. The full contents of every changed code file were not independently read in full.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance. - The change adds no environment switch and does not modify the renderer API or third_party. - The reported Windows probe exercises sphere, capsule and box floor casts, a player hit, an all-hit sweep and an overlap. **Testing:** Read-only review; no tests, builds, scripts, or game runs were executed. The author reports game-core, API, schema and other checks, with two named failures also occurring on the base. **Overlaps and merge order:** Depends on #2662; merge that dependency first and rebase this change. The author identifies #2438 as the older C API version that this replaces. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
@ -323,0 +357,4 @@
"a shape's radius is more than 0 and at most {SHAPE_MAX} m, not {radius}"
)));
}
Ok(radius as f32)
Member

L2 (should fix): Positive dimensions are checked before conversion to f32, so values too small to represent become zero.

When: A mod can pass a positive radius such as 1e-100, or the same value as a box half extent. Validation accepts it, then the game builder receives zero despite the API requiring a positive dimension.

Do: Validate the converted f32 dimensions as positive and finite, or impose a documented representable minimum; cover both radius and box extents in tests.

**L2** (should fix): Positive dimensions are checked before conversion to f32, so values too small to represent become zero. *When:* A mod can pass a positive radius such as 1e-100, or the same value as a box half extent. Validation accepts it, then the game builder receives zero despite the API requiring a positive dimension. **Do:** Validate the converted f32 dimensions as positive and finite, or impose a documented representable minimum; cover both radius and box extents in tests.
@ -224,3 +258,3 @@
&& Location::rays_hitsVtable.addr() != 0
&& Location::rays_hitsClear.func().is_some();
ON | if all { ALL } else { 0 }
let shapes = Location::shapes_queryInit.func().is_some()
Member

L1 (should fix): The feature bit checks that class slots exist but does not check their contents or destructors, although the query rejects a mismatched class.

When: If a build names the locations but a class slot is null or its destructor differs, has('world.sphereCast') reports true while every affected cast settles null at the class check.

Do: Make shape feature availability reflect the same class and destructor validation used by the query, with a test for a mismatched class.

**L1** (should fix): The feature bit checks that class slots exist but does not check their contents or destructors, although the query rejects a mismatched class. *When:* If a build names the locations but a class slot is null or its destructor differs, has('world.sphereCast') reports true while every affected cast settles null at the class check. **Do:** Make shape feature availability reflect the same class and destructor validation used by the query, with a test for a mismatched class.
Owner
@fix
fix(modapi): validate shape availability and dimensions
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Has been cancelled
1a3b4e96f8
As the review on #2663 asked.
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The shape queries have promising in-game results, but the remaining collision cases, Linux behavior and physics-step burst cost are unmeasured. The stacked dependency #2662 also needs to merge first. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 1a3b4e96f8. It was already up to date with mod-api. I edited its description to match the change.

Changed

  • Shape feature availability: game/crates/game-core/src/rays.rs:614 shares class and destructor validation between feature detection and queries; added coverage for mismatched and null classes. Tests were not run.
  • Shape dimensions: game/crates/api/src/services/world.rs:354 rejects dimensions that convert to zero or non-finite f32 values; added radius and box extent coverage. Tests were not run.

Left for the author

  • Physics-step burst cost: Measure frame time at the allowed burst rate and decide whether work needs to be bounded or spread across steps. The appropriate limit depends on that result.

Nothing was built or run: the checks run again on the new head.

Adds sphere, capsule and box casts and overlaps for mods, using the game’s collision queries. This gives mods more world-query options at the cost of work on the physics thread when requested.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The shape query still needs its untested collision cases and Linux checked in game. When: The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. Do: Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions.
  • L4: The physics-step cost of this implementation is unmeasured at the allowed request rate. When: A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. Do: Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Unproven for the full feature: the author reports successful Windows in-game probes for ground, Link and selected overlaps, but the latest availability and dimension changes have not been run in game. The implementation’s burst cost has no measurement; the reported approximately 0.15 ms per shape is from the C version.

Other systems: The queries run on the physics thread and share ray slots and collision filtering. Windows ground and player cases were reported working; characters, objects, water, a wall sweep and Linux remain untested. Mods that do not request shapes do not run shape queries.

Switches: None added, changed or removed.

Reviewed: 1a3b4e96f8 against 67a113a710: Read the repository instructions, contribution rules and pull request template, the fix diff, and the relevant shape availability, dimension validation, query and test code. The larger changed files, generated documentation, schemas and site definitions were skimmed; the complete change was not read in full.; nothing run (a code review).

Checked and fine:

  • Shape availability and query construction use the same class and destructor validation.
  • Radius and box extent conversion rejects values that become zero or non-finite in f32.
  • The recorded Windows probe exercised all three shape sizes against the floor.

Testing: No commands that build or run the project were executed. The author’s recorded game and check results predate the latest fix; CI has not run on this head.

Overlaps and merge order: Stacked on #2662; merge #2662 first and rebase this change.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The shape queries have promising in-game results, but the remaining collision cases, Linux behavior and physics-step burst cost are unmeasured. The stacked dependency #2662 also needs to merge first. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 1a3b4e96f83c. It was already up to date with `mod-api`. I edited its description to match the change. **Changed** - **Shape feature availability**: game/crates/game-core/src/rays.rs:614 shares class and destructor validation between feature detection and queries; added coverage for mismatched and null classes. Tests were not run. - **Shape dimensions**: game/crates/api/src/services/world.rs:354 rejects dimensions that convert to zero or non-finite f32 values; added radius and box extent coverage. Tests were not run. **Left for the author** - **Physics-step burst cost**: Measure frame time at the allowed burst rate and decide whether work needs to be bounded or spread across steps. The appropriate limit depends on that result. Nothing was built or run: the checks run again on the new head. Adds sphere, capsule and box casts and overlaps for mods, using the game’s collision queries. This gives mods more world-query options at the cost of work on the physics thread when requested. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The shape query still needs its untested collision cases and Linux checked in game. *When:* The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. **Do:** Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions. - **L4**: The physics-step cost of this implementation is unmeasured at the allowed request rate. *When:* A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. **Do:** Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for the full feature: the author reports successful Windows in-game probes for ground, Link and selected overlaps, but the latest availability and dimension changes have not been run in game. The implementation’s burst cost has no measurement; the reported approximately 0.15 ms per shape is from the C version. **Other systems:** The queries run on the physics thread and share ray slots and collision filtering. Windows ground and player cases were reported working; characters, objects, water, a wall sweep and Linux remain untested. Mods that do not request shapes do not run shape queries. **Switches:** None added, changed or removed. **Reviewed:** 1a3b4e96f83c against 67a113a710ac: Read the repository instructions, contribution rules and pull request template, the fix diff, and the relevant shape availability, dimension validation, query and test code. The larger changed files, generated documentation, schemas and site definitions were skimmed; the complete change was not read in full.; nothing run (a code review). **Checked and fine:** - Shape availability and query construction use the same class and destructor validation. - Radius and box extent conversion rejects values that become zero or non-finite in f32. - The recorded Windows probe exercised all three shape sizes against the floor. **Testing:** No commands that build or run the project were executed. The author’s recorded game and check results predate the latest fix; CI has not run on this head. **Overlaps and merge order:** Stacked on #2662; merge #2662 first and rebase this change. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
Owner
@rebase
Member

I rebased this pull request onto mod-api (bbfae8e8ef): the new head is 2a7d7e9903.

Conflicts resolved

  • docs/modding/permissions.md: Updated the combined schema hash.
  • docs/modding/reference.md: Updated the combined schema hash.
  • docs/modding/scripting.md: Updated the shortened combined schema hash.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `mod-api` (bbfae8e8ef9f): the new head is 2a7d7e990375. **Conflicts resolved** - docs/modding/permissions.md: Updated the combined schema hash. - docs/modding/reference.md: Updated the combined schema hash. - docs/modding/scripting.md: Updated the shortened combined schema hash. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed feat/modapi-world-shapes-rs from 1a3b4e96f8
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Has been cancelled
to 2a7d7e9903
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Failing after 6s
2026-11-28 04:31:15 +00:00
Compare
HumanBean changed title from WIP: feat(modapi): world shapes: sphere, capsule and box casts and overlaps through the game's own shape query to feat(modapi): world shapes: sphere, capsule and box casts and overlaps through the game's own shape query 2026-11-28 04:31:35 +00:00
HumanBean merged commit b365845e3e into mod-api 2026-11-28 04:31:41 +00:00
HumanBean deleted branch feat/modapi-world-shapes-rs 2026-11-28 04:31:42 +00:00
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The shape queries have shown the basic floor and player cases working on Windows, but the remaining collision cases, Linux behavior, and cost of a request burst are still untested. The change also depends on #2662 merging first. Recommend approval; not approved on the forge.

Adds shape casts and overlaps for mods using the game's collision query. This expands the world API, at the cost of additional physics-step work when mods request shapes.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The shape query still needs its untested collision cases and Linux checked in game. When: The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. Do: Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions.
  • L4: The physics-step cost of this implementation is unmeasured at the allowed request rate. When: A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. Do: Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene.

Since the last review (on 1a3b4e96f8)
Still open: L3 (The shape query still needs its untested collision cases and Linux checked in game.); L4 (The physics-step cost of this implementation is unmeasured at the allowed request rate.)

Checks: Still running: PR description / Title and description (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Unproven overall: the author reports successful sphere, capsule, box, player and overlap probes on Windows, but the remaining collision cases and Linux have not been checked. The reported approximately 0.15 ms per shape came from the older C implementation, not a measurement of this implementation.

Other systems: The queries run on the physics-step thread and share slots with rays, so bursts can affect physics timing and other callers. Windows floor and player cases were reported working; character, object, water, wall-sweep and Linux behavior remain untested.

Switches: None.

Reviewed: 2a7d7e9903 against bbfae8e8ef: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed generated hash lines, and the shape-query and slot-processing code relevant to the ledger. Skimmed the diff, generated documentation and reported runs; the remaining changed code was not read in full. The referenced Tooling AGENTS.md and docs/review-checklist.md were unavailable.; nothing run (a code review).

Checked and fine:

  • The three regenerated documentation hash references agree.
  • The reported Windows probe covers floor sweeps, player hits and a sphere overlap.

Testing: No commands that build, run tests or execute project code were run. The author reports game and automated checks on Windows; the outstanding in-game cases and burst measurement remain open.

Overlaps and merge order: #2662 supplies the ray API and collector this change depends on; merge #2662 first.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The shape queries have shown the basic floor and player cases working on Windows, but the remaining collision cases, Linux behavior, and cost of a request burst are still untested. The change also depends on #2662 merging first. Recommend approval; not approved on the forge. Adds shape casts and overlaps for mods using the game's collision query. This expands the world API, at the cost of additional physics-step work when mods request shapes. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The shape query still needs its untested collision cases and Linux checked in game. *When:* The reported Windows probe covers ground and player, but a mod using shapes against objects, characters or water, or sweeping a box along a wall, has no reported result on this implementation. Linux has no reported shape run. **Do:** Run casts and overlaps against those kinds and a box along a wall, including a Linux game run, and record the observed hits and positions. - **L4**: The physics-step cost of this implementation is unmeasured at the allowed request rate. *When:* A mod may submit 64 shapes in one frame, all processed on the physics stepping thread. The C implementation's approximate per-shape figure does not establish this version's frame-time cost. **Do:** Measure frame times with no shape requests and with a representative sustained shape workload, including the allowed burst, on the same build and scene. **Since the last review** (on 1a3b4e96f83c) Still open: L3 (The shape query still needs its untested collision cases and Linux checked in game.); L4 (The physics-step cost of this implementation is unmeasured at the allowed request rate.) **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven overall: the author reports successful sphere, capsule, box, player and overlap probes on Windows, but the remaining collision cases and Linux have not been checked. The reported approximately 0.15 ms per shape came from the older C implementation, not a measurement of this implementation. **Other systems:** The queries run on the physics-step thread and share slots with rays, so bursts can affect physics timing and other callers. Windows floor and player cases were reported working; character, object, water, wall-sweep and Linux behavior remain untested. **Switches:** None. **Reviewed:** 2a7d7e990375 against bbfae8e8ef9f: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed generated hash lines, and the shape-query and slot-processing code relevant to the ledger. Skimmed the diff, generated documentation and reported runs; the remaining changed code was not read in full. The referenced Tooling AGENTS.md and docs/review-checklist.md were unavailable.; nothing run (a code review). **Checked and fine:** - The three regenerated documentation hash references agree. - The reported Windows probe covers floor sweeps, player hits and a sphere overlap. **Testing:** No commands that build, run tests or execute project code were run. The author reports game and automated checks on Windows; the outstanding in-game cases and burst measurement remain open. **Overlaps and merge order:** #2662 supplies the ray API and collector this change depends on; merge #2662 first. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Failing after 6s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2663
No description provided.