GitHub - StarArawn/bevy_ecs_tilemap: A tilemap rendering crate for bevy which is more ECS friendly. (original) (raw)

Crates.io docs license Crates.io

A tilemap rendering plugin for bevy. It is more ECS friendly as it makes tiles entities.

Features

Screenshots

iso hex

How Does This Work?

Quite simply there is a tile per entity. Behind the scenes the tiles are split into chunks that each have their own mesh which is sent to the GPU in an optimal way.

Why Use This Instead of X?

Because each tile is an entity of its own editing tiles is super easy and convenient. This allows you to tag entities for updating and makes stuff like animation easier. Want to have a mining simulation where damage is applied to tiles? That’s easy with this plugin:

struct Damage { amount: u32, }

fn update_damage( mut query: Query<(&mut TileTexture, &Damage), Changed>, ) { for (mut tile_texture, damage) in query.iter_mut() { tile_texture.0 = TILE_DAMAGE_OFFSET + damage.amount; } }

Examples

Running Examples

cargo run --release --example basic

Running examples on web

This can be made simple with wasm-server-runner.

After that's installed and configured, run:

WebGL2

cargo run --target wasm32-unknown-unknown --example animation

WebGPU

cargo run --example animation --target=wasm32-unknown-unknown --features=bevy/webgpu

Bevy Compatibility

bevy bevy_ecs_tilemap
main bevy-track
0.18 0.18
0.17 0.17
0.16 0.16
0.15 0.15
0.14 0.14
0.13 -
0.12 0.12
0.11 0.11
0.10 0.10
0.9 0.9
0.8 0.8
0.8 0.7
0.7 0.6
0.6 0.5

Asset credits