Add Enemy Skill
Workflow for adding new enemies to the game.
Steps
1. Create Enemy JSON File
Create a new JSON file in data/enemies/[location]/enemy_name.json:
json
{
"id": "enemy_id",
"name": "Enemy Name",
"description": "Description of the enemy",
"ascii_char": "e",
"color": "#FF0000",
"stats": {
"max_health": 20,
"strength": 12,
"dexterity": 10,
"constitution": 10,
"intelligence": 6,
"wisdom": 8,
"charisma": 6
},
"combat": {
"base_damage": 4,
"armor": 0,
"accuracy": 70,
"evasion": 10
},
"behavior": {
"type": "aggressive",
"aggro_range": 8,
"wander_range": 5
},
"loot_table": "enemy_name_loot",
"experience": 25,
"spawn_weight": 10,
"creature_type": "beast"
}
2. Behavior Types
- •
wander- Moves randomly, attacks if player adjacent - •
guardian- Stays near spawn point, attacks intruders - •
aggressive- Actively hunts player within aggro_range - •
pack- Coordinates with nearby allies
3. Create Loot Table (Optional)
If the enemy has unique drops, create data/loot_tables/enemy_name_loot.json:
json
{
"id": "enemy_name_loot",
"entries": [
{"item": "gold", "weight": 50, "min": 1, "max": 10},
{"item": "raw_meat", "weight": 30, "count": 1},
{"item": "leather", "weight": 20, "count": 1}
]
}
4. Verification
- •Restart the game (EntityManager loads on startup)
- •Use debug menu to spawn the enemy
- •Test combat and loot drops
- •Verify AI behavior matches expected type
Key Files
- •
data/enemies/- Enemy definitions (organized by location) - •
data/loot_tables/- Loot table definitions - •
autoload/entity_manager.gd- Loads and spawns enemies - •
entities/enemy.gd- Enemy base class
Creature Types
Available creature types (for resistances/vulnerabilities):
- •
humanoid,beast,undead,construct,elemental,demon,dragon
Check data/creature_types/ for definitions.