The result

dharmatiles version="1.0.0"
// The same kind of line with a larger wobble. Change the seed: the points stay where they are
// written, and the line wanders differently.
tile size="1x1" seed=12 {
line border wobble="9dmm" { through "(0sq, 0.5sq)" "(0.5sq, 0.5sq)" "(1sq, 0.5sq)" }
region lawn { boundedBy border; fill "(0.5sq, 0.1sq)" }
stack {
base
dirt
grass at=lawn
}
}
Say it plainly
A node is a name, then values and properties (key=value), then an optional block in braces. That is the whole shape of a tile: tile holds line, region and stack, and stack holds the elements.
The program, not KDL, knows what the words mean, so every mistake is reported in the tile language’s own words, at the line it is about.
The rules
A document is KDL v2, checked against the tile language
Documents are KDL v2, a small, readable configuration language, checked by the program against the tile language, so every error message is written for you, at the line it is about.
| Rule | Example | Notes |
|---|---|---|
| A node is a name, then values and properties, then an optional block. | rock size="8dmm" shape=flat { … } | Properties are key=value; a block is { … }. |
| A control may go on the line or as a child line. | cliff height="35dmm" or cliff { height "35dmm" } | Both decode the same. Edits keep whichever form is written; new controls go on the line. |
Anything with a unit, a range, a $, a percent or a point is quoted. | size="1dmm .. 6dmm", cover="85%", at="(0.65sq, 0.5sq)", top="$groundHeight" | KDL numbers can't contain letters, .., %, $ or ,. A forgotten quote gets an error that says what to write. A bare number is for counts, densities and fractions (count=3, perSquare=45). |
Switches are #true and #false. | — | Bare true is KDL v1 and an error. Few controls are switches: most take a word (clods some, leaves bare). |
// comments a line; /- switches off the next node. | /- tree | |
""" opens a multi-line string. | about """ … """ | |
Several nodes on one line are separated by ;. | region verge { boundedBy trail; fill "(0.15sq, 0.5sq)" } |
Errors this page explains
dt::syntaxDocuments are KDL v2: a baretrue,falseornullis KDL v1 The ruledt::positionalThe element takes name=value controls, not a bare value The ruledt::control-nodeA control written as its own line has no block The rule
Next
Next: squares, cells and points, where a tile gets its size and a position is written.