Skip to content

cvc::lsys + cvc::world: headless L-system terrain generator - #360

Merged
transfix merged 1 commit into
masterfrom
feat/lsystem-lab-core
Sep 14, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/lsystem-lab-core

Conversation

@transfix

@transfix transfix commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

A GL-free, deterministic, multi-material terrain generator that emits occupancy + material rasters for training/gym consumers (roadmap L0/L1; docs/roadmap/LSYSTEM-LABORATORY-ROADMAP.md). Replaces the dead-end monolithic lsystem_forest demo (single hardcoded mt19937, compile-time grammar, no materials, render-only CLI) with a reusable library.

cvc::lsys — the L-system engine

Hashed noise-based RNG (insertion-stable, no std::mt19937), expression VM, .lsys parser/writer (byte-exact round-trip), parallel + sequential-priority derivation with gen_nested detection, turtle + scope interpreter, stats/svg/off emitters, a built-in recipe library (pine/oak/birch/shrub/boulder/office/house), and the cvc-lsys CLI. cvc-lsys svg pine_monopodial --gen 10 --out t.svg renders a tree you can open in the diff.

cvc::world — the generator + raster seam

The §16.2 32-class surface registry (hard classes carry ρ=0) + 5 outdoor building-shell classes, each tagged with a generic rf_material name from the shared 12-name vocabulary (+ rock); an analytic metre-scaled band-limited heightfield; parameterized, insertion-stable scatter (seed / count / size / species / bounds); grid_spec + raster() → {klass, risk_raw, hard, occupancy, height, layer_owner} in the consumer frame (cell_w=(max-min)/(cols-1), row 0 = min_y); a .npy writer + cvcworld/2 bundle with PNG previews; and the cvc-worldgen CLI. cvc-worldgen build --seed N --preview writes an np.load-able bundle + previews.

Invariants (asserted + tested)

risk_raw==registry[klass].rho, hard==registry[klass].hard, hard ⊆ occupancy, deterministic across repeats/threads; buildings tile into many occupied cells (the many-small-discs physics caveat). cvc::world references no cvc::nav (file seam, not ABI) — enforced at configure time, alongside a no-<random> determinism guard.

Consumers

The raster's occupancy+material feeds a downstream occupancy → obstacles seam; risk_raw+hard feed cvc::nav::material_build for the gym (verified). Consumer-side wiring (rock material, adapter, gym) is coordinated separately and lands after this PR + a version bump.

Tests / CI

78 GoogleTests (ctest -R 'Lsys|World'); new src/cvc/{lsys,world} code ~85% line coverage; the cvc-lsys/cvc-worldgen CLI mains are excluded from the coverage gate (src/cvc/tools/*).

Determinism note: -ffp-contract=off gives per-platform bit-reproducibility and cross-platform-stable content hashes / module counts / ontology hash; raw .npy bytes are reproducible on a fixed toolchain but not asserted bit-identical across libm implementations (scatter/interp route yaw through sin/cos).

A GL-free, deterministic, multi-material terrain generator that emits
occupancy + material rasters for training/gym consumers (roadmap L0/L1;
dbg-technical/21 §5 item 3).

cvc::lsys — the L-system engine: hashed noise-based RNG (insertion-stable,
no std::mt19937), expression VM, .lsys parser/writer (byte-exact round-trip),
parallel + sequential-priority derivation with gen_nested detection, turtle +
scope interpreter, stats/SVG/OFF emitters, a built-in recipe library (pine/
oak/birch/shrub/boulder/office/house), and the cvc-lsys CLI.

cvc::world — the generator + raster seam: the 32-class §16.2 surface registry
(hard classes carry rho=0) + 5 outdoor building-shell classes, each tagged with
a generic rf_material name from the shared 12-name vocabulary (+ rock); an
analytic metre-scaled band-limited heightfield; parameterized, insertion-stable
scatter (seed / count / size / species / bounds); grid_spec + raster() ->
{klass, risk_raw, hard, occupancy, height, layer_owner} in the consumer frame
(cell_w=(max-min)/(cols-1), row 0=min_y); a .npy writer + cvcworld/2 bundle with
PNG previews; and the cvc-worldgen CLI.

Invariants asserted + tested: risk_raw==registry[klass].rho, hard==registry
[klass].hard, hard subset occupancy, deterministic across repeats. cvc::world
references no cvc::nav (file seam, not ABI) — enforced at configure time along
with a no-<random> determinism guard. Buildings tile into many occupied cells
(the many-small-discs physics caveat). 78 GoogleTests; new code ~85% line
coverage; tools excluded from the coverage gate.
@transfix
transfix force-pushed the feat/lsystem-lab-core branch from 8678290 to 042238b Compare September 14, 2026 04:48
@transfix
transfix merged commit 85201c7 into master Sep 14, 2026
13 checks passed
transfix added a commit that referenced this pull request Sep 14, 2026
New minor version carrying the cvc::lsys + cvc::world headless terrain generator
(#360). Bumps project(VERSION) 3.3.0 -> 3.4.0 and every cvcpkg recipe's
upstream_version to match (cvc_revision reset to 1, per the recipe-version gate),
so a libcvc 3.4.0 with cvc::world can be published for the DBG world_scene adapter.
@transfix
transfix deleted the feat/lsystem-lab-core branch October 29, 2026 20:52
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