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’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). | |
category | string | yes | Its category (manifold-ai:spawn-category key). | |
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. |
persistence | PersistencePolicy | no | Ambient | How its creatures persist. Only Ambient is available. |
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. |
Encounter | Encounter | Not available yet (Talos E2): refused at load. |
Persistent | Persistent | Not available yet (Talos E4): refused at load. |
Value forms used here: condition.