The tile language · guide

Seeds

A seed is the one whole number that decides every roll a tile makes.

The result

The tile this source builds, from above
dharmatiles version="1.0.0"

// A point written as a range is drawn once from the seed: the line's middle point is anywhere
// from 0.3sq to 0.7sq down, a different place for another seed.  Its ends stay on seams: a
// point on a tile side is one place, never a range, so it meets the next tile's.
tile size="1x1" seed=18 {
    line shore wobble="3dmm" { through "(0sq, 0.5sq)" "(0.5sq, 0.3sq .. 0.7sq)" "(1sq, 0.5sq)" }
    region bank { boundedBy shore; fill "(0.5sq, 0.1sq)" }
    stack {
        base
        dirt
        grass at=bank
    }
}
A point written as a range is drawn once from the seed: the middle of the shore is anywhere from 0.3sq to 0.7sq down. Roll the seed and it lands somewhere else; its ends stay on seams.

Say it plainly

Wherever a tile says “somewhere in this range”, the program rolls a number. The tile’s seed= is what makes the rolls come out the same each time: the same document, seed and build target give the same tile, on any number of threads.

Change the seed and every range is drawn again, so one document is a whole family of tiles. Edit one value and only its own draws change; the others stay where they were.

The rules

A tile’s seed is a whole number from 0

tile size="1x1" seed=97 { … } sets it; a tile that writes none is built with the seed the build is asked for (dharmatiles check --seed N, or the seed control of a card or the editor). A negative or fractional seed is refused.

Every range is its own roll, everywhere

Write a range twice and it rolls twice: [1dmm .. 2dmm] + [3dmm .. 4dmm] is two dice, in a control, in a top=, in a pin and in a tree's crown alike; there is one evaluation of a value, and a range is one roll wherever it stands. Each range draws from its value's own key and its position in the value, so editing one value never moves another's draws.

An entry can keep its own seed

seed=: pins this entry’s own randomness while the tile seed changes everything else. The tile level’s seed row says which entries do this (wall keeps its own seed (15)), since rolling the tile seed will not change them.

Errors this page explains

Next

Next: parts, for reusing a whole stack.