Skip to main content

NPC Data Structure

NPCs (Non-Player Characters) and mobs are defined in JSON manifests and loaded at runtime. This data-driven approach allows content to be modified without code changes.
NPC data is managed in packages/shared/src/data/npcs.ts and loaded from world/assets/manifests/npcs.json.

Data Loading

NPCs are NOT hardcoded. The ALL_NPCS map is populated at runtime:

NPC Data Schema

Each NPC has the following structure:

NPC Categories


Movement Types

NPCs have different movement patterns:

Combat System

Aggression Behavior

Mobs use the combat.aggressive flag to determine if they attack players:
  • Aggressive Mobs: Automatically attack nearby players within aggroRange
  • Passive Mobs: Only attack when provoked
  • Level-Based Aggro: Some mobs use levelRange to determine valid targets

Combat Properties


Services System

NPCs can provide services to players:

Service Types


Dialogue System

NPCs can have multi-node dialogue trees:

Example Dialogue Flow


Drop Tables

Each NPC has a DropTable defining loot:

Drop Calculation


Available 3D Models

NPCs use rigged VRM models from the assets repository:

Mob Models

NPC Models


Helper Functions

Get NPC by ID

Get NPCs by Category

Get NPCs by Biome

Get NPCs by Level Range

Check if NPC Can Drop Item


Combat Level Calculation

NPC combat level is calculated from stats:

Spawn Constants

Global spawn settings:

Example NPC Definitions

Hostile Mob (Goblin)

Service NPC (Bank Clerk)


Adding New NPCs

1

Add to JSON Manifest

Add entry to world/assets/manifests/npcs.json
2

Choose or Create Model

Use existing model or generate new one in 3D Asset Forge
3

Restart Server

Server must restart to reload manifests
DO NOT add NPC data directly to npcs.ts. Keep all content in JSON manifests for data-driven design.