Writing it
stack {
base
dirt top="$dirtEdgeHeight" { scatter perSquare=40 { pebble } }
cliff top="$dirtEdgeHeight + 35dmm" at=crag
scatter at="foot(cliff)" perSquare=55 reach="4dmm" { stone }
grass // listed last: it grows round the cliff and the stones
}
Try it

dharmatiles version="1.0.0"
// The stack is built in the order it is written: the grass is listed after the rocks, so it
// grows round them. Move the scatter below the grass and see the difference.
tile size="1x1" seed=9 {
stack {
base
dirt
scatter count=4 { rock size="6dmm .. 10dmm" }
grass
}
}
scatter line below grass and look again.
dharmatiles version="1.0.0"
// A stack of surfaces and what stands on them: dirt, rocks in the pool, water filling over what
// is under it, then grass on the bank.
tile size="1x1" seed=97 {
line shore wobble="5dmm" { through "(0sq, 2sq/3)" "(1sq, 0.5sq)" }
region pool { boundedBy shore; fill "(0.5sq, 0.75sq)" }
region bank { boundedBy shore; fill "(0.5sq, 0.25sq)" }
region shoreBand { within "7dmm" of=shore }
stack {
dirt { pin top="[$waterBedHeight .. $groundHeight + 1dmm]" at=shoreBand; pin top="$waterBedHeight" at=pool }
scatter at=pool count=2 { rock size="6dmm .. 10dmm" }
water
grass at=bank
}
}
Reference
Every entry in a stack takes these, whatever it is:
| Written | Takes | Default | What it does |
|---|---|---|---|
seed= | a whole number | — | Pins this entry's randomness while the tile seed changes everything else. |
id= | a name | — | Names the entry among same-named siblings, for edits and diagnostics. |
weight= | a number | 1 | Only on a child of a scatter: its share of the mix. |
| place words | at= and side=. at= takes a place by name or "(across, down)" with units, an edge or edge path, or foot(cliff); each element page lists the kinds of place it takes (a point, a line, a region, a foot) and refuses the rest with dt::type. | ||
top= | a height or a range | — | On a body (dirt, water, cliff, flagstones, planks): the band it fills. On a tree: its height. Heights are lengths above zero ("$groundHeight + 2dmm"); see let. |
| a name | a name | — | After a body's element, dirt hillDirt: its name in messages. |
Notes
A stack may start with base, and a tile is written bottom up: the base first, the land in order, things, grass and water where they are listed, each over what is listed above it. Water usually goes after the rocks it should ring and before the grass that should see its shore. The pins of a body go in its block: pin top=… at=….
The build plans the stack by what each element reads and writes: surfaces first (a floor is laid with them, on the land they made), then the ground is lifted, then solids, and surfaces that grow round solids after them. A stack that asks for something nothing makes is refused with an error at the entry. The preview lists the stack under the tile's name, each entry linked to its page here.
Seen from the language
The guide pages that use stack: The tile document, The stack, Worked tiles.



