Expand description
§bevy_map
Complete 2D tilemap editor and runtime for Bevy games.
This crate provides everything you need to load and render tile-based maps created with bevy_map_editor.
§Quick Start
ⓘ
use bevy::prelude::*;
use bevy_map::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(MapRuntimePlugin)
.add_systems(Startup, load_map)
.run();
}
fn load_map(mut commands: Commands, asset_server: Res<AssetServer>) {
// Load map with hot-reload support
commands.spawn(MapHandle(asset_server.load("maps/level1.map.json")));
}§Features
runtime(default) - Includes map loading and bevy_ecs_tilemap renderingphysics- Adds avian2d collision supporthot-reload(default) - File watching for development
§Crate Structure
This umbrella crate re-exports all bevy_map_* sub-crates:
Modules§
- animation
- Sprite animation system with frame-based animations.
- autotile
- Tiled-compatible terrain auto-tiling system.
- core
- Core data types for representing tile-based maps.
- dialogue
- Branching dialogue tree system.
- neighbors
- Legacy neighbor direction flags for bitmask calculation
- prelude
- Commonly used types and traits.
- runtime
- Runtime map loading and rendering via bevy_ecs_tilemap.
- schema
- Schema validation for entity types.
Structs§
- Animated
Sprite - Component for playing sprite animations
- Animation
Custom Event - Convenience event for custom payloads
- Animation
Def - A single animation definition
- Animation
Particle Event - Convenience event for particle/VFX payloads
- Animation
Sound Event - Convenience event for sound payloads
- Animation
Trigger - A one-shot animation trigger - fires once at a specific time
- Animation
Trigger Event - Event fired when an AnimationTrigger fires (one-shot)
- Animation
Trigger Registry - Registry for custom animation trigger types.
- Animation
Triggered - Entity-scoped event fired when an animation trigger fires.
- Animation
Window - A duration-based animation window - has begin, tick, and end phases
- Animation
Window Changed - Entity-scoped event fired when an animation window changes phase.
- Animation
Window Event - Event fired for AnimationWindow phase changes (duration-based)
- Animation
Window Registry - Registry for custom animation window types.
- Autotile
Config - Configuration for autotiling in a project
- Cell
Info - Information about constraints for a single cell
- Collision
Data - Collision data for a tile or entity
- Color
- Simple RGBA color for terrain visualization (no Bevy dependency)
- Dialogue
- Component marking an entity that has an associated dialogue
- Dialogue
Choice - A player choice option in a dialogue
- Dialogue
Choice Event - Message sent when the player makes a choice
- Dialogue
EndEvent - Message sent when a dialogue ends
- Dialogue
Handle - Component that holds a handle to a dialogue tree asset
- Dialogue
Node - A single node in the dialogue tree
- Dialogue
Plugin - Plugin for dialogue support
- Dialogue
Runner - Current state of an active dialogue
- Dialogue
Tree - A complete dialogue tree with nodes and connections
- Editor
Project - Editor project format - matches what the editor exports
- Entity
Instance - An entity placed in the world
- Entity
Properties - Raw properties from the map editor, accessible by runtime systems
- Entity
Registry - Registry storing entity spawners by type name
- Layer
- A layer (tiles or objects)
- Legacy
Terrain Type - Legacy terrain type for backward compatibility with old 47-tile blob format
- Level
- A level/map containing tiles and entities
- MapCollider
- Marker component for map collision entities
- MapCollision
Plugin - MapEntity
Marker - Marker component for entities spawned from map data
- MapHandle
- Component for loading maps via the Bevy asset system
- MapProject
- A self-contained map project that includes level data and tileset metadata
- MapProject
Builder - Builder for creating a MapProject from separate level and tileset sources
- MapProject
Loader - Asset loader for MapProject JSON files
- MapRoot
- Marker component for the root entity of a spawned map
- MapRuntime
Plugin - Plugin for runtime map rendering
- MapSpawned
Event - Event emitted when a map has been spawned
- Spawn
MapEvent - Event to spawn a map from a Level
- Spawn
MapProject Event - Event to spawn a map from a MapProject with embedded tileset metadata
- Sprite
Animation Plugin - Plugin for sprite animation support
- Sprite
Data - Sprite data with spritesheet reference and animations
- Sprite
Slot - Marker component for sprite slots on entities
- Start
Dialogue Event - Message to start a dialogue (sent via MessageWriter, read via MessageReader)
- Terrain
- A terrain type within a set (e.g., “Grass”, “Dirt”, “Water”)
- Terrain
Brush - Terrain brush state for painting with automatic tile selection
- Terrain
Set - A terrain set attached to a tileset
- Tile
Constraints - Constraints for finding a matching tile (Tiled-style with masks)
- Tile
Properties - Per-tile properties like collision, animation, and custom metadata
- Tile
Terrain Data - Terrain assignments for a single tile’s corners/edges/center
- Tileset
- Tileset configuration - can contain multiple images (Godot-style)
- Tileset
Image - A single image source within a tileset
- Tileset
Textures - Manages loaded tileset and sprite sheet textures for a map
- Wang
Filler - Fills a region with Wang tiles based on constraints
- WangId
- Wang ID using array storage (Tiled-compatible) Color 0 = empty/no terrain Layout: [Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft]
- Window
Tracker - Tracks active animation windows for an entity
Enums§
- Collision
Shape - Collision shape types supported by the editor
- Dialogue
Node Type - Type of dialogue node
- Layer
Data - The data contained in a layer
- Layer
Type - The type of a layer
- Loop
Mode - Animation loop mode
- MapLoad
Error - Error type for map loading failures
- OneWay
Direction - Direction for one-way platforms
- Paint
Target - Represents what the terrain brush is painting
- Physics
Body - Physics body type
- Terrain
SetType - Type of terrain set - determines how tiles are matched
- Trigger
Payload - Payload data for animation triggers and windows
- Value
- Generic property value (JSON-like but typed)
- Wang
Position - Position indices for WangId (clockwise from top) 7|0|1 6|X|2 5|4|3
- Window
Phase - Phase of an animation window
Constants§
- OCCUPIED_
CELL - Sentinel value for cells occupied by multi-cell tiles (but not the base cell)
Traits§
- Animation
Event Ext - Extension trait for registering animation trigger and window types.
- Animation
Trigger Type - Trait for types that can be animation triggers.
- Animation
Window Type - Trait for types that can be animation windows.
- MapEntity
Ext - Extension trait for registering map entities with the Bevy App
- MapEntity
Type - Trait implemented by entities that can be spawned from map data.
Functions§
- apply_
autotile_ to_ region - Apply autotiling to a region of tiles (legacy)
- attach_
dialogues - System that automatically attaches
Dialoguecomponents to entities with dialogue properties - calculate_
bitmask - Calculate the neighbor bitmask for a tile (legacy)
- complete_
sprite_ loads - System that completes sprite setup once assets are loaded
- erase_
autotile - Erase a tile and update autotiling for neighbors (legacy)
- optimize_
bitmask - Apply corner optimization to a bitmask (legacy)
- paint_
autotile - Paint a single tile with autotiling and update neighbors (legacy)
- paint_
terrain - paint_
terrain_ at_ target - Unified terrain painting function that handles corners and edges
- spawn_
map_ project - Spawn a map from a MapProject with proper tileset handling
- spawn_
sprite_ components - System that detects entities with sprite properties and adds Sprite + AnimatedSprite components
- update_
tile_ with_ neighbors - Update a single tile based on its neighbors
Type Aliases§
- Terrain
Id - Terrain color ID (0 = empty/no terrain, 1+ = terrain index + 1)
- Terrain
Type - Type alias for backward compatibility
Derive Macros§
- MapEntity
- Derive macro for creating map entities that can be spawned from EntityInstance data