Skip to content

Worker count at run time, colour counts, def names, stored ids; test_world.c, test_body_query.c, test_broad_phase.c whole; the rolling mix traced (#142, #143, #146) - #154

Merged
nicolas-maman merged 1 commit into
mainfrom
api/runtime-and-ids
Oct 9, 2026
Merged

nicolas-maman merged 1 commit into
mainfrom
api/runtime-and-ids

Conversation

@nicolas-maman

Copy link
Copy Markdown
Collaborator

More of Box3D e77352c's API and the rest of its test files: test_world.c (apart from the hull database), test_body_query.c, test_broad_phase.c, test_id.c, the SIMD width test and two partial tests now pass on this engine. One counter is fixed on the way.

API (#148, part):

  • physics_world.set_worker_count / get_worker_count (b3World_SetWorkerCount). They rebuild a world's own threads, worker slots and task contexts between steps, clamped to [1, MAX_WORKERS]. A world stepping on a host's scheduler keeps that scheduler's count. The world's worker setup and teardown are now one pair of functions.
  • Counters.color_counts (each colour's contacts and joints, the overflow last).
  • get_max_manifold_points.
  • A name on BodyDef and ShapeDef.
  • Ids stored to 64 bits and back in the reference's layout (store_body_id / load_body_id and the shape, joint and world ones).

A bug fixed: Counters.awake_contact_count counted only the awake set's non-touching contacts. The reference counts every contact the collide pass touches, the graph's colours included; ours now does the same, checked on the overflow pile.

test_world.c, the rest (#142, closes it apart from TestHullDatabase, which goes with #147):

  • TestCompoundHitEvents (the struck child's material on the hit event) and TestCompoundContactMaterials (child 1's material reaching the friction callback, mixed to 0.9, for sphere, capsule and hull children).
  • TestOverflowColorPile (shared/overflow_color.c).
  • TestSetWorkerCount: the counts 4, 4, 0, -5, MAX + 10 and 2 between steps. The reference only moves its junkyard's pusher between changes; here a pile steps between them, and the run matches one worker throughout bit for bit.
  • BodySimLocatorTest whole: its five scenes (sleep and wake with a non-touching plate, an awake neighbour swapped into a sleeping island's hole, destroys in the awake and static sets, a kinematic plate parked over a sleeping box, type changes and a joint merging two sleeping sets). Each is validated every step, and one worker and four end bit for bit alike. LocatorFastFlagTest is in too.

test_body_query.c, the rest (#143, closes it):

  • OverlapHullProxyEquivalence and OverlapHullProxyRotation.
  • OverlapCompoundRotatedBody through both overlaps.
  • The mover's time of impact: a miss after the hit, the mover and body moved together, a million metres out, filtered, started inside one shape, a turning bar.
  • MoverTOIMatchesSweep: 2,000 random movers, origins and body turns, each agreeing with the raw time of impact it builds.

The rest of #146 (closes it):

  • ShapeNameTest and MaxPointCountTest.
  • BroadPhaseStressTest: a swarm through every proxy change, with the pair set checked by brute force after every step, for three seeds at one, four and three workers, the last with sleep on.
  • SIMDWidthTest: its rolling mix scene (test_determinism.ae), with every manifold impulse folded into the trace. Our lane width is the build's, so the golden trace gains the scene (120 new lines, no existing line changed) and CI checks it on the four-lane build and the AVX2 one. Locally the AVX2 build matches the four-lane golden bit for bit.

Still open in #148: serialization (the tree's save and load, the height field's dump and load, the compound's bytes) and a run-time SIMD width. Our width is a build choice, and std.lanes compiles one width per program.

Local gate on Aether 0.794.0: all 33 suites pass with no warnings, and the golden trace matches bit for bit (1,256 steps with the rolling mix). Pins: Aether 0.794.0 and aeb v0.325, the latest releases.

Closes #142. Closes #143. Closes #146. Refs #148, #147.

…est_world.c, test_body_query.c and test_broad_phase.c whole, the rolling mix in the golden trace (#142, #143, #146, #148)
@nicolas-maman
nicolas-maman merged commit fb7924a into main Oct 9, 2026
2 checks passed
@nicolas-maman
nicolas-maman deleted the api/runtime-and-ids branch October 9, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment