Say that a barn belongs beside a farmhouse, and a shrine nowhere near a barracks.
Structure Relations
Spacing is one number, measured against everything at once. It is enough to stop buildings piling up and nothing more — it cannot say that a barn belongs beside a farmhouse, that watchtowers should keep eighty tiles from each other while cottages sit at six, or that a shrine should never share a hillside with a slaughterhouse.
Relations say those things. A rule names something and states a distance, and the generator obeys it.
Where to Author It
| What | Where |
|---|---|
| Label a prefab | Zones → right-click the map → Structure Prefab… → Relations → Labels |
| Add a rule | Same tab, Rules |
| Link two orientations | Same tab, Variant group |
Labels
A label is any word you like — dock, military, sacred, industrial. They exist so a rule can point at a sort of building without naming each one, and so adding a ninth barracks later does not mean editing eight rules.
Labels are lower-cased and de-duplicated when saved, so Dock and dock are the same label.
Rules
| Rule | Meaning |
|---|---|
| Keep away from | This prefab must be at least N tiles from everything matching. |
| Must be near | This prefab may only be placed if something matching is already within N tiles. |
Each rule points at one of four things:
| Target | Example |
|---|---|
| any structure | "keep 30 tiles from anything" — the same job as spacing, said explicitly |
| anything labelled… | "keep 60 tiles from anything military" |
| any kind of… | "keep 40 tiles from any ruin" |
| one particular map… | "must be within 12 tiles of Farmhouse" |
Distances are measured edge to edge between footprints, so one number means the same thing for a 24×24 keep and a 4×4 shed.
Both rules are hard. A site that fails one is refused outright, never merely made less likely — a rule that sometimes puts a shrine next to a slaughterhouse is not a rule.
Placement Passes
"Must be near" can only see structures that are already standing. A barn looking for a farmhouse finds nothing if the farmhouses have not been placed yet.
So every prefab has a placement pass, and they run in order, lowest first. Put the farmhouse in pass 0 and the barn in pass 1, and the barn will find one.
The editor checks this when you save: a "must be near" rule pointing at something in the same pass or a later one is refused with a message telling you which number to use. Without that check the barn would simply never appear, which looks identical to every other reason nothing spawned.
Settlement buildings are placed before everything else, so they are always available as targets.
Variant Groups
A stamped prefab cannot be rotated — see Water & Crossings — so a structure that needs to face more than one way is drawn more than once. A variant group makes those copies behave as a single thing:
- one most per map shared across all of them
- the strictest spacing in the group applied to every member
- every member inherits every member's relation rules
Groups are useful beyond orientation. Three cottage variants that each carried their own limit made "at most six cottages" impossible to say; in a group, it is one number.
Gotchas
> "Must be near" beats spacing, on purpose. A barn told to sit within twelve tiles of a farmhouse that keeps forty tiles of its own space would otherwise be impossible to place. Where you have named something explicitly, the general spacing rule stands aside for that pair.
> "Must be near" with nothing to be near places nothing. That is deliberate — a barn without a farmhouse should not be built. The editor refuses to save a rule pointing at something that does not exist yet.
> A prefab cannot be kept away from itself. Use its spacing for that.
> Labels are saved with the prefab, rules are saved as you add them. Adding a label and closing without saving loses it; adding a rule takes effect immediately.
> Check the log. Every relation rule reports its own refusals by name — a line reading near:prefab:farmhouse=180 tells you exactly which rule is the tight one.
> Studio or Enterprise tier, like the rest of map generation.