Chunky Bevy
A simple and efficient chunk management system for Bevy game engine, perfect for voxel games, procedural worlds, and any application that needs spatial partitioning.
Features
- 🎯 Simple API - Easy to use chunk management with minimal boilerplate
- 🔄 Automatic Loading - Optional chunk loader component for automatic chunk spawning around entities
- 👁️ Visualization - Built-in debug visualization for chunk boundaries
- ⚡ Efficient - HashMap-based chunk lookup with O(1) access
- 🎮 Bevy Integration - First-class Bevy ECS integration with hooks and resources
Quick Start
Add to your Cargo.toml:
[]
= "0.17"
= "0.1"
Basic usage:
use *;
use chunky-*;
Features
Default Features
chunk_visualizer- Enables debug visualization of chunk boundarieschunk_loader- Enables automatic chunk loading around ChunkLoader entities
Optional Features
chunk_info- Logs chunk spawn/despawn events
Disable default features:
= { = "0.1", = false }
Components
Chunk
Marks an entity as a chunk. Automatically registers/unregisters with ChunkManager.
ChunkPos(IVec3)
The chunk's position in chunk-space coordinates. Automatically updates the entity's Transform.
ChunkLoader(IVec3)
Automatically loads chunks in a radius around the entity. The IVec3 defines the loading radius in each direction.
Example:
ChunkLoader(IVec3::ZERO)- Loads only the chunk the entity is inChunkLoader(IVec3::ONE)- Loads a 3x3x3 cube of chunksChunkLoader(IVec3::new(5, 0, 5))- Loads a 11x1x11 flat area
Resources
ChunkManager
The main resource for querying and managing chunks.
Visualization
Enable chunk boundary visualization:
Helpers
Spawn multiple chunks at once:
use chunky-*;
Examples
Run the basic example:
Controls:
- WASD - Move camera
- Q/E - Move camera down/up
- HJKL - Move cube (chunk loader)
- Y/I - Move cube down/up
- Left Mouse Button - Look around
Custom Chunk Sizes
use chunky-ChunkyPlugin;
new
.add_plugins // 10x10x10 (default)
// Or custom size:
.add_plugins
Bevy Version Compatibility
| Chunky Bevy | Bevy |
|---|---|
| 0.1 | 0.17 |
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.