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
}
| Word | Means |
|---|---|
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=90 | 0, 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=3 | Which 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=skip | missing (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=5 | The 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=90 | Inside 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
- Everything snaps to squares. A piece is a rectangle of whole squares (1×1, 2×1, 2×2, 3×3 in the library) and stands on the whole squares of its own system. An OpenLOCK piece on a DungeonBlocks map sits on a finer lattice; each piece is placed in the squares of its own base, and the ground is zero for both, so
z = 0lines up across systems and the connectors hang below it. - A place that is taken is the nearest free one. Moving, turning, duplicating and putting a tile down never leave a piece on another at the same bottom; the toast says moved to the nearest free place when it had to. A piece at another bottom floats over the one below.
- Turning is 90 degrees. A turn that would collide looks for the nearest free place and says so.
- Duplicate puts the copy next to the original, with the same seed: the same piece until you make it a variant.
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.
- The view is the same 3D view as the tile's: orbit, pan and zoom as always, with Iso, Top, Low and Close-up as presets (Close-up frames the selected piece). A map opens framed on its pieces (the plates frame the printer’s bed), a preset frames again when pieces arrive, and a view you moved stays where you put it through every edit; each of a document’s views (tile, map, plates) comes back as you left it when you return to it. Press a piece to select it, Shift-press to add or take one away; the selection is outlined and the rest of the map fades behind it, by the same amount and in the same time as the rest of a tile does (see the preview), and comes back when you let go. Pointing at a piece, or at its row in the list, lifts it out of the rest the same way.
- The map level says N in inventory · M to print, has Add tiles (the level below) and Print what's missing, lists the pieces and has the variants for the whole board. The list is the piece list, below the one piece's controls too.
- One piece shows its place, turn (⟲ ⟳), level, seed and print setting, the variants, Open tile (the tile editor, with the map one click back on the title bar's Map), Duplicate and Remove. With several selected the panel acts on all of them. A seed or length you are typing in the panel stays as you typed it until you press Enter (it is then written) or leave the field (it is dropped), whatever the map does meanwhile.
- A property is a level of its own: Bottom lists the height names and takes a length; Seed shows the seeds you own as chips, takes a number, has New variant, and has the die the tile’s own
seedrow has: the same strip of five small pictures (the piece’s seed first, a square on the seeds you own), and choosing one sets the piece’s seed. - Add is a step of the map's trail, and the folders you walk to find a tile are steps of it, in the same trail as every other level: Places › My tiles › first-plate.dmap › Add › Places › My tiles › dungeon. Pressing Add tiles goes straight to the folder you last browsed in Add this session, else the folder the map itself is in, with every step to it in the trail. Press a folder to go into it (deeper slides in from the right); ‹, Esc, ⌘[ or a crumb go back up it, one folder at a time (from Places, to the map). Every crumb is pressable. The address names the folder (
#tile=…&add=<place>&adir=dungeon;add=alone is Places), and each folder is a step of the browser's history, so a reload and Back and Forward land on the folder you were in. The pane draws no navigation of its own. It shows the folder: the same places and folders as the folder levels (there is one walk of them, not two), and the tiles as pictures in a two-column grid, each the real tile (its super-low mesh, seen from above at an angle on the plate colour) with its size and have or need. Press a tile to put it on the map at the nearest free place (the program picks the place, so quick presses never stack two on one square); drag it onto the view to choose where. A filter searches the place. Above is the piece list, compact: the row of the tile you just added lights up, and a row you press leaves Add for that piece's level. On a short window (a panel under about 540 px high) the list folds to one line, 21 on the map · 1x1-grass just added, and the folders get the room. New map in a folder you own starts an empty map with a grid. - Moving. Look down on the map (Top) and drag a piece: it follows the pointer at its level and snaps to its own squares; the selection moves together. In the other views a drag orbits, and a press still selects. R turns the selection (⇧R the other way), D duplicates it, ⌫ removes it, Esc lets go of it, ⌘Z takes the last change back.
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.
- Wilderness (the default): a mottled green ground with a faint grid, under a horizon of two flat ranges of blue-grey mountains (single peaks over long runs, the far range paler) and a plain blue sky. In the dark theme it is evening.
- Cavern: a dark rock floor and walls all round, with a warm light over the tiles.
- Table: a wooden tabletop under the tiles, a dim room beyond its edge.
- Plain: the plate colour and the grid, as the tile view has always looked.
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.
- New variant gives the selected piece a new seed. All of this tile does it for every piece of that tile on the map, each its own. Whole board does every piece.
- New seed for every piece I don't have gives each piece your shelf lacks a fresh variant and leaves what you own as it is: what you already have stays, and what you are about to print is new.
- Same as one I have is a choice, not an accident: a piece's Seed level lists the seeds you own as chips, and picking one makes the piece that one (its pill turns to have). Reprinting a lost piece reuses its recorded seed through the inventory's Reprint.
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
}
- The packer puts pinned pieces down first, as they are, and packs the rest around them; a plate that holds a pin is not centred (that would move it).
- A pin that cannot hold (outside the margin, on an excluded zone, on another pin, or on a plate that would then need more filaments than the printer has) is said in the messages, and its piece is packed like the rest. A pin for a piece that does not print (
print=skip, or one your inventory holds) is said and not used. - The plates panel lists the pins with Unpin and Unpin all; a pinned piece wears a pinned pill. Pinning and unpinning are edits of the text with Undo, and removing a piece takes its pin with it.
- A pin names one piece, so a piece line with a
countabove one cannot be pinned: give each copy its own line. - One
platesline serves one printer and one base: a pin means something only for the bed it was dropped on.
Rules
- A map says what the scene is; the inventory says what you own; the plates say how it prints on your printer today. Personal state stays out of maps.
- The backdrop is a preference of the viewer, never of a document.
- Every piece snaps to the squares of its own system, and the ground,
z = 0, is the same for every system. - A piece's
bottomis the height of its tile's zero above the map's ground; at 0 the connector is under the ground. - Nothing is forbidden by the shapes of the pieces: a crown over a taller neighbour is a note.
- Only a full build is checked, and only a full build is printed. Every other tier says so.
- A new piece, and a new variant, gets a seed you do not own; the same as one you have is an explicit choice.
- Every change to a map is an edit of its text, made against a revision, with Undo and Redo; a file that changed since is refused, never overwritten.