The tile language · guide

The stack

The stack is the list of elements a tile is made of, written bottom up and built in the order it is listed.

The result

The tile this source builds, from above
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
    }
}
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.

Say it plainly

Each line of the stack is an element: a surface such as dirt or water, a thing such as a rock or a tree, a run such as a wall. Each stands on the terrain laid so far, and what is listed after it is laid over or beside it.

So order is part of what you mean: grass listed after the rocks grows round them, water listed after the dirt fills over it. The program never reorders a stack to make it work; it tells you what the order cannot do.

The rules

The stack is built in the order it is listed

The stack is built in the order it is listed. Each entry stands on the terrain as laid so far, and what is listed after it is laid over or beside it. Land bodies are laid in stack order, each the higher of what is below and its own top: a dirt along a path, listed after the whole-tile dirt, takes the higher of the two there. A dirt listed after a rock, a tree, a flower or a scatter of them is built after them: it lies on the tops of rocks where they are flatter than its maxSlope, banks up to a trunk or a stone (a rise is no drop), and covers a flower's foot, as written. A tree's crown is never a surface for dirt. A dirt listed before them is laid first, and they stand on it (a rock beds into it). Grass grows round what is listed before it, so list the grass after the rocks, trees and flowers it should grow round; the same goes for water, which fills over the ground listed above it and sees the rocks and reeds listed above it (each sends its own chop). What is listed after the water stands in it or on its shore and reads it: a rock stands in the pool, and grass keeps off the wet ground. A dirt or ground listed after the water lies over it: where its top is higher than the water the earth shows, where it is lower the water stays. Water is built where it is listed, like every other layer; nothing is written about it last.

The plan refuses what the listed order cannot satisfy, with dt::order and the entry's place, and never reorders to cure it: a tree, grass or wall listed before the first ground or dirt it stands on, a thing that reads another kind (grass that needs rocks) with the first of that kind listed after it, a floor listed before a surface it lies on. Two things are placed by what they are, not by where they are written: the lift (the one solid the surfaces make together) comes right after the last surface, water or floor, and base, which reads the finished tile, is built last.

A stack lists elements: the built-in ones and your own definitions

Each element has a page of its own, with what it makes, a picture, an example and every control it takes, generated from the program: dharmatiles elements NAME prints the same list. Each element leads with a few controls named for what you see. A word in a choice (rock mixed, flow wild) expands to documented numbers; a number is always accepted instead.

KindElements
Surfacesdirt · grass · reeds · water · flagstones · planks
Thingsrock · stone · boulder · pebble · flower · tree
Runswall · cliff
Placementscatter
Bases (added by the build)dungeonblocks · openlock

The document's own elements are tile, let, line, region, stack and use; a let with a body adds a part of your own.

Every stack entry takes id=, weight= and the place words its element accepts

  • id=: a name for the entry, for edits and diagnostics.
  • weight=: only on a child of a scatter, its share of the mix.
  • The place words its element accepts (placement).

The base is the first line of the stack, and there is one

base anywhere but first, or a second one, is refused while the document is read (the base is the first line of the stack). A stack with no base line has none, and prints flat on the bed from zero.

Some mistakes show only when an element builds

An element cannot build what a control or the place asks for, found only once it is built: the top leaves the crown 0.2 mm to stand in over its base …, with the help raise the top where it is low, or lower the trunk. Every refusal gives the place, the values and what would fit.

Not yet. An element the program knows but has not built yet is accepted by check and refused by build, with dt::not-yet and what to write instead; dharmatiles elements says which elements are built (all of them are now), and a control an element page marks not built yet is accepted by check and refused by build the same way.

Errors this page explains

Next

Next: placement and scatter, which says where an entry goes and how many of it.