The tile language · guide

Worked tiles

Whole tiles, each with what it shows. Every one builds as written.

The result

A grass meadow with one tree

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

// library/tiles/ground/2x2-grass-tree.dtile
// A 2×2 grass meadow with one tree.

use "parts/grass" long-grass

tile size="2x2" seed=84 {
    stack {
        base
        dirt clods=none
        tree top="$bottom + 49dmm" {     // anywhere on the tile; or at="(1sq, 1sq)"
            trunk height="30dmm"             // bare trunk below the crown
            crown width="30dmm" clumps=32 shape=round branching=normal
            leaf length="4.5dmm" width="3dmm"
        }
        long-grass                      // listed after the tree, so it grows round the trunk
    }
}
A grass meadow with one tree.
  • No region: the whole tile is the default area.
  • The tree has no at=, so it goes anywhere on the tile. at="(1sq, 1sq)" would put it in the middle.
  • The grass is listed after the tree, so it grows round the trunk; listed before it, the tree would stand in the grass.
  • long-grass grows standing blades.

Say it plainly

Whole tiles, each with what it shows. Every one builds as written: copy it into a .dtile file and run dharmatiles preview on it.

They are the same tiles the guide’s pages take their words from. Read a tile first, then the page of the concept in the bullet that puzzles you.

The tiles

A fieldstone wall turning a corner

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

// library/tiles/walls/1x1-wall-fieldstone-corner.dtile
use "parts/grass" lawn

tile size="1x1" seed=64 {
    stack {
        base
        dirt                                // bare earth at the ground height

        // Along the north edge, then the west edge.  On a tile edge a
        // wall always stands inside, its outer face flush with the edge.
        wall at="north west" style=fieldstone {
            height full                     // up to $wallHeight (33.1dmm)
            thickness "7dmm"
            coping loose                    // or: on-edge

            // fieldstone's own defaults, written out to show them
            stones height="2.2dmm .. 5.2dmm" length="5dmm .. 16dmm"
            joints width="0dmm" depth="2.8dmm"        // how deep the gaps between stones look
            edges rounding="1.3dmm .. 2.6dmm"       // worn corners
        }

        lawn
    }
}
A fieldstone wall turning a corner.
  • Two edges in at= make a corner.
  • The wall has no seed= of its own, so its stones follow the tile seed; write one on the wall to pin them (the seed row then says so).
  • On OpenLOCK, the 7dmm thickness and the stone sizes all shrink with the square.

A cliff run

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

// library/tiles/cliffs/2x1-cliff.dtile
tile size="2x1" seed=1 {
    about """
        Rock band against the north edge. Both ends finish in the
        standard end section, so runs butt end to end.
        """

    region crag  { within "[10dmm .. 20dmm]" of=northEdge }
    region apron { within "6.5dmm" of=crag }

    stack {
        base
        dirt top="$dirtEdgeHeight" {
            pin top="[$dirtEdgeHeight .. $dirtEdgeHeight + 3.5dmm]" at=apron   // the bank, drawn
            pin top="$dirtEdgeHeight" at=edges
            scatter perSquare=45 { pebble size="1dmm .. 2.2dmm" buried="20%..50%" }
        }

        cliff top="$dirtEdgeHeight + 35dmm" at=crag {
            rock mixed                  // or: columns, blocks, slabs
            stoneSize massive          // or: rubble, broken
            shattered patches=3 width="5dmm .. 10dmm"
        }
        dirt top="$bottom + [0.6dmm .. 1.2dmm]" at=crag   // dirt on the cliff's top

        // scree: fallen stones gathered at the cliff's foot
        scatter at="foot(cliff)" perSquare=55 reach="4dmm" { stone size="low(1dmm .. 6dmm, 11)" }
        scatter at="foot(cliff)" perSquare=2.5 { boulder size="4.5dmm .. 8dmm" }
    }
}
A cliff run.
  • The dirt is listed before the cliff and still banks at="foot(cliff)". Its pebbles are scattered on the dirt.
  • Scree is stones and boulders scattered against the cliff; they take their fragment shapes from the cliff's rock.
  • $bottom on the second dirt is the cliff's top: it lies 0.6 to 1.2 design millimetres over it.

A divided tile: grass, a path and rocks

A path of bare dirt winding up a 1×2 tile through grass, with rocks beside it: lines, regions and at= together.

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

use "parts/grass" lawn

tile size="1x2" seed=7 {

    // From the middle of the south edge to the middle of the north edge,
    // 9 design millimetres wide, wandering up to 3 off its points.
    line trail width="9dmm" wobble="3dmm" { through south "(0.65sq, 1sq)" north }

    // Everything beside the path: one fill point on each side of it.
    region verge { boundedBy trail; fill "(0.15sq, 1sq)"; fill "(0.85sq, 1sq)" }

    stack {
        base
        dirt                                    // the whole tile, at the ground height
        dirt at=trail top="$bottom + [0.4dmm .. 0.8dmm]" clods=none   // the path: a second dirt along it, a little proud and smooth

        scatter at=verge count=5 {
            rock size="4dmm .. 10dmm" shape=rounded buried="30%"   // shape: or angular, flat
        }

        lawn at=verge cover="85%"
    }
}
A divided tile: grass, a path and rocks.
  • The second dirt is laid after the first along the path; each land body is the higher of what is below it and its own top.
  • verge is the tile less the path: one fill point on each side of the line. Points count down from the north, so (0.65sq, 1sq) is a square down from the north edge, half way along a 1×2 tile.

Two short ones

// A straight wall on the south edge
wall at=south style=cut-stone {
    height full
    thickness "7dmm"
}

// A taller cliff with a ledge
cliff top="$dirtEdgeHeight + 55dmm" at=crag {
    rock blocks
    ledges 1                        // a shelf stepped down the free face
}

Errors this page explains

This page explains no error codes.

Next

Next: the cheat sheet, every word of the language on one page.