A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile.
- A tile per entity
- Fast rendering using a chunked approach.
- Layers and sparse tile maps.
- Isometric and Hexagonal tile maps
Support for isometric and hexagon renderingdone Built in animation support.done see animation example
- Texture array support
Layers and add/remove tiles. (High Priority)done
let texture_handle = asset_server.load("tiles.png"); let material_handle = materials.add(ColorMaterial::texture(texture_handle)); // Create map entity and component: let map_entity = commands.spawn().id(); let mut map = Map::new(0u16, map_entity); // Creates a new layer builder with a layer entity. let (mut layer_builder, _) = LayerBuilder::new( &mut commands, LayerSettings::new( UVec2::new(2, 2), UVec2::new(8, 8), Vec2::new(16.0, 16.0), Vec2::new(96.0, 256.0), ), 0u16, 0u16, ); layer_builder.set_all(TileBundle::default()); // Builds the layer. // Note: Once this is called you can no longer edit the layer until a hard sync in bevy. let layer_entity = map_query.build_layer(&mut commands, layer_builder, material_handle); // Required to keep track of layers for a map internally. map.add_layer(&mut commands, 0u16, layer_entity); // Spawn Map // Required in order to use map_query to retrieve layers/tiles. commands.entity(map_entity) .insert(map) .insert(Transform::from_xyz( -128.0, -128.0, 0.0 )) .insert(GlobalTransform::default());
use bevy_ecs_tilemap::prelude::*; to import commonly used components, data structures, bundles, and plugins.
A component that stores information about a specific chunk in the tile map.
Chunk specific settings.
A component that is attached to a Tile entity that tells the GPU how to animate the tile. Currently all frames must be aligned in your tilemap.
A component which keeps information and a cache of tile/chunk entities for convenience.
Useful for creating and modifying a layer in the same system.
A bevy bundle which contains: Map, Transform, and GlobalTransform components.
Various settings used to define the tilemap.
A simple component used to keep track of layer entities.
MapQuery is a useful bevy system param that provides a standard API for interacting with tiles. It’s not required that you use this, but it does provide a convenience. Note: MapQuery doesn’t directly change tile components. This is meant as a feature as you may have your own tile data attached to each tile and a standard tile query wouldn’t pull that data in.
A component that represents the basic tile information.
The standard tile bundle.
A component containing the tiles parent information.
Adds the default systems and pipelines used by bevy_ecs_tilemap.
The tilemap stage which runs before post update.
Different hex coordinate systems. You can find out more at this link: https://www.redblobgames.com/grids/hexagons/
Different iso coordinate systems.
General errors that are returned by bevy_ecs_tilemap.
The type of tile to be rendered, currently we support: Square, Hex, and Isometric.
This trait is used to allow the layer builder to access specific information inside of the bundle.