Skip to content

OW6b: gamepads drive every scheme (sticks, triggers, buttons) - #1417

Merged
transfix merged 26 commits into
masterfrom
feat/one-world-gamepad
Nov 21, 2026
Merged

transfix merged 26 commits into
masterfrom
feat/one-world-gamepad

Conversation

@transfix

@transfix transfix commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

OW6b of ARIADNE_WORLDS.md §18.6: gamepads drive every control scheme. Stacked on #1415 (OW6a).

What a gamepad does

Scheme Gamepad
walk walk on the left stick (as fast as it is pushed), look around on the right stick, jump A, mouse look on/off by pressing the right stick, get in X (held 0.4 s)
car steer on the left stick, throttle RT, brake LT, reverse LB, look around on the right stick, get out X (held)
boat the car's, with reverse on LT (no brake)

Changes

  • controls.h: a binding's pad is read now. It takes buttons by position (A, B, X, Y, LB, RB, Back, Start, Guide, LeftStick, RightStick, the D-pad), triggers (LT, RT) and stick halves (LeftY-, LeftX+, ...).
    • Each binding has a deadzone: 0.15 of a stick's travel, 0.05 of a trigger's. Past it, the rest of the travel reads 0 to 1.
    • An action's value is its keys' value or its gamepad's, whichever is larger. Only the keys' steering ramps; a stick is read as it is.
    • New: control_resolver::update(held, dt, pad), set_pad, walk_axes, look_axes, from_pad and pad_reading.
    • Each scheme gains look_left, look_right, look_up and look_down, bound to the right stick only.
  • cvcGL SdlGamepad (new): reads the first gamepad SDL finds, and finds one plugged in later within about a second. It is one instance per host, with no process-wide state. Without SDL there is never a gamepad.
  • room_view: intent_from_axes, the analog walk. intent_from_keys now calls it.
  • arigl:
    • feeds the gamepad to the resolver (Orbit mode only, as with keys);
    • faces where the camera looks while the gamepad is the input in use (as under mouse look);
    • turns the camera with the right stick, at 150°/s at a full push, and the chase camera waits while it does;
    • names the gamepad's button in the get-in prompt ("X Drive humvee");
    • logs the gamepad when it connects or goes.
    • Gamepad bindings live at <viewer>.pad.<scheme>.<action>, seeded with the defaults.
  • Controls window: each avatar and vehicle action shows its gamepad input in a column beside its keys, with a Change button of its own. After Change, the next gamepad input pressed becomes the new binding (a button, a trigger, or a stick pushed past half way). Keys are ignored while it waits, and Escape keeps the old binding.
    • KeyBinding gains pad and pad_path.
    • Runtime::post_pad_press takes newly pressed inputs; SdlGamepad::pressed() lists them each frame.
    • arigl's input pump owns the gamepad. It posts the presses and hands the gamepad to the room's controls, except while the window waits for a button, so pressing one to rebind doesn't move the avatar.
  • ARIADNE_WORLDS.md: §18.6 adds a gamepad column to the schemes table and an as-built OW6b paragraph. The OW6 row is updated.

Tests

  • ControlSchemes.AGamepadPlaysTheSameActions: the default pad bindings; the deadzone and its rescale; stick halves; the walk and look axes; A jumps; X held fires once and waits for a release across set_scheme; the stick steers with no ramp; the triggers are throttle and brake; LB is a car's reverse and LT a boat's; a key and the stick together; from_pad; rebinding and invert.
  • AriadneAppRuntime.KeysWindowRebindsAGamepadInput: the gamepad column and its default; a third Change button only on the row that has a gamepad binding; a press with no Change waiting binds nothing; keys are ignored while it waits; a press rebinds; Escape keeps the old binding.
  • The related suites pass locally (Holon, ControlSchemes, AriadneOneWorld, the Ariadne runtime, app runtime and FTXUI tests, room intrinsics, cvcgl_room_view; 241 tests in the last run).

Not verified

No gamepad was connected during testing, so SdlGamepad was compiled and linked but never read real hardware. Also untested in a live session: the stick directions (Y down), the camera's turn direction, and how the Controls window's new column looks (it appears only with a relay, so only the mock backend has checked it).

…7 quanta

ARIADNE_WORLDS.md section 18.1 (owner, 2026-11-19: "7 quanta"). Every host
runs the holon's 1/120 s quantum, physics a step a quantum, and the
navigator's tick is 7 quanta (0.0583 s), the nearest whole tick to the
0.06 s the shipped policies were trained at.

- sim_tick.h: kSimQuantum 1/120 s, kSimTickQuanta 7, kSimTick from them;
  adopt_sim_clock puts a fresh clock on the catch-up even at the quantum.
- pycvc: SIM_TICK_QUANTA; cars.py's fallbacks; the gym, swarm and
  sim_thread defaults follow kSimTick.
- NavPlantConvergence.PoliciesHoldTheirReachAtTheSimulationTick
  (CVC_NAV_TICK_AB=1): the shipped and default policies on Jolt
  RoboRacers at 0.06 s, the simulation tick and 0.05 s over 24 s.
The plant host's own default stays 0.01 s, where navigators at the
trainers' 0.06 s run; the cars template and the scene swarm, which tick
cvc::kSimTick, give their plant_host a 1/120 s world. The nav lab's
retarget lands on the first tick at or past 3 s.
0.01 s for a tick of whole 0.01 s steps (every score so far), the
simulation quantum for one of whole quanta (cvc::kSimTick), else the step
nearest 0.01 s that divides it.
ARIADNE_WORLDS.md section 18.2. holon::attach_world(SceneWorld *) moves
the avatars into a server document's physics world, beside its bodies and
vehicles, and steps that world on the holon's clock: SceneWorld::follow
gains per-step hooks, the avatars driven just before each step and read
after it. A car shoves an avatar; the avatar takes some of its momentum.

- avatar_world over a shared world it does not own: its owner steps it
  and owns its gravity, air and statics; release() and move_to() (a
  world its owner replaced).
- AppRuntime::set_world_external: the runtime stops stepping a world a
  holon runs.
- arisrv attaches the server document's world to the room's holon.
- AriadneOneWorld tests: a Humvee driven into a standing avatar carries
  it down the road and ends behind the same run without it; attach
  refuses a client, a holon without physics and a world on another step;
  avatars stand on the scene's own bodies; detach puts them back.
ARIADNE_WORLDS.md section 18.4. WorldVehicles::set_movers: other things
in the world the navigators steer around while avoid is on, as foreign
agents to each fleet's separation. A holon running the world sets them to
its avatars before each step, and clears them when it leaves. A car on
nav@1 swings 3.1 m past a person standing in its lane and drives on;
without avoiding it carries them 34 m (AriadneOneWorld).
ARIADNE_WORLDS.md section 18.4. holon::entities() lists every mover in the
holon's world: each participant's person and the attached world's
entities, with kind, controller, driver, owner and policy.
holon::set_driver(pid, entity) puts a participant in a world vehicle: its
person leaves the world (feet and reserve kept), its intent's new drive
axes (avatar_intent::steer, accel; intent.steer/accel on the wire)
replace the vehicle's command each frame, and its state and display pose
are the vehicle's. Getting out puts the person at a clear point beside
the vehicle and gives the vehicle back to its controller.
WorldVehicles::set_driver / driver; the room's entities carry driver.
# Conflicts:
#	docs/roadmap/ARIADNE_WORLDS.md
#	src/cvc/tests/ariadne_scene_world_test.cpp
…40 steps

master's #1384 (fleets) wrote it at the 0.01 s step; with #1378's 1/120 s quanta 240 steps are
2.0 s, and the fleet, from rest at about 1.75 m/s^2, makes 4.35 m of the 5 m it asks for. 2.4 s
(288 steps) makes 6.1 m.
…bcvc into feat/one-world-avoid

# Conflicts:
#	src/cvc/ariadne/world_vehicles.cpp
#	src/cvc/tests/ariadne_scene_world_test.cpp
…bcvc into feat/one-world-entities

# Conflicts:
#	src/cvc/ariadne/world_vehicles.cpp
#	src/cvc/tests/ariadne_scene_world_test.cpp
…g in by asking

avatar_intent's drive axes are now shares of the vehicle's envelope: steer of its lock,
throttle [-1, 1] (negative is reverse), brake [0, 1]; the server scales them by the
driven vehicle's max_steer/max_accel/max_decel (holon::drive_command). The brake stops
the vehicle and never backs it up; reverse brakes a car still rolling forward, then
backs it up; a boat has no brake and reverses on its propeller astern. On the wire:
intent.throttle, intent.brake, intent.jump (intent.accel is gone).

The walker jumps (avatar_intent::jump) at its controller's jump_speed (4 m/s by
default) when something is under its feet, paying the jump from its reserve.

Getting in is asked for in the room: participants.<pid>.drive = "<seq>:<entity>",
answered by server_pump in drive_status and driving (relay-owned). holon::get_in holds
it to the world's rules: the archetype's drivable: and reach: (3 m from its chassis
box). room-drive / room-driving verbs; room entities carry drivable, reach, controls.

controls.h: control schemes walk, car and boat with their own bindings (Space jumps a
walker, brakes a car; E held 0.4 s gets in and out), and a resolver with steering
ramps and hold-to-fire.
… camera; docs

arigl's room controls come from the scheme of what we control: walking (avatar.keys, plus
Space to jump, V for mouse look, E held to get in), or the car's or boat's scheme while
the relay says we drive (controls.<scheme>.<action>; all of them in the Controls window).
The nearest drivable vehicle in reach (drive_target, the one ahead first) gets a prompt
over it, "E  Drive <name>", whose ring fills as E is held; a refusal is shown for a
moment. Driving, client_pump plays our own pose out from the relay's samples instead of
predicting it, room_view hides every driver's marker (set_riders), and the camera swings
behind the moving vehicle.

traffic.ari's trucks are drivable. ARIADNE_WORLDS 18.6 describes the schemes, the shares,
the jump and the ask; OW6 is started.
A control binding's pad inputs are read now: buttons by position (A, B, X,
Y, LB, RB, ...), the triggers LT and RT, and stick halves (LeftY-, LeftX+).
Each has a deadzone; an action is its keys' value or its gamepad's, the
larger, and only a key's steering ramps.

Defaults: walk on the left stick (as fast as pushed), look around on the
right, jump A, get in and out on X held; driving, the left stick steers,
RT is the throttle and LT the brake, LB a car's reverse (a boat's is LT).

cvcGL's SdlGamepad reads the first gamepad SDL finds. arigl feeds it to
the resolver, faces where the camera looks while the gamepad is in use,
turns the camera with the right stick, and names the pad's button in the
get-in prompt. room_view gains intent_from_axes for the analog walk.
A KeyBinding can name its gamepad inputs and where they live (pad,
pad_path). The Controls window shows them in a column of their own with
a Change button: the next gamepad input pressed becomes the new binding.
Keys are ignored while it waits, and Escape keeps the old one.

Runtime::post_pad_press takes the newly pressed gamepad inputs.
SdlGamepad::pressed() lists them each frame (a button gone down, a
trigger or stick half past half way).

arigl's input pump now owns the gamepad: it posts the presses to the
runtime and hands the gamepad to the room's controls, except while the
window waits for a button. Each avatar and vehicle action lists its
gamepad default, seeded at <viewer>.pad.<scheme>.<action>.
…/one-world-drive

# Conflicts:
#	docs/roadmap/ARIADNE_WORLDS.md
#	inc/cvc/ariadne/avatar_sim.h
#	inc/cvc/ariadne/holon.h
#	src/cvc/ariadne/holon.cpp
#	src/cvc/ariadne/holon_sync.cpp
#	src/cvc/tests/ariadne_scene_world_test.cpp
Base automatically changed from feat/one-world-drive to master November 21, 2026 17:45
…/one-world-gamepad

# Conflicts:
#	docs/roadmap/ARIADNE_WORLDS.md
#	inc/cvc/ariadne/controls.h
#	src/arigl/main.cpp
#	src/cvc/ariadne/controls.cpp
#	src/cvc/tests/holon_sync_test.cpp
@transfix
transfix merged commit a211031 into master Nov 21, 2026
56 of 59 checks passed
@transfix
transfix deleted the feat/one-world-gamepad branch November 21, 2026 22:26
transfix added a commit that referenced this pull request Nov 22, 2026
…il JX2

numpy-cp312 2.4.6+cvc.7 was published for wasm and wasm-mt on 2026-11-21 (23:43Z), built with
-fwasm-exceptions for JX2 (#1409). libcvc still links ariglx with Emscripten's JS exceptions, so
every ariglx-web job that has installed it since fails to link bin/ariglx.js:

  wasm-ld: error: .../numpy/_core/_multiarray_umath.cpython-312-wasm32-emscripten.so:
    undefined symbol: __cpp_exception (also __wasm_lpad_context, _Unwind_CallPersonality)

pin-wasm-pre-jx1.sh now puts cvc.6 back, as it does for the JX1 bundles. cvc.6 is the bundle
#1417's ariglx-web jobs linked on both columns. Checked locally on wasm and wasm-mt: with cvc.7
installed, 2 of numpy's 19 extensions import __cpp_exception; after the script, the lockfile
says cvc.6 and none do. JX2 deletes the script and its calls.
transfix added a commit that referenced this pull request Nov 22, 2026
…il JX2

numpy-cp312 2.4.6+cvc.7 was published for wasm and wasm-mt on 2026-11-21 (23:43Z), built with
-fwasm-exceptions for JX2 (#1409). libcvc still links ariglx with Emscripten's JS exceptions, so
every ariglx-web job that has installed it since fails to link bin/ariglx.js:

  wasm-ld: error: .../numpy/_core/_multiarray_umath.cpython-312-wasm32-emscripten.so:
    undefined symbol: __cpp_exception (also __wasm_lpad_context, _Unwind_CallPersonality)

pin-wasm-pre-jx1.sh now puts cvc.6 back, as it does for the JX1 bundles. cvc.6 is the bundle
#1417's ariglx-web jobs linked on both columns. Checked locally on wasm and wasm-mt: with cvc.7
installed, 2 of numpy's 19 extensions import __cpp_exception; after the script, the lockfile
says cvc.6 and none do. JX2 deletes the script and its calls.
transfix added a commit that referenced this pull request Nov 22, 2026
…legacy A/B (TexMol T5 part 1) (#1439)

* cvc::pocket_tunnel: PocketTunnel on the shared cocone core, with its legacy A/B (TexMol T5 part 1)

PocketTunnel (Goswami and Bajaj, UT 2008; transfix/volrover src/PocketTunnel, UT LGPL-2.1):
the pockets, tunnels and voids of a surface, as the stable manifolds of the distance
function's maxima outside it.

- The cocone core P1 ported (init, util, tcocone, rcocone, datastruct, stepping) moves from
  src/cvc/geometry/skeleton to src/cvc/geometry/cocone, shared by both ports. The skeleton's
  own stages keep their files and get skeleton_stages.h. PocketTunnel's init.cpp and
  tcocone.cpp were this code; its util.cpp adds only cell_volume, now in the core.
- cvc::pocket_tunnel (inc/cvc/geometry/pocket_tunnel.h): S_max (grow_maximum, merging the
  touching outside clusters, volumes and their sort), the mouths (detect_handle) and the
  output (convert_pocket_tunnel_to_rawc_geometry) as one coroutine, a resumable
  pocket_tunnel_stepper and its result_job, with a param_table (pocket_tunnel_params.h). The
  result lists every cluster with its kind, mouths, volume, cells and maxima, which the
  legacy library only printed; the coloured surface keeps the legacy colours. No statics,
  no files, no stderr; bad input throws pocket_tunnel_error with a reason. The quadratic
  legacy pieces (the linked-list merges, the volume table, the selection sort, a facet scan
  per shown feature) are a union-find, a table, a stable merge sort and one scan.
- pocket_tunnel_test: the four chambered-ball inputs (a pocket, a tunnel, three chambers, a
  cavity), the output's invariants (closed, consistently oriented boundaries whose enclosed
  volume is the cluster's), bad and degenerate input, point order (which moves only a few
  surface cells: Tight Cocone walks in tet_complex's insertion order), independent calls, two
  apps at once on their own schedulers and state trees, T7 resumability and cancel, the
  parameter keys on the state tree; natively and in the wasm-mt ports lane.
- The legacy A/B (tools/volrover-goldens): pockettunnel_driver.cpp runs the legacy entry
  once a process, through a read-only hook patched into pocket_tunnel.cpp, and records its
  clusters, geometry and Tight Cocone marking; make_goldens.py --check compares by content.
  Given the legacy marking, the port's own stages match the legacy library exactly on all
  four cases (clusters, triangles, colours). End to end they match exactly on three; Tight
  Cocone's greedy peeling walks in the cells' order, which in the legacy code is their
  addresses, and on the tunnel case that marks a few surface cells differently (the legacy
  library itself gives the other result in one run of five within a process).
- CI: pocket_tunnel_test joins SAN_CXX_TESTS; the cgal-ab path filter watches the cocone
  core's new directory; the volrover goldens job checks PocketTunnel too.

* pocket_tunnel: the legacy A/B on PDB 1GRL's surface, now that cvc::mol::blur is on master

- tools/volrover-goldens/inputs/pockettunnel/1grl.pts: 1GRL's heavy atoms blurred by
  cvc::mol::blur (blobbiness -0.2, a 3 A grid) and cvc::iso at 10, 2,609 points as floats;
  its golden from the legacy library. make_inputs.py leaves it alone (it needs libcvc).
- OnAProtein (native, where libcvc has its mesher): makes the surface at the skeleton lab's
  2 A (10,881 points; the largest feature a two-mouth tunnel of about 2,600 A^3) and at 3 A,
  checks the committed points against the latter, and writes them again with
  CVC_POCKETTUNNEL_WRITE_1GRL.
- The A/B covers 1grl: after Tight Cocone, the port is the legacy library exactly (19
  clusters, 490 triangles, 251 coloured points). End to end the large pocket is the legacy's
  cell for cell, the tunnel has 317 cells to its 309 (1,195 A^3 to 1,181), and the legacy
  run finds 17 one-cell pockets to the port's 3; large clusters are compared to 5%.

* ci: pin numpy-cp312 to cvc.6, its last JS-exceptions wasm bundle, until JX2

numpy-cp312 2.4.6+cvc.7 was published for wasm and wasm-mt on 2026-11-21 (23:43Z), built with
-fwasm-exceptions for JX2 (#1409). libcvc still links ariglx with Emscripten's JS exceptions, so
every ariglx-web job that has installed it since fails to link bin/ariglx.js:

  wasm-ld: error: .../numpy/_core/_multiarray_umath.cpython-312-wasm32-emscripten.so:
    undefined symbol: __cpp_exception (also __wasm_lpad_context, _Unwind_CallPersonality)

pin-wasm-pre-jx1.sh now puts cvc.6 back, as it does for the JX1 bundles. cvc.6 is the bundle
#1417's ariglx-web jobs linked on both columns. Checked locally on wasm and wasm-mt: with cvc.7
installed, 2 of numpy's 19 extensions import __cpp_exception; after the script, the lockfile
says cvc.6 and none do. JX2 deletes the script and its calls.

* pocket_tunnel: the goldens are the legacy library's on Linux, as CI's check makes them

The first Linux run of the volrover goldens check (run 44987475380) remade three of the five
PocketTunnel goldens differently from the Windows ones. The legacy result follows the cells'
heap order, so glibc's and MSVC's heaps mark different cells outside on tunnel (33 more on
Linux), three_chambers (41 fewer) and 1grl (67 fewer). As with Skeletonization's goldens, the
committed set is now CI's (ubuntu-24.04, GCC, cvcpkg's CGAL), from that run's artifact.

- MatchesTheLegacyLibraryAfterTightCocone: unchanged and exact on all five; given either
  platform's marking, the port's stages make that platform's result.
- MatchesTheLegacyLibrary: tunnel is now exact end to end (a tunnel of 3,085 cells and five
  pockets of one or two, as the port finds); three_chambers moves to the 5% group (each
  cluster 3 to 6 cells more than the legacy's); 1grl's tunnel is 317 cells to 307.
- README: the table, the end-to-end numbers and the platform note.

* LBIE: no edge flag for an edge stored outside the grid

The asan-ubsan job stopped pocket_tunnel_test's OnAProtein at 1GRL's 3 A
surface: octree.cpp:2656, "shift exponent -1 is negative". An edge on the
volume's far boundary is stored in a cell outside the grid; xyz2octcell
gives -1 there, so is_eflag_on() and eflag_on() computed idx -3 to -1 and
shifted by idx%8. Both now treat such an edge as having no flag.

The mesh does not change. Every caller makes a quad only through
is_min_edge(), which returns 0 for these edges before it touches the
frame, because is_refined() is 1 outside the grid. eflag_on() already
changed nothing for them, since the shifted bit fell outside the char.
pocket_tunnel 15, lbie_mesher 69, algorithm 10, geometry 122 and
skeleton 11 pass natively, and the 3 A surface still matches the
committed 1grl.pts.

* pocket_tunnel_test: 1GRL's 3 A surface exactly on x86, its size on aarch64

recipe / macos-latest / Debug ran OnAProtein for the first time on this
PR (every earlier macOS run was cancelled), and its 3 A surface had 2,606
points to the committed 1grl.pts's 2,609. x86 Linux and Windows make the
same 2,609. On aarch64 the compilers' default fuses the mesher's
multiply-adds; the mesher is not built with -ffp-contract=off, as
blur.cpp is, and the 2 A surface still has the same 10,881 points.

So the committed-copy check stays exact where __FP_FAST_FMA is not
defined (x86, and MSVC everywhere), and on a target with fused
multiply-add it checks the point count to 1%. The README says so.
pocket_tunnel_test passes 15/15 natively (Windows, exact path).
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.

1 participant