Repository navigation
Generated worlds: water by each cell's depth, and a choice of world edge (walls, shore, none) - #1215
Merged
Merged
Conversation
Each terrain cell took its material from one raster sample, its NE corner where the raster and the mesh share samples. On a steep shore that corner can be dry or shallow while the cell is metres deep, so the navigator and the physics took deep water for drivable ground: 151 cells deeper than 0.5 m on world_gym.ari's generated world, the deepest at -1.91 m. The materials stage now classes each cell's water by the mean of its corners against the sea, with derived_class's depths (deep below sea - 0.5, shallow below sea, sand for a dry cell the raster called water). A prop's footprint keeps its own material. Test: WorldGenerated.ACellsWaterIsTheMeshsDepth checks every ungraded cell's class against its mean height.
add_world_geometry adds four static boxes around the rectangle the collide height fields cover (world_bodies::edges): 2 m thick, 1 cm outside the edge, from 20 m below the lowest height to 20 m above the highest. They are not items and not ground, so a vehicle touching one has hit an obstacle. SceneWorld keeps them as the terrain node's bodies, so they go and come with it. world_gym.ari's generated world, seed 1: from agent 1's start (-122.9, -72.6) toward its goal on the west shore, the vehicle slid down the slippery underwater slope and off the west edge in 14 of 18 runs (3 masses x 3 top speeds x nav@1 and world_gym.py's policy). Now 0 of 18; seeds 1-20 under both controllers have no agent out. Tests: PhysicsWorldGeometry.NothingLeavesTheTerrainOverItsEdge (a box sliding at 15 m/s down a mu 0.1 slope stops at the wall; rays down on the edge still meet the terrain) and AriadneWorldGym.AGeneratedWorldsEdgeHoldsAVehicleIn (Humvees flat out at each edge stay in). The body counts of generated and data worlds include the 4 walls.
What is at a generated world's edge is now a choice (generated_world_params::edge, world_edge): - wall (the default): the invisible walls of the previous commit. - shore: a band at the rim (15 % of half, 40-250 m) becomes coast. From the band's inner end the ground eases down to a beach sloping 1 in 50 to the waterline, then under the sea to the island preset's shelf depth at the edge. Ground already lower keeps its bed. It wraps any terrain generator (fbm, dem, registered), lots stay off the shore, and the sea goes on past the world: outer_sea() is a ring at the waterline out 6 km, which cvcGL draws under <id>_water. No walls. - none: the edge is open. world_geometry::edge_walls() says whether add_world_geometry adds the walls; a generated world sets it from its edge (only wall), and every other world_geometry keeps them on. Ariadne: a generated_world node's `edge: wall | shore | none`. pycvc: generate_world's "edge" param, and info()["edge"]. docs/ARIADNE.md describes it. Tests: WorldGenerated.AShoreEdgeLinesTheWorldWithABeachAndTheSea (deep water all round the rim, a sand beach inside it, the relief untouched past the band, the outer sea ring), PhysicsWorldGeometry.TheEdgeWallsCanBeLeftOut, AriadneSceneWorld.AGeneratedWorldsEdgeCanBeAShore, cvcgl_ariadne_realize (the drawn outer sea), test_pycvc_plant_host.py.
Rendered, the shore's blend from the relief to the beach was short enough (about 11 m on a 300 m world) that high ground met the coast as a rock cliff, and the coastline ran dead straight. The band is now 20 % of half (50-300 m), the blend takes its inner half (sea floor to waterline by 25 %, beach to 50 %), and the coastline lies up to 15 % of the band further in by a smooth wobble the seed sets. The edge stays the sea floor and the relief past the band is untouched.
The shore's coast followed the world's square outline, corners and all. It now follows a rounded square, |x|^4 + |y|^4 = half^4 (world_shore_roundness), so the corners curve away into the sea, and its wobble is up to 35 % of the band on longer waves (2.5 and 0.8 bands), for bays and headlands. The square's edge is still the sea floor everywhere and the relief past the band is untouched; the test measures the band from the rounded edge.
…picker) A generated_world node's edge was only its authored `edge:` key, so the terrain lab's World panel could not change it. It is now a world.* key like the preset: world.edge (0 wall, 1 shore, 2 none), seeded from the node, read on Regenerate, and part of the world's signature, so an edit marks the world pending until Regenerate. world_controls.ari has an Edge combo (Wall, Shore, None) after Water level. The walls follow the new world's colliders, and cvcGL draws or empties the outer sea on the swap. pycvc_gl.cars logs it with the other world keys. Tests: AriadneSceneWorld.TheWorldsEdgeIsALiveSetting (seeded 0; 1 waits, then Regenerate makes a shore world with no walls; 0 brings them back) and the loader's world_controls check for the Edge picker. Checked drawn too: an offscreen host switched a walled world to Shore and regenerated it. 711/711 related ctest.
Terrain lab: an Edge picker for the generated world (world.edge)
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
Conflict in src/cvc/world/generated_world.cpp: master's #1203 made the terrain generators each app's own (generators(app), terrainFrom), and #1215 had put the shore edge (shore_terrain) in the old make_terrain. shore_terrain now sits beside terrainFrom, which wraps any app's generator in it, so make_terrain(app, p) and to_world_params(app, p) both get the shore. #1203 also broke code that only feat/world-gym has: its edge and gym tests call generate_world, make_terrain and load_string without an app. They make one first now. cvc-cli's cmd_trace and three ariadne_runtime_test rich-text tests do not build on master itself after #1203. This takes #1225's fix for them line for line, so that #1170 builds; the two merge cleanly either way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the open item from #1202: in world_gym.ari's generated world (seed 1), a vehicle slid through the water off the west edge of the map and left the world.
Base:
feat/world-gym(#1170). The edge walls' tests and theSceneWorldchange build on its gym code. Once #1170 merges, retarget this PR to master.1. Water classes come from each cell's own depth (670d2d5)
Each 2.34 m terrain cell took its material from one raster sample at its NE corner. On a steep shore, that corner can be dry or shallow while the cell under it is metres deep. The navigator and the physics then treated deep water as drivable ground. On world_gym.ari's world, 151 cells more than 0.5 m deep were drivable, the deepest at −1.91 m. Now none are.
The materials stage now sets each cell's water class from the mean height of its four corners, against sea level:
A prop's footprint keeps its own material.
Test:
WorldGenerated.ACellsWaterIsTheMeshsDepth.2. Walls at the terrain's edge (5b7c4bf)
The water fix alone did not stop the slide. Water has low grip (mu 0.3 shallow, 0.1 deep), and nothing held a vehicle at the edge.
physics::add_world_geometrynow adds four static boxes around the rectangle the collide height fields cover (world_bodies::edges):The walls are not items and not ground. A vehicle touching one counts as an obstacle contact (
hit_obstacle).SceneWorldkeeps them as bodies of the terrain node, so they are removed and rebuilt with it. Every user ofadd_world_geometrygets the walls: the scene world,WorldVehicles' dynamic-plant worlds, andplant_host. A heightfield given directly as a body node, or a box ground, gets none.3. A choice of world edge: walls, shore and sea, or nothing (6c58726)
A generated world's
edge(generated_world_params::edge; the node keyedge:; pycvcgenerate_world({"edge": ...})) picks what is at its edge:edgewall(default)shorehalf, 50–300 m) along a rounded-square edge (corners curve into the sea) with a seeded, wandering coastline: the relief eases down to a 1-in-50 beach at the waterline, then under the sea to the island preset's shelf depthworld::outer_sea), under<id>_waternoneThe shore wraps any terrain generator (fbm, DEM or a registered one). Ground already lower than the coast profile keeps its bed, and lots stay off the shore.
world_geometry::edge_walls()says whetheradd_world_geometryadds the walls. A generated world sets it from its edge, and every otherworld_geometrykeeps the walls on.New tests:
WorldGenerated.AShoreEdgeLinesTheWorldWithABeachAndTheSea: deep water all round the rim, a sand beach inside it, the relief untouched past the band, the ring;PhysicsWorldGeometry.TheEdgeWallsCanBeLeftOut;AriadneSceneWorld.AGeneratedWorldsEdgeCanBeAShore;cvcgl_ariadne_realize: the drawn outer sea;test_pycvc_plant_host.py.665 of 665 related ctest pass, now including pycvc_plant_host.
4. Shore shape, from renders (410f53d, 776e1fa)
Rendered offscreen (seed 5, half 300), the first shore had rock cliffs where high ground met a short blend, and a dead-straight square coast. Fixes:
world_shore_roundness4);The square's edge stays the sea floor, and the relief past the band is untouched.
Results
Replaying agent 1 from its original start (−122.9, −72.6) toward its goal on the west shore (−142, −44), across 3 masses, 3 top speeds and both controllers (nav@1 and world_gym.py's policy):
In the 15 runs that do not reach the goal, the vehicle now ends up held at the wall in the water (x ≈ −148) until the 60 s limit.
world_gym seeds 1–20, both controllers: no agent out.
Tests
PhysicsWorldGeometry.NothingLeavesTheTerrainOverItsEdge. A box slides at 15 m/s down a slope with mu 0.1 and stops at the wall.AriadneWorldGym.AGeneratedWorldsEdgeHoldsAVehicleIn. A Humvee driven flat out at each edge stays in the world.