bevy_map_scatter
Bevy plugin for rule-based object scattering: data-driven rules, multiple sampling strategies, and reproducible results - integrated with Assets and ECS.

Features
Provides data-driven object scattering for Bevy: populate worlds with many small entities using multiple sampling strategies - as assets, async, and ECS-friendly:
- Asset-based authoring of scatter plans (RON): load
*.scatterfiles viaAssetServer. - Texture integration: snapshot Bevy
Images to CPU textures with configurable domain mapping. - Asynchronous execution: runs scatter jobs on
AsyncComputeTaskPool. - ECS-friendly: placements become entities; components can be attached for rendering, gameplay, or tooling.
- Diagnostics: forward core events as Bevy messages (
ScatterMessage,ScatterFinished).
Use cases
Populate a Bevy world with many small entities (plants, props, resources, decals) in a data‑driven, repeatable, and editor‑friendly workflow.
Provides:
- Asset‑based plans can be hot‑reloaded
- Fast iteration by tweaking textures/thresholds/layer order
- Deterministic seeds (or per‑run variation) and async execution
Examples:
- Stylized forest: trees (sparse) => mushrooms where tree probability is low => grass fills gaps
- Town dressing: benches in plaza masks => lamp posts along roads with spacing => clutter only where nothing else landed
- Dungeon encounters: camps in large rooms => enemies avoid camp influence => rare loot in dead‑ends with minimum spacing
Bevy integration highlights:
- Assets: versioned, hot‑reloadable scatter plans
- ECS: placements become entities that can be tagged/decorated
- Async: compute on
AsyncComputeTaskPool; main schedule stays responsive - Determinism: same seed + plan + textures = identical placements
- Extensibility: react to events (
ScatterFinished, messages) to spawn or run custom logic
Examples
See the example crate for curated demos you can run locally.
Quick start
Add the crates to a Bevy application:
# Cargo.toml
[]
= "0.17"
= "0.2"
= "0.2"
Create a scatter plan in assets/simple.scatter:
(
layers: [
(
id: "dots",
kinds: [
(
id: "dots",
spec: (
nodes: {
"probability": Constant(
params: ConstantParams(value: 1.0),
),
},
semantics: {
"probability": Probability,
},
),
),
],
sampling: JitterGrid(
jitter: 1.0,
cell_size: 1.0,
),
selection_strategy: WeightedRandom,
),
],
)
Trigger a single scatter run once the asset is ready:
use *;
use *;
;
/// Loads the scatter plan asset on startup.
/// Triggers a scatter request once the plan asset is loaded.
/// Observes the `EntityEvent` when a scatter run has finished.
Run the application with cargo run. After the scatter job completes, a summary appears in the log; continue with placement logic as needed.
Compatibility
bevy_map_scatter |
map_scatter |
bevy |
|---|---|---|
0.2 |
0.2 |
0.17 |