Skip to content

Unified Entity System Foundation #72

Description

@FirebrickRed

Summary

Create the foundation for a unified NPC/Monster/Entity system that replaces the current split between NPCs and Monsters. All entities (townspeople, merchants, monsters, beasts) use the same underlying system with behavior determined by YAML configuration.

Phase: 1 - Foundation
Systems: Entity System, Core

Prerequisites

None - this is a foundational issue

Goals

  • Create DndEntity data model (replaces separate NpcData/MonsterData)
  • Flexible HP system: hit_dice (roll for variance) OR hit_points (fixed)
  • Random name generation from YAML name pools
  • Name patterns (prefix + name + suffix combinations)
  • Create DndEntityInstance class (template vs spawned entity)
  • Create EntityLoader with recursive DMContent/Entities/ scanning
  • Support single-entity AND multi-entity YAML files (groups)
  • Resource pack model references

HP System Logic

int hp;
if (entity.getHitDice() != null) {
    hp = DiceRoller.roll(entity.getHitDice());  // Roll for variance
} else if (entity.getHitPoints() != null) {
    hp = entity.getHitPoints();  // Use fixed value
} else {
    hp = 10;  // Default fallback
}

Random Name System

id: kobold
name: "Kobold"  # Default fallback

random_names:
  - "Skrix"
  - "Yeek"
  - "Meepo"
  
# Name reuse: If spawning more entities than names available, cycle through pool

File Structure

DMContent/
└── Entities/           (DM can organize however they want)
    ├── town/
    │   ├── blacksmith.yml
    │   └── guard.yml
    ├── wilderness/
    │   └── wolf.yml
    └── my_custom_campaign/
        └── boss.yml

Technical Details

  • Recursive loading: Scan ALL subdirectories under DMContent/Entities/
  • ID-based lookup: Entity id field is what matters, not filename
  • Template pattern: YAML = template, spawned entity = instance
  • DM flexibility: No forced folder structure

Example YAML

id: town_guard
name: "Town Guard"
hit_dice: "2d8+4"  # Variance on spawn
random_names: ["Marcus", "Leon", "Thaddeus"]

armor_class: 16
speed: 30
# ... rest of D&D stats

Next Steps

After completing this issue, tackle:

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions