Skip to content

generated_world: district cores, graded streets, block-deep lots, procedural buildings - #973

Merged
transfix merged 1 commit into
masterfrom
feat/city-districts-streets-lots
Nov 2, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/city-districts-streets-lots

Conversation

@transfix

@transfix transfix commented Nov 2, 2026

Copy link
Copy Markdown
Owner

The terrain lab's city, rebuilt on libcvc's own street and lot models. It takes ideas from the DBG scene generator (district cores, a street hierarchy, grade-limited streets, lots that back onto each other, core-first fill) and ports none of its code or fitted constants. This also adds the terrain_lab_ari gallery thumbnail.

Streets (generate_roads, all opt-in through road_params)

  • District centres (centres): each centre seeds an arterial cross.
  • A collector class (collector_width, road_segment::kind): an arterial's branches are collectors a block apart, and they sprout the local streets.
  • An urbanity field (density): it packs local streets tighter in the cores (sparse_spacing, sparse_branch) and stops them at the district edges (local_min_urbanity).
  • A grade limit (max_grade): a segment that is too steep turns toward the contour in 15° steps, either way, and is dropped if no turn fits.
  • A no-go mask (blocked): the water. Streets are steered away from the shore or stop there, instead of being cut off afterwards.
  • A parallel check (parallel_gap): a street can't run alongside another a few metres away.
  • prune_roads: trims dead-end stubs.
  • Two fixes that change the default network:
    • Branches are spaced by how far the road has run since its last branch.
    • A road keeps to the field direction it is on. Before, a road on the minor direction turned onto the major one after one step, which striped the classic network with parallel streets one step apart.

Lots (layout_lots, opt-in through site_params)

  • Block depth: a lot reaches back to the middle of its block, so lots on parallel streets back onto each other.
  • A ground check: a lot is dropped for too much relief under it, or for being below the water. A kept lot records its ground range, and buildings stand on the low side.
  • Districts: setbacks and gaps narrow toward a core, down to shared walls. On sparse ground whole street sides are built or left empty, and frontages are jittered.

The city (generate_world)

  • Roads come first, with or without the Austin library. District cores sit on dry, gentle ground with usable land around them.
  • Lots fill from the cores out, a street side at a time, up to buildings. The slider now means something for both city types.
  • Without a library, each lot gets procedural massing: lognormal heights that rise with urbanity, gable-roofed houses outside the cores, and a rare podium tower inside them.
  • Core lots get paved forecourts, and trees and rocks keep off the roads and buildings.
  • Box massing on the scatter's sites, and its painted streets, are gone. In the browser that was towers of 40–78 m on random sites joined by straight streets.
  • The lab's relief is hilly: its median slope is about 33 %, and only a tenth of the land is under 13 %. So the lab allows 35 % grades and 10 m of relief under a lot. On the default world (seed 7), 25 % and 6 m gave 2.3 km of road and 31 buildings; 35 % and 10 m give 5.8 km and the 110 asked for. At half 400 m the same relief is steeper and only 7 buildings fit. The roadmap leaves that to G4 (buildable flats).

Tested (Windows, Release, MSVC 14.44)

  • Unit tests:
    • world_roads_test, 12 tests. New: GradeLimitSteersAlongTheContours, MaskKeepsRoadsOut, HierarchyAndDistricts, PruneTrimsShortStubs.
    • world_sites_test, 14 tests. New: BlockDepthBacksOntoTheStreetBehind, GroundCheckLeavesWetAndSteepLotsEmpty, DistrictsBuildOutTheCores.
    • world_generated_test, 8 tests. New: RoadsFirstCityWithoutALibrary, BuildingsAreBuildingSized (median roof 3–20 m, tallest at most 95 m, bases on dry ground).
    • world_road_mesh_test, world_road_raster_test, world_buildings_test, world_raster_test, ariadne_loader_test (213) and cvcgl_ariadne_realize all pass.
    • The 85 ctest entries matching ariadne|world_|lsys_|cvcgl_|terrain|physics_world|nav_world pass.
  • Renders: arigl renders terrain_lab.ari, and the C++ terrain_lab runs with and without the Austin bundle.
  • Formatting: clang-format 18 was run on the changed files.
  • Not run: the wasm gallery build and browser frame times.

…cedural buildings

The terrain lab's city, rebuilt on our own street and lot models (no code ported from
elsewhere):

- generate_roads gains, all opt-in: district centres (each seeds an arterial cross), a
  collector class, an urbanity field that packs local streets into the cores and fades them
  out at the edges, a grade limit that steers a steep segment toward the contour, a no-go
  mask (the water), a parallel-street check, and prune_roads for dead-end stubs. Branches
  are now spaced by the distance a road has run since its last branch, and a road continues
  along the field direction it is on (a minor-direction road used to turn onto the major one
  after a step, striping the classic network with parallel streets).
- layout_lots gains, opt-in: lots that reach back to the middle of the block, a ground check
  (relief and water) that records each lot's ground range, district-scaled setbacks and gaps
  down to shared walls, whole street sides built or left empty, jittered frontages.
- generate_world is roads-first with or without the Austin library: district cores on dry,
  gentle ground; lots filled from the cores out up to `buildings`; procedural massing
  without a library (lognormal heights rising with urbanity, gable-roofed houses, a rare
  podium tower); paved forecourts in the cores; trees kept off roads and buildings. Box
  massing on the scatter's sites and its painted streets are gone.
- The terrain_lab_ari gallery entry gets a thumbnail; the roadmap records G2/G3's first pass.
@transfix
transfix merged commit 711c89a into master Nov 2, 2026
27 checks passed
@transfix
transfix deleted the feat/city-districts-streets-lots branch November 2, 2026 17:44
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