Skip to content

One world: a server holon runs the document's SceneWorld (OW2) - #1379

Merged
transfix merged 11 commits into
masterfrom
feat/one-world-holon
Nov 21, 2026
Merged

transfix merged 11 commits into
masterfrom
feat/one-world-holon

Conversation

@transfix

Copy link
Copy Markdown
Owner

OW2 of ARIADNE_WORLDS.md section 18 (one world, the holon is the world), server side. It is stacked on #1378 (OW1, the 120 Hz clock), which it needs: the holon's quantum and the document world's step have to be the same.

What it does

  • holon::attach_world(SceneWorld *): a server holon with physics runs a server document's SceneWorld as its one physics world.
    • The avatars move into that world where they stood, beside its bodies and vehicles.
    • The holon steps the world from its own step through SceneWorld::follow. Each avatar is driven just before each step, after the vehicles, boats and weather have applied their forces.
    • The room's statics are kept but not used: the scene's bodies are what avatars stand on.
    • A replaced physics world (a restart) is followed: the avatars go into the new one where they were last.
    • Null detaches: the avatars go back to a world of the holon's own, with the room's statics.
    • It refuses a client holon, a holon without physics, and a world on another step.
  • avatar_world over a shared world it doesn't own. The owner steps the world and owns its gravity, air and statics (step and set_statics throw). New release() and move_to().
  • SceneWorld::follow(clock, after_step, before_each, after_each): hooks around each step, called with the clock tick.
  • AppRuntime::set_world_external: the document's runtime stops stepping a world that a holon runs.
  • arisrv attaches a server document's world (its scene: with physics) to the room's holon at start-up, and says so in its log.

Contact (AriadneOneWorld.ACarShovesAnAvatarAndTheAvatarSlowsTheCar): a Humvee accelerates at 2 m/s² from (-40, 0) toward an avatar standing at (-25, 0).

  • After 6 s, the car is at x = -4.49 m and 11.27 m/s. The same run without the avatar ends at -3.82 m and 11.30 m/s.
  • The avatar is carried along at 11.26 m/s. The walker's 840 N can't hold 70 kg against the Humvee.
  • Before the car arrives, the avatar stands on the scene's square, with no room statics given.

Not in this PR (section 18.7):

  • Clients still build their statics from the published scene, and draw vehicles from the entity playout (OW5).
  • Navigators don't avoid avatars yet (OW4).
  • Entities are not generic yet (OW3).

Local (MSVC, Jolt):

…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.
# 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.
transfix added a commit that referenced this pull request Nov 20, 2026
…1403)

FL1b of [FLEETS_AND_NIGHT_ROADMAP.md](docs/roadmap/FLEETS_AND_NIGHT_ROADMAP.md), following FL0 + FL1a (#1384, merged as 28c371c).

Each fleet now has its own navigator, with its own sense, belief and policy (settled as D8). Nothing in the one-world stack (#1378, #1379, #1381, #1387) touches this part.

```yaml
start:
  - { fleet: city, archetype: humvee, plant: kinematic, count: 800, spawn: opposed, seed: 7,
      rally: { count: 16 }, sense: fog, belief: grouped, policy: trained }
```

## A navigator per fleet

- **One navigator per plant per fleet**, keyed `<plant>/<fleet>`. The plant's unnamed vehicles keep the navigator they had. The fleets meet each other as foreign agents, as different plants already did.
- **`sense:`** is `known` or `fog`. By default it is the world's `vehicles.sense`, and it follows that key when the key changes.
- **`belief:`** says how the vehicles share what they sense:
  - `shared` (the default): one map;
  - `grouped`: max(2, n / 64) maps, teammates together;
  - `private`: one map per vehicle.
- **Keys:** `vehicles.fleets.<name>.sense` and `.belief` rebuild the navigator, with the vehicles at rest where they are. `.planes` counts the maps.

## The policy

`policy:` takes one of:

- `trained` (the default): `$CVC_NAV_WEIGHTS`, else an installed copy (`coef_mlp::default_weights_path`), else a download of `cvcpkg://cvc/grl-snam-weights` (`share/grl-snam-weights/coef_sdf.cvcnav`) through the data store, cached by hash;
- `builtin`: the built-in net;
- a `.cvcnav` path;
- `{ uri, path, sha256 }`: a file, an https URL or a cvcpkg:// package, the `.cvcnav` inside it, and its hash;
- `{ data: <entry> }`: one of the document's `data:` entries.

Switching and reporting:

- `vehicles.fleets.<name>.policy` switches it live: `sim_world::set_policy`, or `reset_policy` for the built-in net.
- `.drives` says what drives:
  - `trained (<where>, sha256:...)` or `weights (...)`;
  - `builtin`;
  - `builtin: loading <uri>` while a download is under way;
  - `builtin: no trained weights (<why>)` when the weights can't be had. The fleet then drives on the built-in net, and the host's log gets the same line once. With the network off, the reason reads "the network is off, so ... cannot be fetched: run the host with the network on (--net-allow ORIGIN)".
- New `policy_library::get_bytes` loads weights already in memory (a download, a data entry) once per hash, as `get` does for files.

## Also

- **`controller: pose` is refused for a fleet**, and so is an archetype whose first controller is `pose`. A fleet lays out and drives its vehicles, while a pose entity is placed only by its poses.
- **The FL1a documents now say `policy: builtin`**, so their layout and drive tests don't depend on the weights a box has installed.
- **Docs:** the Fleets section of ARIADNE.md, and in the roadmap the FL1b row and D3 updated for ARIADNE_WORLDS section 18. A drawn host's async world becomes the local server-role holon (OW7), and `poses(fleet)` feeds OW5's playout.

**Left for FL1:**
- plant lists and per-team plants;
- the metric (D9);
- `poses(fleet)`;
- the gym's fleet.

## Tests

`ariadne_scene_world_test` passes locally (MSVC, Jolt).

- **New:** `AriadneWorldVehicles.AFleetHasANavigatorAndAPolicyOfItsOwn` covers:
  - a 130-vehicle grouped fleet (2 maps) beside 6 private fog scouts (6 maps) on a sha256-pinned `.cvcnav`;
  - the belief key, then the policy key switched live: builtin, trained via `$CVC_NAV_WEIGHTS`, a missing file, and an unreachable cvcpkg package. The last two fall back visibly.
- **Extended:** `AFleetIsANamedStartEntry` gains the new keys and their errors.
@transfix
transfix merged commit 8ed6494 into master Nov 21, 2026
29 checks passed
@transfix
transfix deleted the feat/one-world-holon branch November 21, 2026 04:53
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