Reference · tiles that touch

Maps

A map is the table as it will be: tiles placed on a grid of squares, turned and raised, seen whole in the editor's 3D view before anything prints. It is the same .dmap document as a print list; a print list is a map whose pieces have no place yet.

Document
.dmap, KDL v2
A piece has
at, rot, bottom, seed
In the editor
Map beside Tile and Plates
Plates read it
Print what’s missing
The editor with a map open: eight tiles laid out on a grid in 3D, and the panel listing the map’s pieces by tile with have and to print marks. The editor with a map open: eight tiles laid out on a grid in 3D, and the panel listing the map’s pieces by tile with have and to print marks.
  1. The trail ends at the map.
  2. On the map: what is in your inventory and what is left to print, with Add tiles and Print what’s missing.
  3. Sort and show the pieces, or find one by name.
  4. The pieces, one row per tile: how many, how many you have, how many to print.
  5. Variants: a new seed for every piece you do not have, or for the whole board.
  6. The map in 3D, each piece at its place. Look down (Top) to move one.
  7. The printer this map prints on.

The file

The map follows the tile language's habits: lengths carry units, points read across and down from the north-west corner, and everything you can see on screen is written in the source. The editor writes at and rot on every placed piece, and bottom, seed and print only when they are not the default.

dharmatiles version="1.0.0"

map {
    about "A stream crossing, a ruined wall to the north."
    grid cols=8 rows=5                         // squares
    let $plinth "20dmm"                        // the map's own named height

    piece p1 "lib:tiles/ground/2x2-glade"               at="(0sq, 0sq)" rot=0
    piece p2 "lib:tiles/water/1x1-water-corridor+grass" at="(2sq, 1sq)" rot=90 seed=3
    piece p3 "lib:tiles/walls/1x1-wall-stone"           at="(4sq, 1sq)" rot=180
    piece p4 "lib:tiles/cliffs/2x1-cliff"               at="(4sq, 0sq)" rot=0 bottom="$wallHeight"
    piece p7 "lib:tiles/walls/1x1-wall-stone"           at="(5sq, 1sq)" rot=0 bottom="$plinth + 2mm"
    piece p8 "lib:tiles/ground/1x1-grass"               at="(6sq, 1sq)" rot=0 bottom="50mm"
    piece p5 "home:meadows/glade"                       at="(0sq, 2sq)" rot=0 print=skip
    piece p6 "lib:tiles/ground/1x1-grass"                                    // no at: in the tray
}

plates printer="bambu/x1c-ams" {
    pin p4 plate=1 at="(0mm, 120mm)"            // dropped here on a plate: the packer keeps it
}
WordMeans
piece p1 "…"A piece. The optional name after piece is its id: what a pin calls it by, and what every change the editor makes names the piece by. The editor gives one to each piece it places (p1, p2, the first not used), and the first change it makes to a file whose pieces have none writes one on every piece, in that same write, and says so once. An id is just a word: write your own, keep it unique. Ids are each piece's own.
at="(2sq, 1sq)"Where the piece's north-west corner stands, across and then down from the map's north-west corner. sq is a square of the piece's own system (35 mm on DungeonBlocks, 25.4 on OpenLOCK); mm is millimetres. A piece with no at is in the tray: it prints, and is not drawn.
rot=900, 90, 180 or 270 degrees clockwise, seen from above, about the middle of the footprint. A 2x1 turned a quarter is 1x2, and at is still the corner of what it covers now.
bottom="$wallHeight"How high the tile's zero (its ground level) stands above the map's ground, 0 by default: a $ name from library/parts/heights.dtile or the map's own let, or a length with units, or a sum of them ($plinth + 2mm). See Bottom.
seed=3Which variant of the tile. Left off, the piece has the tile's own seed. To see variants before choosing, open the tile and press the die on its seed: five small pictures of the tile, one per seed.
system="ol"The piece is built for that base system, in place of the plates line's. A map may mix them.
print=skipmissing (the default), always or skip, as in a print list. A skipped piece stays on the map and is left off the plates.
count=Only in the tray: a placed piece is one piece. Place on a tray line puts one copy on the map as a piece of its own (its own line, a seed you do not own) and lowers the count; Place all places every copy.
grid cols=8 rows=5The map's extent in squares, drawn as the ground's grid. A document with a grid, or with any placed piece, opens as a map; a new map has one.
let $plinth "20dmm"A name for a height, visible to every piece of the map as the standard ones are.
pin p4 plate=1 at="(0mm, 120mm)" turn=90Inside the plates line. See Pins on the plates.

A mistake is shown at its text with a hint, as in any document: a place that is not a pair of lengths, a rot that is not a quarter turn, a bottom that names nothing (or the old word height, which says it is now bottom), two pieces with one id, a pin for a piece that is not there. A map holds one map and at most one plates line.

Placing pieces

Bottom

A piece's bottom is an ordinary height, written the way a tile writes one, and it is where the tile's zero stands above the map's ground. Zero, the default, puts the tile's ground level on the map's ground, and the connector (which hangs below a tile's zero) is under the ground. A piece at bottom="$wallHeight" stands with its zero 33.1 dmm up, and bottom="50mm" 50 mm up, its connector hanging in the air under it. The names are the ones every tile sees, $groundHeight 5, $floorHeight 7.4, $shortWallHeight 16.55, $wallHeight 33.1 and $tallWallHeight 72.3 (dmm), plus any let of the map. dmm scales with the system; mm does not. A name that varies across a tile ($waterEdgeHeight) is refused: a piece's bottom is one length.

Risers are later: they will be generated pieces in their own right, through the same build, cache and plates path as any tile. Until then a raised piece is drawn at its level with nothing under it, and the plates do not print one.

The piece list

At the top of the map level is the map as a plan: its squares on the plate colour, and every placed piece in its place and turn as a picture of the tile from above (at the piece's own seed, the same small builds the Add tiles pictures are). A piece you own wears a green mark and one you own only in the other colour mode a yellow one; a piece left off is dashed and faint; the selection is outlined. Pressing a piece selects it (Shift adds to the selection), and the pointer on one lights it in the view. Beside it, the counts: pieces placed, on your shelf, to print, other colour, left off.

The panel's map level lists the map's pieces in up to three sections, each hidden while empty: Placed (a row for each tile: its name, × count, N have, N to print, and N other colour in the caution yellow where you own the tile and seed only in the other colour mode), Not placed (the tray, with Place and Place all) and Left off (print=skip). Sort by Name, Count or To print first (a tie falls back to the name, then the piece's id); Show All, To print, Have or Other colour; Find narrows the rows by the words of a tile's name as you type, and what you have typed stays whatever the map does meanwhile. A filter or search takes pieces out before the rows are made, so a row counts only the pieces that pass. The sort and filter are kept for each map in your browser.

Pointing at a row outlines its pieces in the view; pressing it selects them all. While pieces are selected their rows are marked and the list scrolls to the first, so a press on a piece in the view and a press on a row say the same thing.

In the editor

The title bar's Map sits beside Tile and Plates. A document with placed pieces opens as a map and a print list opens on its plates; the switch goes between a document's two views, and the choice is kept for the session. The panel's levels are the map, the Add step and each folder it walks, one piece and a property of it, and they are part of the same path the page's crumbs show for a tile: Places › My tiles › first-plate.dmap › 8 pieces › Seed. The ‹ button and Esc climb it one level at a time, a crumb goes to its level, and the address in the URL is the same path (#tile=…&pieces=p2,p3&prop=seed), so a reload, a pasted link and the browser's Back and Forward land on the level you were on.

Every change is an edit of the map's text, made by the program and keeping every other byte. A change names the piece by its id and the revision of the file it was made against; the program numbers every state of a file, a number that only rises, and counts a change from outside (your text editor, another tab) as a new state. The answer carries the text it replaced, the text it wrote, the new revision and the map as it now reads, so the view shows the change at once and an older word that arrives late can never put the map back. Changes to one map are made one after another, each from the map as the one before left it, so two quick turns of a piece are two turns.

If the file changed since a change was made (another tab, your text editor), the program refuses it, nothing is written, the page says so and takes the file as it is now: look at it and do it again.

Undo and Redo (the title bar, or ⌘Z and ⌘⇧Z) are one history for the map: placing, moving, turning, variants, pins, the plates' settings, the printer, the print list's counts and the saves of the Source. Each step is made against the revision the history last left the file at, so a file changed by anyone else since is refused and the history ends; a toast's Undo is the same Undo, offered only while its change is still the last one.

The backdrop

The tiles stand on the ground, never in the air. The Backdrop row of the ⋯ menu chooses the place; the choice is yours, kept in this browser, and used for the map and for the tile editor alike. It is never in a map or a tile: a backdrop cannot change what prints.

The map's ground is at zero, and it is solid. From above it hides whatever of a piece is below it (the connector at a bottom of 0); from underneath it is earth (soil under the meadow, rock in the cavern, the underside of the table) and hides what stands on it, and below the horizon the world is dark. The tile editor's ground, at the tile's lowest point, is solid the same way: choose Plain to look at a tile's underside. Each piece casts a soft shadow on it. The plates keep the printer's bed whatever you chose. Desert, Jungle, Swamp and Town come later.

Detail by distance

Every piece is the real mesh of its tile, so a table of forty pieces is drawn from three tiers (see the cache): super-low (4 000 to 12 000 triangles) far away, draft (12 000 to 40 000) in the middle, and full (about 330 000) close up and for what you look at. The tier is chosen by the piece's size on screen, and it has a margin so that it does not flicker: a piece goes up to full at 120 pixels and back to draft only under 90, and from super-low to draft at 40 and back under 30, so a small move of the camera never changes a tier. The map as a whole is held under 5.5 million triangles (sixteen full tiles, so a 4 × 4 map close up is all full). When the budget is short the pieces that are smallest on screen lose first, fulls before lows; a piece that already shows full keeps it unless another is clearly bigger (by a quarter), and equal pieces go to the nearer, then by name, never by the order they came in. Twelve copies of one tile at one seed are one mesh.

Nothing waits for a build. While the pieces’ meshes come, the status line says loading with how many of the pieces asked for are done and the piece being built, with the bar under it and the same row at the top of the messages panel as a tile’s build; a piece that cannot be built is an error in the panel. Every piece shows at once, as a box until its tile's super-low mesh comes from the cache or is built; a full build is asked for every piece that is close and fits the budget, all together (the program queues them, nearest first, and drops one the camera has left), and the lower tier stays on screen until it lands. A new variant keeps the old mesh until its own swaps in. A piece does not pop when its mesh changes (a box becomes a tile, one tier gives way to the next): the old mesh and the new are both drawn for about a third of a second and each pixel goes to one or the other by a fine dither pattern, so the change is a fade without any transparency; the paint and the overhang colours are the meshes' own all the way through, a piece you move or select swaps the same, and with reduce motion on it swaps at once. The status line says what is on screen: draft · not yet checked · 2 full · 4 drafts · 7 distant. Overhang is painted red and orange on every tier, by angle; only the full build is checked by the printability gate, and only full builds are ever exported.

Variants and seeds

A seed is a variant of a tile, and in your inventory it is what makes a piece yours. New seeds are the default: a tile you put on the map gets a seed you do not own (of that tile, system and colour mode), that no piece of the map already uses and that is not the tile's own, unless you own none of it and the map does not use it, in which case the tile's own seed is already new and nothing is written.

Each variant is its own build and its own mesh: twelve variants of one grass tile are twelve builds (about 3 s each) and twelve meshes, twelve copies at one seed are one. The build is paid once per seed and kept in the cache, so a variant you have seen is instant from then on.

The inventory on the map

The map reads the inventory and never writes to it. The piece list says what the shelf says of each piece (see The piece list); a switch in the ⋯ menu, off until you turn it on, also puts a pill over each placed piece in the view, which covers the tile. The words are the same: have where a print you own is that piece (tile, seed, system and colour mode; copies of one piece share what you own, in the order written), to print where it prints, have, other colour in the caution yellow where you own the tile and seed only in the other colour mode (it still prints), left off for print=skip. The colour mode is the map's: its plates line's mode, else multicolour for a printer with an AMS.

The panel says 3 in inventory · 11 to print, once. Print what's missing goes to Plates for this map, which lays out only the pieces the inventory lacks. Everything on your shelf says so rather than lay out nothing, and the map stays as it was.

A crown over a taller neighbour

A tree's crown reaches past its square. When a piece's crown reaches over a neighbour that stands taller than the crown's lowest point, the stream carries a caution note, The crown of 1x1-grass-tree (p2) reaches over 1x1-wall-stone (p3), which stands 2 mm up into it, found from the pieces' real shapes (their draft builds, kept in the cache), not from their squares. It is a note, never a refusal: nothing is forbidden, the real shapes just meet there.

Pins on the plates

Plates are computed from the pieces, the printer and the settings, so nothing about them is stored, except what you override by hand. Looking down on a plate in the plates view, press a piece and drag it: where you let go it is pinned. A pin is a line inside the plates line, naming the piece by its id (the editor gives it one), its plate and where its footprint's north-west corner stands, across and down from the bed's north-west corner; turn=90 if it is turned a quarter.

plates printer="bambu/x1c-ams" mode="multicolour" {
    pin p4 plate=1 at="(0mm, 120mm)"
    pin p7 plate=2 at="(3sq, 0sq)" turn=90
}

Rules