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


Aggression Types

NPCs have different aggression behaviors:

Aggro Rules


Drop Tables

Each NPC has a DropTable defining loot:

Drop Calculation


Available 3D Models

NPCs use rigged VRM models from /assets/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 Definition


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.