Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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.

Registrymanifold-ai:spawn-rule
Filesdata/spawn_rules/*.ron, *.update.ron, *.final.ron
Sidesserver: only the server loads it
Readsnothing
ContractPopulation, data stage

Entry

A record, written SpawnRule(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe rule’s key, <mod-id>:<path>.
archetypestringyesThe archetype it spawns (manifold:archetype key). An unknown key fails the data stage (DATA010).
categorystringyesIts category (manifold-ai:spawn-category key). An unknown key fails the data stage (DATA010).
weightu32no1Its weight among a spawner’s rules, at least 1.
conditionscondition or NonenoalwaysA condition in the spawn context, also written Condition(..) or Some(..).
densityDensityno6 per region, 12 of its categoryDensity limits per region.
distanceSpawnDistanceno24 to 64 blocksHow far from players it spawns. A PlayerAnchored spawner spawns in the ring between min and max around each player.
persistencePersistencePolicynoAmbientRecorded with the rule; the spawner’s policy decides how the creatures it spawns persist.
herdHerdnoone creature, no squadHow 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 (..).

FieldTypeRequiredDefaultDescription
per_regionu16no6The most creatures of this rule in one interest region.
category_per_regionu16no12The 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 (..).

FieldTypeRequiredDefaultDescription
minf32no24.0At least this far from every player.
maxf32no64.0At most this far from some player.

PersistencePolicy

How a spawner’s creatures persist.

VariantWrittenDescription
AmbientAmbientNever 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.
EncounterEncounterNever 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.
PersistentPersistentSaved 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 (..).

FieldTypeRequiredDefaultDescription
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.
squadstring or NonenononeThe 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.