Skip to content
crates · rust · bevy

Proto-driven map registry forbevy_mapdb

A game-agnostic Bevy crate that compiles mapdb.proto into typed Rust structs and wraps them in a searchable MapDb resource for zones, regions, and world objects.

One proto, every game

It compiles mapdb.proto into typed Rust structs via prost and wraps them in a searchable MapDb resource, so any game can query zones, regions, and world object definitions by slug, ULID, biome, or type.

RustLanguage
0.1.0Version
protoSchema
MITLicense

What it gives you

Features

Proto-driven schema

mapdb.proto compiles into typed Rust structs at build time via prost / prost-build.

Searchable registry

MapDb looks up zones, regions, and world object defs by ProtoMapId, ref, or ULID, and filters zones by biome or type.

Multiple load paths

MapDb::from_json, MapDb::from_bytes (proto binary), and MapDb::from_proto (in-memory MapRegistry).

Game-agnostic

BevyMapDbPlugin registers an empty MapDb; games populate it at startup and insert it as a resource.

Get started

Usage

main.rs
use bevy::prelude::*;
use bevy_mapdb::{BevyMapDbPlugin, MapDb};

fn load_maps(mut commands: Commands) {
    let json = include_str!("path/to/mapdb.json");
    let db = MapDb::from_json(json).expect("Failed to parse map JSON");
    commands.insert_resource(db);
}

Questions

Frequently asked

What does the bevy_mapdb crate do?

It compiles mapdb.proto into typed Rust structs via prost and wraps them in a searchable MapDb Bevy resource, so any game can query zones, regions, and world object definitions by slug, ULID, biome, or type.

How do you load map data into bevy_mapdb?

MapDb parses from three sources — MapDb::from_json for the mapdb JSON artifact, MapDb::from_bytes for a proto binary, and MapDb::from_proto for an in-memory MapRegistry. Insert the result as a Bevy resource during startup.

Is bevy_mapdb tied to a specific game?

No. It is game-agnostic. Any Bevy game can load the same shared proto map registry; BevyMapDbPlugin registers an empty MapDb that the game populates at startup.