data/spawn_rules/
A spawn rule: what spawns, how often relative to other rules, where, and under which conditions (grass under open sky, at least 24 blocks from every player). Spawners name the rules they use. A rule may spawn a herd that forms a squad. A rule’s conditions are gameplay conditions in the spawn context, with the spawn atoms (manifold:surface_block, manifold:sky_light); the block a manifold:surface_block atom names must exist (DATA010). Loaded by the server only.
| Registry | manifold-ai:spawn-rule |
| Files | data/spawn_rules/*.ron, *.update.ron, *.final.ron |
| Sides | server: only the server loads it |
| Reads | nothing |
| Contract | Population, data stage |
Entry
A record, written SpawnRule(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The rule’s key, <mod-id>:<path>. | |
archetype | string | yes | The archetype it spawns (manifold:archetype key). An unknown key fails the data stage (DATA010). | |
category | string | yes | Its category (manifold-ai:spawn-category key). An unknown key fails the data stage (DATA010). | |
weight | u32 | no | 1 | Its weight among a spawner’s rules, at least 1. |
conditions | condition or None | no | always | A condition in the spawn context, also written Condition(..) or Some(..). |
density | Density | no | 6 per region, 12 of its category | Density limits per region. |
distance | SpawnDistance | no | 24 to 64 blocks | How far from players it spawns. A PlayerAnchored spawner spawns in the ring between min and max around each player. |
persistence | PersistencePolicy | no | Ambient | Recorded with the rule; the spawner’s policy decides how the creatures it spawns persist. |
herd | Herd | no | one creature, no squad | How many spawn together, and the squad they form. |
Example
From game/flagship-game/data/spawn_rules/boar.ron:
SpawnRule(
id: "flagship-game:spawn/boar_meadow",
archetype: "flagship-game:boar",
category: "flagship-game:cat/creature",
weight: 10,
conditions: All([
Ext(atom: "manifold:surface_block", args: (block: "flagship:grass")),
Ext(atom: "manifold:sky_light", args: (at_least: 8)),
]),
density: (per_region: 6, category_per_region: 12),
distance: (min: 24.0, max: 64.0),
persistence: Ambient,
)
Types
Density
A rule’s density limits.
A record: Density(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
per_region | u16 | no | 6 | The most creatures of this rule in one interest region. |
category_per_region | u16 | no | 12 | The most creatures of its category in one region, for this rule. |
SpawnDistance
How far from players a rule spawns, in blocks.
A record: SpawnDistance(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
min | f32 | no | 24.0 | At least this far from every player. |
max | f32 | no | 64.0 | At most this far from some player. |
PersistencePolicy
How a spawner’s creatures persist.
| Variant | Written | Description |
|---|---|---|
Ambient | Ambient | Never saved: gone after a restart and spawned afresh; despawn by distance. Counted by the local, region and ambient caps, and gated by the manifold:do-ambient-spawning game rule. |
Encounter | Encounter | Never saved and never despawned by distance; the spawner’s own state is saved, so a Points spawner restores its creatures after a restart. Counted by the space’s encounter ceiling (manifold:encounter-ceiling) and gated by manifold:do-encounter-spawning. |
Persistent | Persistent | Saved and restored exactly. Counted only by the spawner’s max_alive; no game rule gates it. |
Herd
A herd: members spawn on hidden, standable cells beside the first, each counted by the caps, and the first leads.
A record: Herd(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
size | (u8, u8) | no | (1, 1) | How many spawn together, (min, max) with 1 ≤ min ≤ max ≤ 16, drawn each time within what the spawner may still start. |
squad | string or None | no | none | The squad the members form (manifold-ai:squad key), created with them at its initial style. An unknown key fails the data stage (DATA010). |
Value forms used here: condition.