// Active development diary for Urban Sprawl
This is the biggest single change to Urban Sprawl's renderer since the project began. We ripped out the entire procedural generation pipeline, rebuilt the terrain system from scratch, and added real geographic features — rolling hills, coastal shores, river valleys, islands, and plateaus. The city no longer floats on a flat plane; it sits on the land.
After the initial implementation, we had a nasty periodic stutter — the game would freeze for ~200ms every couple of seconds. The root cause was terrain mesh regeneration. Every time a building spawned (which sets the terrain dirty flag), the system would regenerate the entire terrain mesh: 1,001,001 vertices, each requiring ~27 Perlin noise evaluations plus an O(N) scan through every terrain modification region.
Three changes eliminated the stutter entirely:
apply_at() now only checks nearby regions instead of scanning every region for every vertex
After shipping the terrain shader, every map looked brown instead of green. The culprit: WGSL's smoothstep()
is undefined when the low edge ≥ high edge. Several of our smoothstep calls had reversed arguments
(e.g., smoothstep(0.25, 0.15, x)), which returned garbage values on most GPUs.
The grass slope weight was always ~0, so dirt dominated everywhere. Fixed by rewriting all weight calculations
with correct argument ordering.
src/procgen/ directory (14 files) — the old procedural city generation pipelinesrc/world/HeightfieldCache resource patternrebuild_heightfield_cache_on_config_change system to keep cache synchronized when map size changesA 4-week focused sprint to push Urban Sprawl's visuals from "tech demo" to "cinematic." Added quality tier presets (Low/Medium/High via Shift+F10), a first-person walk camera, procedural sky atmosphere, screen-space reflections for wet surfaces, PBR glass, and a full cinematic polish pass with SSAO, film grain, vignette, and auto-exposure.
A 7-phase performance initiative to scale the city from a single 1km² sandbox to Cities: Skylines 2-scale maps. Introduced world chunk streaming (250m chunks), entity pooling, macro simulation for dormant chunks, traffic CA partitioning, and configurable map sizes from 500m to 7.5km.