Home NPC Lifecycle & Ground Loot

NPC Lifecycle & Ground Loot

How wildlife and hostile NPCs die, leave loot in the world, despawn carcasses, and respawn from anchors.

See also: Complete Combat System, Death & Respawn (players).


1. Death flow

When an NPC’s HP reaches 0:

flowchart TD dead[NPC HP = 0] --> loot[Roll loot_table] loot --> piles[Spawn GroundDrop piles near corpse] dead --> carcass[Spawn carcass harvest node if table defines it] dead --> schedule[Queue respawn if respawn.enabled] piles --> ffa[Killer-only window then free-for-all] carcass --> butcher[Timed harvest → meat / hide / etc.] carcass --> ttl[Carcass TTL removes unharvested node] schedule --> wait[Wait delay + optional block_while_corpse] wait --> respawn[Spawn new instance at anchor]

Players pick up piles with the normal interact / pickup path. Butcher harvest uses the resource-node harvest channel (same as other timed nodes).


2. Respawn (per NPC definition)

Authored on the NPC (respawn block) and optionally overridden on a wildlife spawn anchor.

Field Meaning
enabled When false, that def never auto-respawns (bosses, unique encounters, town civilians)
delay_ticks Wait after death (30 Hz ticks) before a new instance may spawn
max_instances_per_anchor Cap on alive instances tied to that anchor
block_while_corpse When true, delay respawn until the carcass is gone (harvested or TTL)

Location: default is the same wildlife spawn anchor (scatter in radius_m). Home position for leash / return is established at spawn.

Population counting uses alive instances only — a death frees a slot; respawn fills up to the cap.


3. Ground drops

Death loot from loot_table.drops becomes GroundDrop entities in the world (not auto-granted to the killer’s inventory).

Rule Behavior
Placement Scatter disk ~0.5–1.5 m around death position
Ownership Killer-only for a short window, then free-for-all
Default FFA delay ~30 s (ffa_delay_ticks ≈ 900 @ 30 Hz)
Despawn Non-permanent piles expire; permanent: true entries persist
Snapshot Included in region world snapshot / AOI views

Pickup validates range and ownership timer. Anyone may take a pile after FFA opens.


4. Carcass / butcher

Separate from ground piles:

  • A carcass resource node appears when the loot table defines carcass harvest outputs (meat, pelt, hide, …).
  • Harvest is a timed channel; products go to the harvester’s inventory.
  • TTL removes unharvested carcasses so the world does not fill with permanent corpses.
  • When block_while_corpse is set, respawn waits for carcass removal.

5. Content map

Asset Role
assets/npcs/*.yamlrespawn Per-def respawn policy
assets/loot/*.yaml Drop tables + carcass harvest rows
assets/world/segments/*.yamlwildlife_spawns Anchors, counts, optional respawn overrides
Content-admin NPCs / Loot / Map Designer editing surfaces

6. Player corpses

Player death uses the same ground carrier ideas (corpse container + FFA) under Death & Respawn. Wildlife lifecycle above is the NPC/hunting path.