Architecture
map_scatter separates candidate generation from evaluation, then executes compiled field graphs in chunks for deterministic, scalable performance.
Core components
- Sampling
PositionSamplinggenerates candidate positions for each layer.- Planning
Kinddefines field logic for one category.Layercombines kinds with a sampling strategy.Planorders layers and drives execution.- Evaluation
ScatterRunnerorchestrates the run.Evaluatorexecutes gate and probability fields per kind.- Field graph
FieldGraphSpecdescribes nodes and semantics.FieldProgramis the compiled representation.FieldRuntimesamples the program over a spatial domain.FieldProgramCachekeeps compiled programs reusable across runs.- Textures and overlays
TextureRegistryprovides external data sources.- Overlay masks are generated per layer as
mask_<layer_id>textures.
End-to-end flow
- Plan setup: build a
Planfrom one or more layers. - Candidate generation: each layer's sampler produces positions.
- Compile or fetch: field graphs compile into programs, cached by kind.
- Evaluate: gate fields allow or reject, probability fields weight selection.
- Select and place: a selection strategy picks a kind per position.
- Overlays (optional): a mask is rasterized from placements.
- Results: placements, overlays, and counts are returned.
Chunked evaluation and caching
The domain is divided into chunks, allowing field graphs to be evaluated in manageable blocks. Raster cells are sampled at a fixed resolution, and a small halo avoids artifacts at chunk borders. This approach keeps memory usage predictable and enables streaming workflows.
Determinism
A run is deterministic when the plan, inputs, and seed are the same. Changing textures, order, or configuration changes the output, while repeated runs with identical inputs are stable.
Observability
ScatterEvent streams allow you to inspect warnings, per-position evaluations, and overlay creation. This is useful for tooling and debugging.