Skip to content
crates · rust · bevy

Proto-driven spell registry forbevy_spells

Proto-driven spell definitions for Bevy games — compiles spelldb.proto into typed Rust structs with a searchable SpellDb registry any game can load and query.

One proto, every game

spelldb.proto is the single source of truth — prost-build generates the Rust structs at build time, human-authored Astro MDX content is codegen'd to spelldb-data.binpb, and SpellDb::from_bytes() decodes it at startup.

RustLanguage
0.1.0Version
protoSchema
MITLicense

What it gives you

Features

Proto-driven schema

spelldb.proto is the single source of truth; prost-build generates the Rust spell structs at build time.

Searchable SpellDb resource

Query spells by ref, ULID, school, or rarity.

Binary proto loading

SpellDb::from_bytes() decodes spelldb-data.binpb, the codegen output of the MDX spell catalog.

Game-agnostic

The same registry serves any Bevy game, mirroring the bevy_items item registry.

Committed prost output

src/proto/spell.rs is committed; build.rs only recompiles the proto when BUILD_PROTO=1 is set.

Get started

Usage

Cargo.toml
[dependencies]
bevy_spells = { path = "packages/rust/bevy/bevy_spells" }

Questions

Frequently asked

What does the bevy_spells crate do?

It compiles the shared spelldb.proto schema into typed Rust structs via prost and wraps them in a searchable SpellDb Bevy resource, so any game can load the same spell registry and query it by ref, ULID, school, or rarity.

Where do bevy_spells spell definitions come from?

The spelldb.proto file is the source of truth. Human-authored content lives in Astro MDX files under apps/kbve/astro-kbve/src/content/docs/spelldb, is codegen'd to spelldb-data.binpb, and SpellDb::from_bytes decodes that binary into proto structs at startup.

Is bevy_spells tied to a specific game?

No. It is game-agnostic — any Bevy game loads the same proto spell registry, keeping spell data consistent across the KBVE ecosystem, mirroring the bevy_items pattern.