Proto-driven NPCs forbevy_npc
A game-agnostic NPC registry for Bevy — the shared npcdb.proto types wrapped in a searchable NpcDb resource queryable by slug, ULID, type, rarity, or creature family.
One proto, every game
The crate is game-agnostic: any title can load the same proto NPC registry and query it by slug, ULID, type flags, rarity, or creature family.
What it gives you
Features
Proto-driven types
NPC types come from the shared kbve-proto crate rather than a generated copy, keeping the schema in sync across games. Dialogue is referenced by graph ref, not inlined.
Searchable registry
The NpcDb resource is queryable by slug, ULID, type flags, rarity, creature family, or level. With default features off it works without Bevy.
Multiple load paths
Hydrate from the baked registry bytes (from_bytes), the JSON rows (from_json), or a decoded proto (from_proto).
Optional creature feature
Adds ECS components for creature pooling, capture, and interaction (CreaturePoolIndex, CreatureState, CapturedCreatures, CreatureCaptureEvent, CreaturePlugin).
Get started
Usage
use bevy::prelude::*;
use bevy_npc::{BevyNpcPlugin, NpcDb};
fn load_npcs(mut commands: Commands) {
let db = NpcDb::from_bytes(kbve_registry::NPCDB).expect("the NPC registry decodes");
commands.insert_resource(db);
}Questions
Frequently asked
What does the bevy_npc crate do?
It re-exports the shared npcdb.proto types from kbve-proto and wraps them in a searchable NpcDb Bevy resource, so any game can load one proto NPC registry and query it by slug, ULID, type flags, rarity, creature family, or level.
How do you load NPC data into bevy_npc?
Add BevyNpcPlugin to register an empty NpcDb resource, then populate it at startup — normally with NpcDb::from_bytes on the baked registry (kbve_registry::NPCDB in the workspace, https://kbve.com/api/registry/npcdb.binpb outside it), or from the /api/npcdb.json rows with NpcDb::from_json, or a decoded proto with NpcDb::from_proto — and insert it via commands.
What is the optional creature feature?
The creature feature enables game-agnostic ECS components for creature pooling, capture, and interaction — CreaturePoolIndex, CreatureState, CapturedCreatures, CreatureCaptureEvent, and CreaturePlugin.
Discuss on the forum
Questions, fixes and notes on this page live in the KBVE forum.