Skip to main content

Module transitions

Module transitions 

Source
Expand description

Terrain transitions (docs/spec/FORMAT.md section 13): the profile’s rules that choose the edge, corner and variant tiles around painted terrain, and the deterministic resolver that applies them.

A world’s source stores only the terrain a brush paints. Transitions::resolve_chunk derives a chunk’s ground tiles from its terrain and its neighbours’, across chunk edges, so the compiler, the editor and every other tool draw the same tiles.

Structs§

Pattern
The variants of one pattern, at least one, with the running sum of their weights.
ResolvedChunk
A chunk’s ground tiles with transitions applied: for each ground layer, each tile’s prototype, or None for an empty tile. Values borrow from the source grids and the transitions.
Terrain
One terrain: the prototypes that are it when painted.
Transition
One transition of a terrain.
Transitions
A profile’s terrain transitions, as read and checked by the loader.
Variant
One variant of a pattern’s tile.

Enums§

Draw
Where a transition draws.
Model
The neighbourhood a transition reads, and the patterns it maps to tiles.

Constants§

MAXIMUM_TERRAINS
Most terrains a transitions document declares.
MAXIMUM_TERRAIN_PROTOS
Most prototypes one terrain lists.
MAXIMUM_TERRAIN_TRANSITIONS
Most transitions one terrain has.
MAXIMUM_TILE_TRANSITIONS
Most transitions resolving one tile evaluates, however large the document: the transitions of the tile’s own terrain and of the terrains of its eight neighbours, since an outside transition draws only next to its terrain.
MAXIMUM_TRANSITIONS
Most transitions a transitions document has in all.
MAXIMUM_VARIANTS
Most variants one pattern lists.
MAXIMUM_WEIGHT
Largest weight of a variant.
TRANSITIONS_FORMAT
The format of a transitions document.

Traits§

TerrainSource
Where the resolver reads painted terrain: the ground grids of chunks by address. A Plane is one; an editor can implement it over its own chunks, such as ones with unsaved edits.

Functions§

variant_hash
The hash that picks a tile’s variant (docs/spec/FORMAT.md section 13): the transition’s seed and the tile’s layer and plane coordinates, mixed in that order, so the same world always picks the same variants.