![]() # Objective An attempt to start building a base for first-party tilemaps (#13782). The objective is to create a very simple tilemap chunk rendering plugin that can be used as a building block for 3rd-party tilemap crates, and eventually a first-party tilemap implementation. ## Solution - Introduces two user-facing components, `TilemapChunk` and `TilemapChunkIndices`, and a new material `TilemapChunkMaterial`. - `TilemapChunk` holds the chunk and tile sizes, and the tileset image - The tileset image is expected to be a layered image for use with `texture_2d_array`, with the assumption that atlases or multiple images would go through an asset loader/processor. Not sure if that should be part of this PR or not.. - `TilemapChunkIndices` holds a 1d representation of all of the tile's Option<u32> index into the tileset image. - Indices are fixed to the size of tiles in a chunk (though maybe this should just be an assertion instead?) - Indices are cloned and sent to the shader through a u32 texture. ## Testing - Initial testing done with the `tilemap_chunk` example, though I need to include some way to update indices as part of it. - Tested wasm with webgl2 and webgpu - I'm thinking it would probably be good to do some basic perf testing. --- ## Showcase ```rust let chunk_size = UVec2::splat(64); let tile_size = UVec2::splat(16); let indices: Vec<Option<u32>> = (0..chunk_size.x * chunk_size.y) .map(|_| rng.gen_range(0..5)) .map(|i| if i == 0 { None } else { Some(i - 1) }) .collect(); commands.spawn(( TilemapChunk { chunk_size, tile_size, tileset, }, TilemapChunkIndices(indices), )); ```  |
||
---|---|---|
.. | ||
migration-guides | ||
release-notes | ||
migration_guides_template.md | ||
migration_guides.md | ||
README.md | ||
release_notes_template.md | ||
release_notes.md |
Release Content
This directory contains drafts of documentation for the current development cycle, which will be published to the website during the next release. You can find more information in the release notes and migration guides files.