Skip to content

NPC Spawn Rules

Overview

Spawn rule files link NPC roles to world locations and conditions. The system has three spawn mechanisms: Beacon spawns manage dynamic spawn points tied to environment tags with lifecycle controls; World spawns are simpler tables tied to environment tags and optional day-time windows; Marker spawns are placed directly in the world and reference specific NPC names with respawn timers.

File Location

  • Assets/Server/NPC/Spawn/Beacons/**/*.json — Beacon-driven spawners
  • Assets/Server/NPC/Spawn/World/**/*.json — World environment spawners
  • Assets/Server/NPC/Spawn/Markers/**/*.json — Placed marker spawners
  • Assets/Server/NPC/Spawn/Suppression/**/*.json — Spawn suppression volumes

How NPC Spawning Works

flowchart TD;
A[World Loads Chunk] --> B{Check Spawn Sources};
B --> C[Beacon Spawns];
B --> D[World Spawns];
B --> E[Marker Spawns];
C --> F["Environment<br>Matches?"];
F -->|"Yes"| G["Player in<br>Range?"];
F -->|"No"| Z[Skip];
G -->|"Yes"| H["Light Level<br>OK?"];
G -->|"No"| Z;
H -->|"Yes"| I[Select NPC by Weight];
H -->|"No"| Z;
D --> J["Environment<br>Matches?"];
J -->|"Yes"| K["DayTimeRange<br>OK?"];
J -->|"No"| Z;
K -->|"Yes"| L[Select NPC by Weight];
K -->|"No"| Z;
E --> M["Player Near<br>Marker?"];
M -->|"Yes"| N["Respawn Timer<br>Ready?"];
M -->|"No"| Z;
N -->|"Yes"| O[Spawn Specific NPC];
N -->|"No"| Z;
I --> P["MaxSpawnedNPCs<br>Reached?"];
P -->|"No"| Q[Spawn NPC];
P -->|"Yes"| Z;
L --> Q;
O --> Q;
Q --> R["Flock<br>Defined?"];
R -->|"Yes"| S["Spawn Group<br>Size: min-max"];
R -->|"No"| T[Spawn Single NPC];
style A fill:darkgreen,color:white;
style Q fill:rebeccapurple,color:white;
style Z fill:darkred,color:white;

Suppression Zones

flowchart LR;
A["NPC Tries to Spawn"] --> B["Inside Suppression<br>Volume?"];
B -->|"No"| C[Spawn Allowed];
B -->|"Yes"| D["NPC Group in<br>SuppressedGroups?"];
D -->|"No"| C;
D -->|"Yes"| E[Spawn Blocked];
style C fill:darkgreen,color:white;
style E fill:darkred,color:white;

Schema

Beacon Spawn

FieldTypeRequiredDefaultDescription
Environmentsstring[]YesEnvironment tag IDs where this beacon is active.
NPCsarrayYesList of NPC entries (see NPC entry table below).
MinDistanceFromPlayernumberNoMinimum distance from the player to spawn, in blocks.
MaxSpawnedNPCsnumberNoMaximum live NPCs this beacon will maintain.
ConcurrentSpawnsRange[number, number]NoMin/max NPCs to spawn in a single spawn event.
SpawnAfterGameTimeRange[string, string]NoISO 8601 duration range before the first spawn (e.g. ["PT20M", "PT40M"]).
NPCIdleDespawnTimenumberNoSeconds an idle NPC persists before despawning.
BeaconVacantDespawnGameTimestringNoISO 8601 duration — how long a vacant beacon waits before despawning.
BeaconRadiusnumberNoRadius of the beacon’s managed area, in blocks.
SpawnRadiusnumberNoRadius within which NPCs are spawned, in blocks.
TargetDistanceFromPlayernumberNoIdeal spawn distance from the player.
LightRangesobjectNoBlock light level constraints, e.g. { "Light": [0, 2] }.

World Spawn

FieldTypeRequiredDefaultDescription
Environmentsstring[]YesEnvironment tag IDs where this spawn table is active.
NPCsarrayYesList of NPC entries (see NPC entry table below).
DayTimeRange[number, number]NoIn-game hour range when spawning is allowed, e.g. [6, 18] for daytime only.

Marker Spawn

FieldTypeRequiredDefaultDescription
ModelstringYesThe marker model ID (typically "NPC_Spawn_Marker").
NPCsarrayYesList of NPC entries (see NPC entry table below).
ExclusionRadiusnumberNoOther markers within this radius will not also spawn, in blocks.
RealtimeRespawnbooleanNofalseIf true, NPCs respawn on a real-time timer.
MaxDropHeightnumberNoMaximum distance above the ground the NPC can be placed.
DeactivationDistancenumberNoDistance from player at which this marker stops simulating, in blocks.

Suppression Volume

FieldTypeRequiredDefaultDescription
SuppressionRadiusnumberYesRadius of the suppression zone, in blocks.
SuppressedGroupsstring[]YesNPC group IDs suppressed within this zone (e.g. ["Aggressive", "Passive"]).
SuppressSpawnMarkersbooleanNofalseIf true, also suppresses spawn markers within the zone.

NPC Entry (used in NPCs array)

FieldTypeRequiredDefaultDescription
Id / NamestringYesRole ID of the NPC to spawn. Beacons use Id; markers use Name.
WeightnumberNoRelative spawn weight when selecting from multiple candidates.
Flockstring | objectNoFlock group ID (string) or inline flock size spec { "Size": [min, max] }.
SpawnBlockSetstringNoBlock set tag the NPC must spawn on (e.g. "Volcanic", "Portals_Oasis_Soil").
SpawnFluidTagstringNoFluid tag required near the spawn point (e.g. "Water").
RealtimeRespawnTimenumberNoSeconds before this NPC respawns (marker spawns).
SpawnAfterGameTimestringNoISO 8601 duration before this entry becomes eligible (e.g. "P1D").

Examples

Beacon spawn (cave goblins)

{
"Environments": ["Env_Zone1_Caves_Goblins"],
"MinDistanceFromPlayer": 15,
"MaxSpawnedNPCs": 3,
"ConcurrentSpawnsRange": [1, 2],
"SpawnAfterGameTimeRange": ["PT20M", "PT40M"],
"NPCIdleDespawnTime": 60,
"BeaconVacantDespawnGameTime": "PT15M",
"BeaconRadius": 50,
"SpawnRadius": 40,
"TargetDistanceFromPlayer": 25,
"NPCs": [
{ "Weight": 60, "SpawnBlockSet": "Volcanic", "Id": "Goblin_Scrapper" },
{ "Weight": 20, "SpawnBlockSet": "Volcanic", "Id": "Goblin_Lobber" },
{ "Weight": 20, "SpawnBlockSet": "Volcanic", "Id": "Goblin_Miner" }
],
"LightRanges": {
"Light": [0, 2]
}
}

World spawn (oasis animals, daytime only)

{
"Environments": ["Env_Portals_Oasis"],
"NPCs": [
{
"Weight": 15,
"SpawnBlockSet": "Portals_Oasis_Soil",
"SpawnFluidTag": "Water",
"Id": "Flamingo",
"Flock": "Group_Small"
},
{
"Weight": 10,
"SpawnBlockSet": "Portals_Oasis_Soil",
"Id": "Tortoise"
}
],
"DayTimeRange": [6, 18]
}

Marker spawn (bear, real-time respawn)

{
"Model": "NPC_Spawn_Marker",
"NPCs": [
{
"Name": "Bear_Grizzly",
"Weight": 100,
"RealtimeRespawnTime": 420
}
],
"ExclusionRadius": 20,
"RealtimeRespawn": true,
"MaxDropHeight": 4,
"DeactivationDistance": 150
}

Suppression volume

{
"SuppressionRadius": 45,
"SuppressedGroups": ["Aggressive", "Passive", "Neutral"],
"SuppressSpawnMarkers": true
}
  • NPC Roles — Role files referenced by Id / Name in spawn entries
  • NPC Groups — Group IDs used in Flock and suppression
  • NPC Attitudes — How spawned NPCs relate to each other