A Tilemap crate for the Bevy game engine with a focus on large map sizes and ECS sparse maps
bevy_sparse_tilemaponly spawns the minimum amount of entities neccesary and doesn't one-to-one map tiles to entities. This allows it to dodge current Bevy performance issues related to rendering and unlocks a substantially higher baseline performance for extra large maps.Tiles in
bevy_sparse_tilemapare stored on each chunk using custom storage.bevy_sparse_tilemapdoes support spawning entities mapped to specific tiles at will for when you really need to save extra information or to gain access to the ECS when needed for specific tile types.
bevy_sparse_tilemaphas a built in API to handle spawning, despawning, and accessing tiles optional entities as well as tile data.Internally this crate supports both Sparse and Dense internal storage. Both are still ECS sparse (minimal amount of entities spawned) but sparse maps don't require the user to supply data for every tile.
bevy_sparse_tilemapsupports different map types using a generics trait based system that provides great flexibility to support many different map types.Currently supported:
- Hexagon
- Square
Because of the ECS Sparse nature of the crate,
bevy_sparse_tilemapdodges current limitations in Bevy related to rendering performance issues. These limitations are what other tilemap crates run into and inhibits their performance. This allowsbevy_sparse_tilemapto have exceptional performance as a baseline, allowing maps as large as 15k x 15k easily with smart rendering using something like bevy_fast_tilemap.
This crate focuses purely on the tilemap logic and leaves the rendering to the user.
See Docs.rs for documentation on how to use bevy_sparse_tilemap as well as brief examples.
See GitHub examples for longer examples of each feature of the crate.
bevy_ecs_tilemap is a fabulous crate that will probably cover most of your needs in an easier to use plugin and you
should reach for that first in most situations.
You should use bevy_ecs_tilemap if:
- You don't need very large maps (
bevy_ecs_tilemapruns into performance issues around 200x200 in my testing) - You want every tile to be its own Entity for ECS integration (This crate tries to avoid unnecessary entities and uses a Voxel like approach)
- You want a more mature and more feature rich plugin
- You want tilemap rendering handled for you
You should use bevy_sparse_tilemap if:
- You want very very large maps,
bevy_sparse_tilemapcan reach substantially larger map sizes compared tobevy_ecs_tilemap. - You are willing to implement your own tilemap rendering.
| BST Version | Bevy Version |
|---|---|
| 0.4 | 0.15 |
| 0.3 | 0.14 |
| 0.2 | 0.13 |
| 0.1 | 0.13 |