Procedural buildings began as an authoring question: could a player paint a parcel and receive a coherent structure instead of placing every wall? That prototype eventually grew into something more demanding. A generated house had to use the normal renderer, derive real material costs, survive saving and loading, sit on prepared ground, accept Builder labor, and become a residence that NPC needs and family systems could trust.

At the same time, the Zones tool was becoming a shared language for city intent. Labor zones told Loggers, Miners, and Farmers where work belonged. Storage and Dump zones organized logistics. Residential zones added a new promise: describe the district, then let the settlement turn that policy into homes. This is the story of connecting those two lines of development.

Persistent procedural Empires construction home with stone walls, timber framing, windows, a door, and villagers nearby
A generated construction home in the real settlement. This persistent Residential home is linked to its procedural definition, plot, construction state, and future household through stable identities.
Neighborhood pipeline

One boundary, many coordinated systems

Each stage produces stable state for the next one instead of skipping directly from painted terrain to a finished prop.

  1. PaintStore exact 16×16 cells and a persistent zone identity.
  2. PartitionCreate connected, exterior-fronted plots from a revisioned policy.
  3. ClaimReserve one plot atomically for an eligible household.
  4. GenerateClone the frozen profile into a deterministic building definition.
  5. ConstructPrepare terrain, deliver materials, install them, and perform labor.
  6. LiveActivate the residence and reconcile its household and save state.
The player draws intent. The simulation carries that intent through a reviewable sequence of planning, work, and activation.

01. Paint policy, not individual objects

The shared Zones sidebar deliberately opens in a neutral state; opening a planning panel should not arm a terrain brush by surprise. After choosing Logger, Miner, Farmer, Storage, Dump, or Residential, the player paints exact 16×16 world cells. Left drag adds cells, right drag removes them, and fast strokes use supercover sampling so pointer gaps do not become holes. Shift plus the mouse wheel changes an odd-sized square brush from 1×1 to 25×25. A terrain-conforming preview distinguishes valid additions, removals, and conflicts before committing them.

Under the overlay, a zone is a stable ID, ownership, settings, and a sparse set of occupied cell keys—not a dense rectangle around everything the player touched. Separate occupancy indexes make the layers composable. Two Residential zones cannot claim the same cell, but Residential may overlap Labor or Logistics because they express different policies. The same ground can say “harvest here,” “store here,” and “plan homes here” without merging those systems into one ambiguous mask.

Wide Empires settlement view with the shared Zones sidebar listing Logger, Miner, Farmer, Storage, Dump, and Residential tools with visibility controls
One editor, several policy layers. This real validation capture shows Labor, Storage, Dump, and Residential tools together, each with its own visibility control, as the first Residential cell is placed inside an active settlement.

02. Give generation architectural rules

The first procedural workflow already supported a painted area, Generate, Regenerate, Confirm, Cancel, deterministic seeds, background work, and revision checks. A later constraint-driven medieval experiment explored massing, façades, access graphs, supports, roofs, repair, and fallback. That research was valuable, but it is not the current generator. Native Building Generator V2 replaced the earlier schemas with a ShapeTree-based implementation and became the foundation that later Residential work uses.

V2 grows deterministic room, corridor, and junction primitives into a connected topology. FreeForm and SplitForm are Shape Grid modes: FreeForm grows an organic connected graph, while SplitForm divides the selection’s bounding grid into slots clipped to the painted union. Upper floors retain complete supported primitives rather than approving a few overlapping points and leaving floating fragments. Exterior contours and courtyard holes remain explicit through triangulation, while parcel containment is audited after the final placement transform.

One refinement removed a subtle directional bias: the generator now chooses among eight directions from authored weights before choosing a frontier cell within that direction. With an 11-to-1 candidate imbalance and equal weights, validation produced 65,392 selections against 65,680, showing that extra frontier cells no longer multiplied a direction’s probability.

Plan Source area, ShapeTree, floor topology, contours, holes, seed, profile, and rotation.
Structure Floors, walls, columns, wall supports, roof supports, and roof underwalls.
Openings Doors, windows, frames, and arches solved against actual wall capacity.
Finish Component materials, authored texture templates, UV scale, atlas identity, and LODs.

Late playtests pushed those categories from optional decoration into integrity rules. Exterior convex corners require posts; requested supports between adjacent windows must fit; roof-underwall runs require outward frames. If mandatory structure cannot fit inside the permitted envelope, generation retries a different deterministic topology instead of quietly returning an incomplete house.

03. Compile for the real runtime

Authoring keeps floors, components, and finishes separate because those distinctions make validation possible. Runtime compilation consolidates them. Each building receives one deterministic texture atlas and one indexed mesh section for each of four independently owned LODs. Safe coincident vertices are welded while material boundaries, hard normals, UV charts, and shading changes stay separate. The existing runtime-building pass chooses an LOD and submits it through the normal renderer; there is no special Residential render pipeline.

Finishes are gameplay data too. A shared resolver covers all 13 emitted component families, resolving selected building items or Fixed Texture finishes through the authored texture catalog. Unifying that path fixed a real saved-world failure where 14 homes referred to the same historical all-zero texture and appeared blank or flat. The recovery replaced only that exact legacy signature, preserved intentional transparency, and restored recognizable masonry, timber, and roof surfaces on all 14 homes.

Geometry also becomes an economic estimate. A shared resolver measures component-scaled volume, weights a wall more than a frame, aggregates by material, and rounds once. At 409.6 cubic world units per item, it is a balance model rather than a real bill of materials, but it gives Builders deterministic requirements for the structure.

04. Turn a zone into viable plots

Residential planning no longer asks the player to press a Generate button. Painting, resizing, changing plot policy, or loading a zone queues layout work automatically. The worker snapshots the zone and policy revisions, coalesces repeated edits, and discards a result if the source changed while it was running. The previous valid layout stays visible until its replacement is ready, and household claims pause while the plan is stale.

A valid layout must cover every zone cell exactly once, contain no overlap or holes, keep every plot cardinally connected, and give each plot frontage on the zone’s original exterior. Current controls express frontage-relative Width and Length ranges, defaulting to 5–9 cells in each dimension with a hard minimum of three. Minimum violations wait for more cells; an unavoidable maximum overflow remains usable and is reported as a best-effort result. Ordinary regeneration preserves valid claimed metadata, while plots linked to real buildings survive algorithm migrations as immutable anchors.

Earlier Empires Residential integration checkpoint with highlighted plots, varied procedural homes, a scrollable plot list, and a pale free-plot preview
An earlier plot-inspection checkpoint. The Plots tab exposes stable rows and plot state. Later work superseded the pale free-plot preview shown here: free previews now use exact finished presentation, while pale overlays mark persistent construction.

05. Give a household one authoritative plan

Once per second, independently of any open inspector, the scheduler looks for living adult humans from the same city who do not already have a home. Reciprocal married partners are reserved atomically and scheduled before singles. A global reservation set prevents two Residential zones from claiming the same person; a failed generation or placement rolls back the complete household and backs off before trying again.

A successful claim deep-clones the zone’s frozen Building Generator profile, selected material palette, and resident capacity. The plot is the structural envelope, while the chosen building footprint remains the source area inside it. That distinction leaves room for corner posts, window supports, and outward roof frames without crossing into a neighbor’s parcel. Preferred rotation uses the exact authored angle; free rotation evaluates a seeded golden-angle sequence of deterministic non-grid candidates, then solves the main door’s facing toward the zone center.

06. Let Builders make the plan real

The future-home preview is presentation only. Before a persistent site can exist, the game transforms the generated outer footprint, subtracts holes, keeps only intersecting 16×16 cells, and adds a clipped one-cell apron where ground-floor supports require it. Builders flatten the resulting terrain first. Shared vertices between nearby foundations are planned as one transitive component so preparing a later house cannot leave an earlier neighbor floating.

The exact prepared definition then becomes a normal construction site. Builders reserve, collect, carry, stage, and install required items through the existing inventory system, then perform labor. Residential work is at least 50 seconds and otherwise two seconds per unique occupied floor cell. Every new Residential home passes through this state, even when its fixed finishes have no material cost. The claimant receives an active home link only after activation, so an unfinished shell cannot satisfy Rest or enable Reproduction early.

Empires settlement with seven persistent procedural homes displayed in the pale construction overlay while villagers work nearby
A neighborhood under construction. Opening the shared Building menu can select all persistent sites at once. The pale overlay marks real construction objects, not temporary preview duplicates.
Close view of a procedural Empires house in a disposable validation clone showing corner posts, a support between windows, roof-underwall frames, stone walls, and timber finishes
Structure survives the handoff. The exact-save review verified four corner supports, one support between adjacent windows, and four roof-underwall frames on this generated home.

07. Test the complete chain

Focused validators answer narrow questions: deterministic generation, topology, exact plot coverage, material conservation, identity, save/load, terrain support, or Builder activation. Visible scenarios then exercise the real Conquest scene, UI, renderer, inputs, and saved worlds. Native V2’s reviewed authoring session completed 212 of 212 steps. A current large-zone fixture turned 10,000 cells into 28 plots in about 318 milliseconds. The foundation-handoff scenario passed 58 of 58 steps, 59 of 59 recorded actions, and 33 of 33 assertions across seven unique homes with no duplicates or blocked orders.

The most useful results came from the failures between those checkpoints. Manual sessions found saved homes with blank textures, prepared definitions being regenerated after Terraforming orders disappeared, incomplete structural supports, interaction bubbles anchored at sprite-era heights, clipped controls, and confusing rotation behavior. Each fix narrowed the gap between “a generator produced triangles” and “the player can plan, inspect, build, inhabit, save, and reopen a believable district.”

28 Connected plots generated from a 10,000-cell Residential fixture.
14/14 Historical blank-texture homes repaired and rendered with authored finishes.
7/7 Identity-stable homes grounded and handed to persistent construction.
53/53 Actions completed in the latest focused Residential UI scenario.

The red results stay in the record. Functional, lifecycle, and screenshot gates passed; formal semantic gates passed where recorded, and the structural and bubble frames passed documented full-resolution review. The strict zero-miss 4K frame-pacing gate did not pass: sessions recorded repeated samples below 60 FPS or above the render-time ceiling. Two broad aggregate validators also retain older roof/ShapeTree triangulation fixture failures, although the newer envelope, support, grounding, and focused scenarios passed. Those are open engineering constraints, not details to hide behind a successful screenshot.

Procedural Empires home in a disposable validation clone with two NPC Rest-interaction indicators positioned above its roof
The last meter matters. In this disposable clone, nonpersistent NPC fixtures exercise grouped Rest. Their indicators use the transformed runtime roof height instead of a fixed sprite-era height; they are not verified residents.

08. Keep the result and the limits visible

Empires can now turn a painted Residential boundary into revisioned plots, reserve those plots for households, generate varied and supported homes, prepare exact foundations, derive material requirements, enlist Builders, activate residences, render them through the normal LOD path, and restore their identity from a save. The player plans a neighborhood; the city has to build it.

The system is still intentionally conservative. Residential generation is globally serialized for deterministic terrain and persistence work. Maximum plot dimensions are best effort on difficult shapes. Zone and plot eye settings are session-only. Exact roofs remain one of the heavier CPU paths, the reviewed work does not establish playable interiors, and strict every-frame performance acceptance remains open. These boundaries define the next useful work.

A procedural neighborhood is successful when its buildings stop behaving like generated props and start participating in the same rules as the people, resources, terrain, and history around them.

For the people who claim and construct these homes, read Developing NPC AI in Empires. For the wider journey from the 2D prototype to the current world, read Building Empires. You can also visit the Empires product page.