The tile language · guide

Heights

A height is a length above zero. A body says how high it may be with a top=; a pin holds it to a height at a place.

The result

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

tile size="1x1" seed=62 {
    point crossing "(0.65sq, 0.5sq)"
    line stream wobble="0.5dmm" { through westCenter eastCenter }
    region banks { within "11.5dmm" of=stream }
    region bed   { within "1.5dmm" of=stream }
    stack {
        base
        dirt {
            pin top="[$waterBedHeight .. $groundHeight + 1dmm]" at=banks       // anywhere from the bed to the land
            pin top="[$waterBedHeight .. $waterBedHeight + 0.3dmm]" at=bed     // later, so it wins in the bed
        }
        rock size="6dmm .. 10dmm" at=crossing
        water top="[$waterSurfaceHeight - 1.9dmm .. $waterSurfaceHeight + 3dmm]" at=banks
        grass
    }
}
A stream, its banks and a crossing: dirt held anywhere from the stream bed to the land by pins, a rock at the crossing, water over the banks, grass beside.

Say it plainly

Heights are written one way everywhere: lengths above zero, the top of the base. Most are the library’s own names, $groundHeight for open land, $waterSurfaceHeight for calm water, and a little arithmetic on them.

A surface does not get one height but a band, a low and a high. A pin pins the band to a height at a place, and the program works out the surface between, easing no steeper than the land allows. The library’s edge heights make any two tiles meet without a step.

The rules

A height is a length above zero

Heights are written one way everywhere: lengths above zero, the top of the base. A height is a length (top="8dmm"), a $ name from the library's heights, or a formula of them. height is a different word: how tall a thing stands above what it stands on, a length (thickness "7dmm", stones height="2.2dmm .. 5.2dmm") or a word (wall … height full, up to $wallHeight).

A height may use numbers with units, plain and $ names, $x and $y (squares, plain), $d and $a (fractions), $bottom (the surface under this body, or under the thing), + - * /, a range in brackets anywhere ($groundHeight + [1dmm .. 2dmm]), the coordinate calls (squares and points), and the functions sin and cos (of an angle), abs, min, max, clamp and smooth. Kinds are checked (kinds): $groundHeight + $x adds squares to a length and is refused.

A body’s top= is a band, and a pin holds it to a height at a place

A body of the stack (dirt, water, cliff, flagstones, planks) says how high it may be with its top=, a band: a single height fixes the surface, a range leaves it room. A pin holds the band to a height at a place; where pins overlap the later one wins, and the library's defaults (below) are read first. The stack is written bottom up: base first, the land in order, things and grass where you want them, water after the ground it fills over and the rocks and reeds it should ring, and before the grass that should see its shore. The stack is built in the order it is written.

dharmatiles version="1.0.0"

tile size="1x1" {
    point knoll "(0.28sq, 0.28sq)"
    region banks { within "11.5dmm" of=center }
    stack {
        base
        dirt top="[$groundHeight .. $groundHeight + 2.5dmm]" {
            slope "30deg"                                  // how steeply this dirt lies; 24deg by default
            pin top="$groundHeight + 4dmm" at=knoll
        }
        water at=banks                                // fills over the ground listed above it
        grass at=banks                                // listed after the water: keeps off the wet ground
    }
}

A pin needs top= and at=, and belongs on a body

A pin without top= or at=, or a pin on something that is not a body, is refused while the document is read: a pin needs at=.

A pin’s place must cover something

A pin whose place covers nothing is found when check solves the bands: this pin's place `nowhere` covers nothing.

A layer must be able to be as thick as the printer’s skin

A layer that can never be as thick as the printer’s skin (three layers) is refused: the dirt is at most 0.30 mm thick at (17.50, 17.50) mm, under the 0.60 mm the printer's skin needs.

A body with no default needs a top=

A body with no top and no default, such as a cliff, is refused when check solves the bands.

Pins that force dirt past its slope are noted

Pins force dirt past its slope: the dirt is forced to 43.8°, steeper than its 24° slope: 5.33 mm up to 5.59 mm over 0.27 mm. A note does not stop the build; check prints it after the tile’s line.

A pin that wins nowhere is noted

A pin of the tile’s own that wins nowhere because later pins cover all of its place is noted. A pin the library supplies is never reported: covering it is how a tile overrides it.

Not yet. top= on a thing other than a tree or a rock is not built yet: it is refused with dt::not-yet.

Errors this page explains

Next

Next: defaults and the edge contract, what every body starts from.