Skip to content

World GB2 part 2: a data node's region and water level - #1399

Merged
transfix merged 4 commits into
masterfrom
feat/gb2-region-water
Nov 23, 2026
Merged

transfix merged 4 commits into
masterfrom
feat/gb2-region-water

Conversation

@transfix

@transfix transfix commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

GB2 part 2 of ARIADNE_WORLDS section 18.8: the region and the water level on the data node. This answers prettyhatemachine's GRL-SNAM asks (the crop, and deep water that is ground at mu 0.10).

#1396 has merged and master is merged in, so this diff is part 2 alone.

What changes

  • region: [min_x, min_y, max_x, max_y] on a data node (and on a generated_world node) cuts its dataset's world once, with crop_world_geometry (new, world_geometry.h):

    • the terrain is cut to the samples that cover the region, whole cells, with its cell materials;
    • each mesh is cut to the faces whose centroid (placement applied) is inside, keeping their face materials and dropping unused vertices;
    • volumes, surfaces and edge_walls are kept as they are.

    The bodies, the walls at the world's edge (now the region's) and the navigator's grid all follow the one cut. The dataset itself stays whole, and the drawing is not cut. A bad region warns and the whole world is used.

  • water_level: on a data node, else its dataset's level, is the node's one water knob. The dataset's level is a version 2 bundle's water_level, or a made world's water_level_m; a version 1 bundle such as Austin has none, so it gets no water. The level gives the node's world:

    • a still-water fluid field (volume_item "water", 1000 kg/m^3) over the terrain's extent, from 1 m under the lowest ground up to the level, with drag 1, damping 1e4 and inertial on;
    • the navigator's grid water (set_water) at the same level.

    The field follows the advice of the wading session (physics: land vehicles wade in water (opt-in vehicle_desc::wading) #1348): it reaches under the deepest bed, and with inertial on the damping acts only on heave, so a wading vehicle still drives through it. WorldVehicles::ensure_water sees the world's water and adds no still field of its own. A scene water node over the node runs the water instead.

Tests

ariadne_world_dataset_test, 4 new tests (8 in all):

  • WorldRegion.ACropKeepsWhatIsInside: terrain origin, size, heights and cell materials; a mesh keeps one face with its material and three vertices; a mesh with no face inside goes; a region off the terrain, or backwards, throws.
  • ARegionCutsTheBodiesTheWallsAndTheGrid: the cut terrain covers the region by under one cell, the bodies are the cut world's plus its four walls, the grid lies inside the cut, and the dataset stays whole.
  • ABadRegionWarnsAndKeepsTheWholeWorld
  • ADataNodesWaterLevelIsItsWater: the field is fluid and inertial; a point under the level is wet at 1000 kg/m^3 and one above is dry; the grid has water at the level; a level under all ground makes no field.

Locally: 2,041 matching ariadne, world, data, nav and cvcGL ariadne tests pass (full build, MSVC Release).

Open, not in this PR

  • Under the field, water_deep bed cells keep mu 0.10 (mu_wet 0.10). A car on a lakebed grips only if the raster gives those cells a bed class (mud, gravel, sand), which is a nav raster decision.
  • The dynamic and dynamic4w plants put plain dynamic chassis boxes in the world (dyn_chassis::add). A fluid field would push them with full sealed-box buoyancy. I haven't checked whether their plant overwrites the pose each step.

A generated world reaches the physics the way a loaded city does
(ARIADNE_WORLDS section 18.8, GB2):

- The data store makes datasets as well as fetching them: a request with
  generate: and params: runs a registered generator for its files, which
  decode as a fetched one's do (city_bundle). The built-in generated_world
  makes the world and writes it as a version 2 city bundle, so its world
  is the bundle read back. Documents name one in data: (generate:,
  params:), programs with (data-generate NAME GENERATOR [PARAMS]), hosts
  with register_data_generator. DataStore::put publishes a dataset its
  owner already made.
- A generated_world node publishes each world it makes, headless or drawn,
  as its dataset data.<id>, replaced in place on Regenerate (its rev up),
  and its body is that dataset's world, as a data node's is.
  SceneWorld::generated_world(id) now also answers when a renderer runs
  the node.
- SceneWorld takes a dataset that is already ready when the world is
  built, so its bodies are there from the start.
- cvcGL writes a rebuild's bundle in its world task, off the frame thread.
- city_bundle publishes a version 2 bundle's hash, water level, region
  and generator.
A dataset's node shapes the world the physics and the navigator get
from it, which itself stays whole (ARIADNE_WORLDS section 18.8, GB2):

- region: [min_x, min_y, max_x, max_y] cuts the dataset's world once
  (crop_world_geometry: the terrain to the samples that cover it with its
  cell materials, each mesh to the faces whose centroid is inside with
  their face materials), so its bodies, the walls at its edge and the
  navigator's grid follow one cut. On data nodes and generated_world
  nodes.
- water_level: on a data node, else its dataset's level (a version 2
  bundle's, a made world's), is its one water knob: a still-water fluid
  field (1000 kg/m^3, from 1 m under the lowest ground to the level,
  inertial, so a wading vehicle drives through it) in its world, and the
  grid's water at the same level. A version 1 bundle has no level, so no
  water.
# Conflicts:
#	src/cvc/ariadne/scene_world.cpp
#	src/cvc/tests/ariadne_world_dataset_test.cpp
@transfix
transfix enabled auto-merge (squash) November 20, 2026 19:37
@transfix
transfix merged commit a1b09d0 into master Nov 23, 2026
31 checks passed
@transfix
transfix deleted the feat/gb2-region-water branch November 23, 2026 06:40
transfix added a commit that referenced this pull request Nov 23, 2026
The closed schema lands after the PRs that add loader keys, so it carries
their keys now:

- notifications: always, as well as a flag (#1450);
- a tray_icon's icon: and auth: (#1450);
- a color picker's fmt: rgb | hex (#1452);
- a load:'s name:, a key or an expression that names the application
  (#1485);
- scene: clock: max_lag:, more than 0 and at most 10 s, in the scene and
  in a scene of its own (#1475).

Master's own new keys need none: #1472's look: wheel:, wheelbase: and
track: sit in world:, which the world rules check, and #1399's region: is
a custom node's own key.

AcceptsWhatTheLoaderTakes takes each new form; FindsEachMistakeWhereItIs
finds fmt: cmyk and notifications: sometimes.
transfix added a commit that referenced this pull request Nov 24, 2026
)

* Ariadne: a closed .ari schema every load checks, and ari validate

The .ari document's structure gets a formal definition, roadmap section 15,
now docs/ARIADNE.md section 14:

- src/cvc/ariadne/schema/ari.v1.schema.json: one JSON Schema for every
  top-level block, all 35 built-in widget types, the scene, include: and
  load: sites, with descriptions. Every map is closed: an unknown key is an
  error, except x- keys, a custom widget's or node's own keys, and a block an
  app registered or the document declares in customs:. A widget's type is its
  first type key in the loader's order. It keeps to json-schema-validator's
  draft-7 subset.
- CMake embeds it (CvcEmbedText.cmake) for ari_schema_json() and installs it
  under share/libcvc/ariadne/schema/.
- With the validator built in, every load checks the document, its import:ed
  libraries, its load: fragments and each include: expansion (placed in the
  unit's own file), as warnings and LoadResult::schema_issues with line and
  column. The compiled validators live in a cvc::app slot.
- validate_string / validate_file check without loading, the document's own
  units instantiated with their declared args.
- ari validate [--structural-only] [--strict] [--json] and ari schema.
- ci.yml: package-linux's configure assertion also requires the validator.

All 176 shipped documents are valid; reopen_refit.ari gains its missing
meta.min_libcvc. Five loader tests that feed bad values count the loader's own
warnings and check the schema flags the same pointer. New ariadne_schema_test
and ctests for ari validate and ari schema.

* Ariadne schema: scene: clock: hz, the world's rate

OW8 (#1441) gave the scene's clock an hz key: a whole number of ticks a
second from 10 to 240, as sim_rate_valid takes it. The schema takes it the
same way in both clock entries, and ClockBlockTakesAWorldsRate checks that the
schema accepts hz: 60 and flags each rate the loader warns about.

* Ariadne schema: the hosts' blocks in their short forms

wasm: takes a guest's path alone and relay: a relay's URL alone, as
their readers do; a bare server: or world: sets nothing, as theirs do.
The schema took a map only, so WasmWasiTest's `wasm: all.wat`, under
min_libcvc 3.7.13, failed its load on Linux.

* Ariadne schema: the keys the open PRs add to the loader

The closed schema lands after the PRs that add loader keys, so it carries
their keys now:

- notifications: always, as well as a flag (#1450);
- a tray_icon's icon: and auth: (#1450);
- a color picker's fmt: rgb | hex (#1452);
- a load:'s name:, a key or an expression that names the application
  (#1485);
- scene: clock: max_lag:, more than 0 and at most 10 s, in the scene and
  in a scene of its own (#1475).

Master's own new keys need none: #1472's look: wheel:, wheelbase: and
track: sit in world:, which the world rules check, and #1399's region: is
a custom node's own key.

AcceptsWhatTheLoaderTakes takes each new form; FindsEachMistakeWhereItIs
finds fmt: cmyk and notifications: sometimes.
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