Write a few lines. Print the terrain.

dharmatiles turns a short text file into a 3D-printable terrain tile for tabletop games: ground, grass, rocks, cliffs, water, walls and trees, on a 35 mm DungeonBlocks or 25.4 mm OpenLOCK base, printable on a home FDM printer without supports. The file is a .dtile document, and this site is the reference for its language.

Install Read the language guide Browse the elements

dharmatiles version="1.0.0"

// my-pond.dtile
tile size="1x1" seed=97 {
    line shore wobble="5dmm" { through "wsw" "e" }
    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 {
        base
        dirt {
            pin top="[$waterBedHeight .. $groundHeight + 1dmm]" at=shoreBand   // anywhere from the bed to the land
            pin top="$waterBedHeight" at=pool                                  // later, so it wins in the pool
        }
        water
        scatter at=pool count=2 { rock size="6dmm .. 10dmm" }
        grass at=bank
    }
}
The document built: a one-square tile, water in the lower part with two rocks, a grassy bank above a wandering shore
That document, built. It's in the library as lib:tiles/water/1x1-water+grass.dtile.

A first tile

A line divides the tile, regions name its sides, and the stack says what goes where: dirt pinned down to the water's bed in the pool, grass on the bank, two rocks and water in the pool. Every length carries its unit, and dmm is 1/35 of a square, so the OpenLOCK build scales sizes for you; points are counted from the north-west corner.

ToRun
Build it (DungeonBlocks)dharmatiles build my-pond.dtile → out/db/my-pond-db.stl
Build it for OpenLOCK, with preview imagesdharmatiles build my-pond.dtile --system ol --png
Watch it in the browser as you editdharmatiles preview my-pond.dtile --open
Browse your tiles and the librarydharmatiles on its own, or dharmatiles preview --open (your tiles live in ~/dharmatiles, or set DT_HOME; name folders to browse those instead)
Check it without buildingdharmatiles check my-pond.dtile (add --system ol or --printer fine to check for that target, as build takes them; sizes depend on the system, so a tile can pass for one and fail for the other)
Mend what the program can menddharmatiles fix my-pond.dtile shows each fix (the point moved onto its seam, the word written right) and by how many millimetres on the target; --write makes them, and a folder fixes every tile in it (see Fixing a tile)
Build every library tiledharmatiles build --all (add --system ol for OpenLOCK). A build that is already kept is read, not made: the second run takes seconds; --no-cache builds from nothing
See, list or empty the cache of buildsdharmatiles cache, dharmatiles cache list, dharmatiles cache clear; dharmatiles cache previews builds the library's super-low previews into it (see the cache of builds)
Lay a print list out on a printer's platesdharmatiles plates my-list.dmap: one Bambu Studio project with every plate, or one STL per plate (see Plates and Printers); --check plans without building
Keep track of what you have printeddharmatiles inventory, dharmatiles inventory have <tile>: a print list then prints only what you lack (see Inventory); plates --all prints everything
List the elements and their controlsdharmatiles elements, dharmatiles elements cliff

Every tile passes a printability gate before it is written: watertight, nothing lost, and no overhang past 55° (55–65° allowed in small patches, past 65° fails). Print it base down, with no supports; see printing.

Install

There are no prebuilt downloads yet. You need Rust and git:

git clone https://github.com/shawn-vincent/dharmatiles.git
cd dharmatiles
cargo build --release                 # a few minutes, once
./target/release/dharmatiles elements # it works: lists the elements

Run it from inside the checkout and it finds the library (lib:tiles/…, use "parts/grass") by itself. To run it from anywhere, put target/release on your PATH and set DT_LIBRARY to the checkout's library folder. Output goes to an out/ folder where you run it (or --out): out/db/ for DungeonBlocks, out/ol/ for OpenLOCK.

Making your own tile

  1. Start from a library tile. Copy one that is close to what you want: cp library/tiles/water/1x1-water+grass.dtile my-pond.dtile. The elements pages list which library tiles use each element.
  2. Open the preview. dharmatiles preview my-pond.dtile --open shows the tile in your browser, painted, with overhangs in red. It rebuilds every time you save, and shows a mistake at its line.
  3. Edit. Change a control, add an element, move a line. Each element's page lists every control it takes; the preview's stack line links each entry to its page. Change seed= for another version of the same tile.
  4. Build. dharmatiles build my-pond.dtile for DungeonBlocks, --system ol for OpenLOCK, --printer fine for another printer profile, --3mf for a 3MF painted by material, ready for a multi-colour printer (a Bambu Studio project with its filament slots when you give it a template).
  5. Print base down, no supports.

The reference

Elements

dirtBare earth with clods, grit and half-sunk pebbles over gentle rises. grass · flowers · reedsSeparate sculpted blades in tufts, parting round patches of bare earth. rock · stone · boulder · pebbleChiselled stones, alone or scattered, bedded in the ground. cliffA storey-high band or mass of broken rock, with scree at its foot. waterSculpted water: swells off the shore and chop round rocks. wall · flagstonesCut stone, fieldstone and brick walls on a tile edge, and stone and plank floors. treeA barked, forking trunk and clumps of foliage covered in separate leaves. All elementstile, let, line, region, stack, use, define, scatter, the bases and the library files.

Status

What the program does today, and what is not built yet. Everything outstanding is on the roadmap, and the editor the preview is becoming is in its design.

WorksNot built yet
Every element on the elements pages builds: dirt, grass, reeds, flowers, water, rocks and scatter, trees, walls, flagstone and plank floors, and cliffs.A line's width=, and building at= a drawn line (walls, paths, surfaces). check names the lines; build refuses them.
DungeonBlocks and OpenLOCK bases from one document; STL, a 3MF painted by material (a Bambu Studio project with a template), and PNG views.Doors, windows and hatches in walls.
The preview, watch, and the whole library (build --all, once for each base).Prebuilt downloads, and builds for Linux and Windows.

Extras