Spawner system: placed, persisted objects that maintain + respawn creatures (ModernUO-style) #65

Open
opened 2026-07-19 07:40:38 +02:00 by marco · 0 comments
Owner

Replace the removed seed/respawn stub with a real spawner system (ModernUO-style): a placed, persisted Spawner object that maintains N creatures of a given type within an area, respawning them on a timer after death.

Context: #64 made creatures GM-placed + persisted and removed the old seed-at-startup + single-kind factory-respawn stub (it respawned at the map spawn, not where it died — throwaway). This issue is the proper replacement.

Shape (ModernUO-inspired, adapted)

  • A Spawner is a world entity (persisted like creatures) with: creature type(s), max count, spawn radius/area, respawn delay.
  • Each tick (off the hot path), a spawner tops up toward its max: if a spawned creature died and the delay elapsed, spawn a new one at a random walkable tile in its area.
  • Spawners are placed by a GM (e.g. /spawner rat 5 8 = 5 rats, radius 8) and persist — so ambient life survives restarts and regenerates, without the global factory.
  • Creatures remember their spawner (a back-reference) so the spawner knows when to top up; persisted as part of the spawner or the creature.

Definition of Done

  • A GM can place a spawner; it maintains its creature count, respawning after death on its timer.
  • Spawners persist across restart (and their maintained creatures behave correctly after reload — no duplication, no orphans).
  • No global factory / seed-at-startup; ambient population comes only from placed spawners.
  • Unit-tested: top-up logic, respawn timing, persistence round-trip.
Replace the removed seed/respawn stub with a real **spawner system** (ModernUO-style): a **placed, persisted `Spawner` object** that maintains N creatures of a given type within an area, respawning them on a timer after death. Context: #64 made creatures GM-placed + persisted and **removed** the old seed-at-startup + single-kind factory-respawn stub (it respawned at the map spawn, not where it died — throwaway). This issue is the proper replacement. ## Shape (ModernUO-inspired, adapted) - A `Spawner` is a world entity (persisted like creatures) with: creature type(s), max count, spawn radius/area, respawn delay. - Each tick (off the hot path), a spawner tops up toward its max: if a spawned creature died and the delay elapsed, spawn a new one at a random walkable tile in its area. - Spawners are placed by a GM (e.g. `/spawner rat 5 8` = 5 rats, radius 8) and **persist** — so ambient life survives restarts and regenerates, without the global factory. - Creatures remember their spawner (a back-reference) so the spawner knows when to top up; persisted as part of the spawner or the creature. ## Definition of Done - A GM can place a spawner; it maintains its creature count, respawning after death on its timer. - Spawners persist across restart (and their maintained creatures behave correctly after reload — no duplication, no orphans). - No global factory / seed-at-startup; ambient population comes only from placed spawners. - Unit-tested: top-up logic, respawn timing, persistence round-trip.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo#65
No description provided.