Zones

As you place buildings in your settlement, the game automatically detects zones -- named clusters of buildings with a classification based on their composition. Zones give your settlement structure and identity, helping you and the elves understand the layout at a glance.

Overview

The zone detection system scans all placed buildings and groups them into proximity-based clusters. Each cluster with 2 or more buildings becomes a named zone with a classification (Art Quarter, Residential, Commons, or Mixed). Zones are recalculated periodically and displayed in the UI.

Zone detection is passive -- you do not place zones manually. Instead, zones emerge organically from your building placement decisions. Place a Workshop and a Garden near each other and an Art Quarter appears. Cluster Dwellings together and a Residential district forms.

How It Works

Detection Algorithm

The zone detection system uses proximity clustering with a Manhattan-distance radius of 4 tiles:

  1. Clear existing zones -- zones are recalculated from scratch each time.
  2. Collect all buildings -- every entity with a Position and Building component.
  3. Cluster by proximity -- for each building, check if it falls within Manhattan distance 4 of the center of an existing cluster. If so, add it to that cluster. If not, start a new cluster.
  4. Classify clusters -- only clusters with 2 or more buildings become zones. Single buildings are ignored.
  5. Name zones -- auto-generated from terrain and classification, or overridden by a nearby patron-named location.

The cluster center is computed as the arithmetic mean of all building positions in the cluster. Buildings are processed in order, and each building joins the first cluster whose center is within range (greedy assignment).

Source: src/sim/systems.rs, zone_detection_system -- cluster_radius = 4i32, center computed as sum/count.

Zone Types

Zones are classified based on which building types are present in the cluster:

Zone TypeClassification RuleTypical Use
CommonsContains a Feast HallSocial gathering area
Art QuarterContains both a Workshop AND a GardenCreative district
ResidentialContains 2+ Dwellings (no Feast Hall, not Workshop+Garden)Living quarters
MixedEverything else with 2+ buildingsGeneral-purpose area

The rules are evaluated in priority order:

  1. If the cluster contains a Feast Hall --> Commons (regardless of other buildings).
  2. Else if the cluster contains both a Workshop and a Garden --> Art Quarter.
  3. Else if the cluster contains 2 or more Dwellings --> Residential.
  4. Otherwise --> Mixed.

This means a Feast Hall always dominates the classification. A cluster with a Feast Hall, 3 Dwellings, and a Workshop is still classified as Commons.

Source: src/sim/systems.rs, zone_detection_system -- classification logic with has_feast_hall, has_workshop && has_garden, dwelling_count >= 2.

Building Types Reference

The four building types that participate in zone detection:

BuildingZone InfluenceOther Effects
DwellingResidential (if 2+)Shelter from weather. Faster rest recovery.
WorkshopArt Quarter (with Garden)Composing station. Stimulation boost.
GardenArt Quarter (with Workshop)Beauty +3/tick. Spirit calming -2/dawn.
Feast HallCommons (always)Revel venue. Social gathering point.

Zone Naming

Each zone receives an auto-generated name based on two components:

Terrain prefix (based on the terrain at the zone center):

Terrain at CenterPrefix
AncientForest"The Groveward"
YoungForest"The Verdant"
Meadow"The Sunlit"
Stone"The Hearthstone"
Other"The Central"

Classification suffix:

Zone TypeSuffix
Art Quarter"Atelier"
Residential"Rest"
Commons"Commons"
Mixed"Quarter"

Combined examples:

  • A Workshop + Garden on a Meadow tile: "The Sunlit Atelier"
  • Two Dwellings near an AncientForest tile: "The Groveward Rest"
  • A Feast Hall on a Stone tile: "The Hearthstone Commons"

Patron name override: If the player has placed a Named Location (via the patron naming system) within Manhattan distance 4 of the zone center, that name overrides the auto-generated name entirely. This lets you personalize your settlement districts.

Source: src/sim/systems.rs, zone_detection_system -- terrain prefix match, kind suffix match, named_locations override.

Zone Properties

Each detected zone stores the following data:

FieldTypeDescription
centerPositionArithmetic mean of all building positions in the cluster
radiusu8Always 4 (the cluster detection radius)
kindZoneKindArt Quarter, Residential, Commons, or Mixed
nameStringAuto-generated or patron-overridden name
building_countu32Number of buildings in the zone

Source: src/sim/components.rs, Zone struct.

Values & Formulas

Clustering Math

Two buildings are in the same cluster if:

|building.x - center.x| + |building.y - center.y| <= 4

Where center is the running mean of all buildings already in the cluster. Buildings are assigned greedily -- the first cluster within range absorbs the building. Order of processing can affect which cluster a building joins if it is equidistant from two clusters.

Minimum Cluster Size

A cluster needs >= 2 buildings to become a zone. A single isolated building produces no zone. This means you need at least 2 buildings within Manhattan distance 4 of each other to see any zone appear.

Zone Classification Decision Table

Feast Hall?Workshop + Garden?2+ Dwellings?Result
Yes(any)(any)Commons
NoYes(any)Art Quarter
NoNoYesResidential
NoNoNoMixed

Example Layouts

Minimal Art Quarter: Place a Workshop and a Garden within 4 tiles of each other. No other buildings needed. Result: Art Quarter with building_count = 2.

Minimal Residential: Place 2 Dwellings within 4 tiles. Result: Residential with building_count = 2.

Upgraded Commons: Place a Feast Hall, 2 Dwellings, and a Garden all within a 4-tile cluster. Result: Commons (Feast Hall dominates), building_count = 4.

Split zones: Place a Workshop at (0,0) and a Garden at (10,0). Distance = 10 > 4, so they form separate clusters. Neither cluster has 2 buildings, so no zones are detected. Move them closer (within 4 tiles) to form an Art Quarter.

Interactions

Revels

The Revel system uses zones to determine performance context. Revels happen at the Feast Hall, which is typically the center of a Commons zone. The zone context can influence the flavor of revel events.

Composition

Elves composing in an Art Quarter zone may receive contextual bonuses. The zone's presence near a Workshop affects which elves are drawn to compose there. See Compositions.

Terrain Effects

Zone classification is independent of terrain, but the auto-generated name depends on the terrain at the zone center. Building on different terrain types gives your zones different names and character. See Terrain.

Patron Naming

The patron taste system allows you to name locations on the map. If a named location falls within 4 tiles of a zone center, the zone adopts that name. This is how you personalize your settlement -- name a spot "Luthien's Garden" and any zone that forms near it takes that name.

Cultural Advisor

The Curator considers zones when making building placement decisions. It may prefer to expand existing zones (adding buildings near existing clusters) rather than starting new isolated structures.

Tips

  • Plan your layout with zones in mind. Place your first Workshop and Garden within 4 tiles of each other to create an Art Quarter early. This gives your composers a named creative district.

  • The Feast Hall defines your social center. Any cluster containing a Feast Hall becomes Commons, regardless of other buildings. Place the Feast Hall where you want your settlement's social hub.

  • Separate zones for different purposes. If you want both an Art Quarter and a Residential district, keep them more than 4 tiles apart. Otherwise they will merge into a single cluster and the classification will follow the priority rules.

  • Use patron naming for character. Auto-generated names like "The Sunlit Atelier" are pleasant, but naming a location yourself makes the settlement feel personal. Name a spot before or after buildings appear nearby.

  • Building density matters. A zone with 5 buildings is more robust than one with 2 -- if you remove one building, a 5-building zone survives, but a 2-building zone could drop below the minimum and disappear.

  • Watch for unintended merges. If you build a Dwelling at the edge of your Art Quarter cluster, it gets absorbed and the zone may reclassify. Keep residential buildings at least 5 tiles from your creative district if you want separate zones.

  • Mixed zones are a fallback. If a 2+ building cluster doesn't match any specific pattern, it becomes Mixed. This is fine early on, but you can upgrade a Mixed zone by adding the right building types (e.g., add a Garden to a Workshop cluster to get Art Quarter).

  • Zones are recalculated periodically. They are not permanent. Moving buildings (by demolishing and rebuilding) or adding new ones will change the zone layout on the next detection pass.