Principles
The editor follows Bret Victor's design work, starting from his principle that creators need an immediate connection to what they create
(Inventing on Principle, 2012). Each idea below is how that work applies to a terrain tile.
See it change as you change it
A change shows in the view while your hand is still on it: the line moves as you drag its point, the rocks grow as you drag their size. Where the full build is too slow for that, the view answers at once with what it can, a draft, and the full build follows (how fast it answers).
Show the state
Nothing a tile depends on is hidden. Lines, regions and fill points are drawn on the plate; the selected entry's source and controls stay visible; the gate's verdict and the overhang paint are always on. From Learnable Programming: the reader should never have to simulate the program in their head.
Point at the thing
The view and the source are two faces of one tile, linked both ways. Point at a stone and you see the words that made it; point at the words and you see the stones. You change a tile by touching it, and the touch is written down as text you can read.
Make by reacting
You rarely start from nothing: you start from a library tile, or from a choice the editor shows you. Completion shows what each element and each word makes, with its picture. Seeds and sweeps lay out several versions to choose between.
Up and down the ladder
From one build, step up to the same tile at eight seeds, or across the whole range of one control, and step back down by clicking the one you want (Up and Down the Ladder of Abstraction).
Ask for little
From Magic Ink: good information software needs as little interaction as possible. The editor shows what matters without being asked, keeps no hidden modes, and gives each gesture one meaning everywhere.
Two rules come from dharmatiles itself:
- The text is the tile. The editor never holds a second model of the tile. Every gesture becomes an edit to the document, made by the same format-preserving editor that keeps your layout and comments (
dt-doc'sops/tile.rs). The file opens in any text editor and any change there shows in the view. - The gate is a gate. The editor shows overhang, it never hides it, and it never offers to loosen a limit. Red and orange mean overhang only; selection and handles use the current theme's accent.
Four surfaces
The whole editor is four working surfaces. Each does several jobs, and each works the same on every screen.
| Control | What it is | What it does |
|---|---|---|
| The view | The tile on the plate, as the preview shows it today. | Orbit, pan and zoom as now. Click to select, click again to climb to what contains it. Drag a handle to move a point. In placing, click to put the thing there. |
| The property sheet | The whole right sidebar. | The selected entry's controls as values you drag or pick, with Help above and Hide and Delete anchored below. It never covers the tile. |
| The text | The document, in a code editor. | Typing, completion, errors at their line, and the other face of every selection. |
| The bar | One line to type into, at the foot of the view. | An element name starts placing it; a command runs (build, seeds, system ol); anything else is a request to the assistant. |
The title, at the top, names the tile and opens the list of tiles (My tiles and the Library, as in the preview today). The gate's verdict sits at the other end of the title. There is no toolbar, no menu bar and no mode switch.
Opening a tile
dharmatiles,dharmatiles preview my-tile.dtileand picking a tile in the list all open the same view, with the tile and its document. There is no separate edit command and no edit mode: a tile you can see is a tile you can change.- Your own tiles (in
$DT_HOME, else~/dharmatiles, or a file you named) are changed in place. Each finished gesture (a drag released, a click placed, a pause in typing) writes the file. - A new tile starts blank (New tile in the title's list: a 1×1 tile with plain ground, size and name to change), or as a copy of any library tile.
- Library tiles open read-only. The first change offers one choice, Make it mine, which copies the document (and the parts it uses stay
lib:references) into My tiles under the same name and carries on with the change there. The library is never written by the editor. - Other editors. The file is still watched. A save from another editor while the page has no unsaved typing simply loads. If the page has unsaved typing, a line over the source says the file changed on disk and offers to load it or keep yours.
- Undo is one history for every kind of change, in the view, in the source or by the assistant: ⌘Z and ⇧⌘Z, or Undo and Redo in the title. Each title control has a scrollable history of named actions for jumping several versions at once. Each step is a text change, so undo is exact.
Selecting
Every solid in a build already carries the stack path that made it (its tag's owner, such as tile/water+grass/scatter#1/2), and every triangle of the final mesh keeps which solid it came from. That is enough to go from any point on the tile to the words that made it.
- Hover lifts the thing under the pointer with a thin accent outline and names it in the bar's hint ("rock 2 of scatter in pool").
- Click selects it. Its node in the source is marked and scrolled into view if needed; its property sheet fills the right sidebar.
- Click again on the same spot climbs: a rock, then its scatter, then the region it stands in, then the tile. Esc or a click on empty plate clears the selection.
- In the text, putting the cursor in a node selects it in the view; hovering a node outlines its geometry without selecting it.
- On the plate, lines, fill points and regions are drawn as a thin overlay, and are selected like any solid.
- One of many. Picking a single rock out of a scatter shows pin this one in the property sheet: the rock becomes its own entry with an
at=where it stands, and the scatter's count drops by one, so the rest stay where they were.
Changing: the property sheet
The property sheet fills the right sidebar, so changing a selection never covers or shifts the tile. Its Help link stays at the top right; Hide and Delete stay at the bottom. Between them it shows the controls the document sets on the selected entry, and a line + more that opens every other control the element takes, faint, at its default. Everything in it comes from the element schema (dharmatiles elements --json), so a new control appears in the sheet the day it is added to the schema.
| Kind of value | In the property sheet |
|---|---|
| Number | Drag left and right to scrub (⇧ for fine), or click to type. The view follows while you drag. Typing opens a helper under the field: what the control takes (mm, 20 to 120, or a range), the program's own check of what is typed, asked as you type, buttons for one number or a range where the control takes a range, and what can go at the caret, picked with the arrows and taken with Enter or Tab. A value is typed bare (ground - 1, 6..15) and quoted when it is written. |
Range (6..10) | Two ends to drag, and the middle to slide both. |
Word (wear=worn) | Two short choices stay visible as buttons; larger sets use a dropdown so controls remain one row high. A number that also has words (wall height full) is typed like a number, and the helper offers its words. |
Point (at=) | A handle on the plate (see placing), and the numbers here. |
Region or line (at=) | The document's names; hover one to light it on the plate. |
| Seed | A die: click for the next seed, drag to run through seeds. |
Setting a control back to its default removes it from the source. The property sheet never shows a value the document does not hold, apart from the faint defaults under + more. Each control's name links to its line on the element's page.
The same scrubbing works in the text: hold ⌥ and drag any number in the document.
Placing and drawing
- Place a thing. Type an element in the bar (
rock,tree,boulder, or a definition such asoak). Its footprint follows the pointer across the tile's surface; a click writesrock at="x,y"into the stack, in squares from the south-west corner as the language has it, and the draft build shows it at once. Click again to place another; Esc stops. Dragging a box instead of clicking writes a range (at="0.4..0.8,0.2..0.5"): the thing goes somewhere in it, by seed. - Place many. Type
scatterand drag over a region; it writesscatter at=pool count=3 { rock }and opens the property sheet on its count. - Paint a surface. Type
dirt,flagstones,planksorwaterand click a region: it writes the entry withat=that region. - Draw a line. Type
line, then click points on the plate; Enter or a double-click ends it. A point dropped on an edge or a corner snaps and is written as its word (west,south-east). The line'swobbleshows as a faint band either side. - Make a region. Type
regionand click inside an area the lines enclose: it writes the region with a fill point there, and a name to type over. Click another area to add a second fill point to the same region. - Move things. A selected line shows its points as handles; a region its fill points; a placed thing its
at=. Dragging a handle rewrites that point. The overlay moves at once, before any build.
Where the plan cares about order, a new entry is put where the plan can run it; the plan orders the stack by what each element reads and writes, so the place in the text is for the reader.
The text
The text pane is a code editor (CodeMirror 6, vendored with the page like three.js, with a KDL v2 grammar). It is a full editor for people who prefer to type, and everything in it is fed by the program.
- Completion everywhere, from the element schema: the elements a stack can hold at this point; an element's controls with their unit, default and one-line help; a word control's words with their descriptions; the document's own line and region names after
at=andboundedBy; edge and corner words;lib:parts; level names in expressions. Completing an element inserts the controls it must have, with the cursor on the first. - Pictures in completion. Each element in the list shows its picture from its element page, so you choose by what it makes.
- Errors as you type. The program's checker (read and plan, no build) runs on every pause in typing, and its errors appear at their span with the same text and help as
dharmatiles check. The view keeps the last good build until the text checks again. - Hover a control for its line from the element page and a link to the page.
- Folding and outline follow the document's nodes.
- Edits from the view arrive as ordinary changes with your cursor kept, and a short accent flash on the changed text so you see what a gesture wrote.
The map
- The map is not another pane. Turn the view to the top (2) and the overlay becomes a map: regions tinted by what fills them, their names, the lines with their widths and wobble, fill points, and placed things' footprints. The same overlay drapes over the tile in every other view, fainter.
- Hide at the foot of the property sheet lets you see the tile without the selected entry. The editor writes KDL's
/-before the node, so the document says exactly what is hidden; the toast offers Undo.
The gate, always in view
The gate's verdict is in the title at all times: passes, or what fails, with the band and overhang figures. The overhang paint is always on, as in the preview.
- Click the verdict to go to the worst patch: the view turns to it and selects the entry that made it, because every overhanging triangle knows its solid. The property sheet then shows the controls most likely to cure it.
- A draft build is marked draft next to the verdict; the gate's verdict always comes from a full build.
Many versions at once
- Seeds. seeds in the bar, or a long press on the seed's die, lays a strip of eight small views under the main one: the same tile at the next eight seeds, turned together with the main view. Click one to take its seed.
- Sweeps. A long press on any number in the property sheet sweeps it: five small views across the control's range, from its lowest to its highest sensible value. Click one to take its value, or drag between them.
- Compare. compare pins the current build beside the next one, so a change can be judged side by side.
The small views are draft builds, made one after another in the background; the strip fills in as they arrive.
How fast it answers
A full build takes from about a second for a plain tile to minutes for trees. The editor never waits for it with nothing to show. It answers in three steps, each replacing the one before:
The overlay. Lines, fill points, regions and placed footprints are drawn by the page from the plan, and move with the hand. Checking the source (read and plan) takes milliseconds.
A draft build at fewer cells per square, with fine detail (grass blades, leaves, pebbles) shown as light stand-in volumes, and only the stack entries the change touches rebuilt. Marked draft.
The full build, which the gate judges. It starts when the hand lets go, and the view swaps to it without moving the camera, as the preview does today.
The second step does not exist yet: draft builds and per-entry rebuilds are on the roadmap as the first work for the editor. Until they exist, the editor works with the first and third steps.
The assistant
With an API key for a language model, the bar also takes requests in words: put three mossy rocks on the left bank, make the shore wander more, why is this red?. The model works through the same edits as every other gesture, so what it does is text you can read, and one undo takes it back.
- Asking. Anything typed in the bar that is not an element or a command is a request; the bar shows Ask before you send it. ⌥Enter sends anything as a request.
- What it sees. The document, the selection (so these rocks means the selected ones), the plan, the gate's verdict, and on request pictures of the current build from any view, painted with overhang as the view paints it.
- What it can do. The tools the program's MCP server already offers (check a document, list and describe elements, build, render, audit) and the document edits: set or remove a control, add or remove a node. It can change only the open document. It can read the library and the element pages.
- What you see. Its answer in a small card over the bar, with the edits it suggests as a difference: lines to add and lines to remove, marked in the source and shown as a draft in the view. Nothing is written until you accept; Accept applies them all as one undo step named after the request, Reject drops them, and you can keep talking to change the suggestion first.
- Fixing what the gate refuses. The assistant builds its suggestion before showing it, is given the gate's verdict, and may revise it a small number of times; the card says whether the suggestion passes.
- The key is entered once in settings (the title's menu), and kept by the program in your config folder (on macOS, in the Keychain once the app is native). The program, not the page, talks to the provider, so the key never sits in the browser, and nothing is sent anywhere else. The assistant shows how much each request used.
- The model. Claude by default, with the provider and model chosen in settings.
Every screen
The same four surfaces on every screen, rearranged. The view always has the most room.
| Screen | Layout |
|---|---|
| Wide (1100 px and more) | Document, view and property sheet sit side by side. The selected entry's properties occupy the whole right sidebar. |
| Medium (700–1100 px) | The view comes first; the property sheet and document stack below it without floating over the tile. |
| Narrow (under 700 px) | The same single-column order keeps the view, selected properties and source available without a duplicate outline. |
| Touch | Does |
|---|---|
| One finger drag | Orbit; on a handle, move it |
| Two fingers | Pan and pinch to zoom |
| Tap | Select; tap again to climb |
| Long press | On the tile while placing, place; on a value, sweep it |
| Two-finger tap, three-finger tap | Undo, redo |
Everything works with a keyboard alone too: / goes to the bar, Tab moves between the panes, the arrow keys move a selected handle by one cell, and the preview's view keys stay as they are. Focus is always visible; with reduced motion set, nothing animates.
Web, then native
The editor is one web page served by the program, as the preview is. It stays one page through every step:
- In the browser, from
dharmatileson your own machine. This is the first version, and stays. - A desktop app (Tauri): the same page in a window, with the program inside the app instead of behind a port. It adds files opened from Finder, the Keychain for the key, and a menu bar with the same commands as the bar.
- Tablets and phones: view and edit first, built by the program on your computer over the local network, with a pairing code shown on the computer. This needs the smaller meshes on the roadmap (a 2×2 grass tile is 140 MB today). Building on the tablet itself comes later, and needs a mesh library that runs there.
What the program needs
A clickable mockup of the editor, with a made-up tile and nothing behind it, is at editor-mockup.html.
Most of the editor is the page. These are the program's parts, each small, built on what exists:
| Need | Built on |
|---|---|
| The mesh carries, for each triangle, which stack entry made it (a table of owner paths and an index per triangle). | Solid tags and the per-triangle source ids the materials already use. |
| The plan for the page: lines as polylines, regions as masks, fill points, footprints, each entry's reads and writes, and the spans of every node. | dt-eval::check and dt-doc's spans. |
| An edit call: a list of edits in, the new text and its changed ranges out. | dt-doc's ops/tile.rs; adding and removing a node, and /-, are new. |
| Building from text the page sends, without writing the file, for drafts and sweeps. A draft is one request, answered with its mesh; a newer draft of the same tile takes the place of an older one. | The preview's build queue, which holds every build (drafts first, then the tiles asked for, then the tiles whose files changed). |
| The page told of every change as it happens, and caught up after a drop. A tile is named by an id that does not change while its file keeps its path; each change has a revision, and a stream that reconnects says the last one it saw. | The preview's event stream. |
| Writing the file, refused if it changed since the page read it. | The file watcher. |
| Draft builds and per-entry rebuilds. | The stack's slot order, which already fixes every solid's id. |
| The assistant: a streamed conversation with the provider, the tools, the key in settings. | The MCP server's tools. |
Protection for writes. Today the server checks that the request's Host is the loopback, which stops DNS rebinding but not a web page elsewhere posting to 127.0.0.1. Writing files needs more: a secret made at start and given only to the page, and a check of the request's Origin. | The preview server. |
Stages
Each stage is usable on its own, and ends when it is used to make a real tile.
- Built — Select. Owner paths in the mesh; hover, click and climb; the source and property panes linked to the view.
- Built — Edit. The source pane editable with completion and errors; the property sheet; writing the file; one undo; Make it mine; the write protection.
- Built — Draft. Draft builds answer while the property sheet is dragged. Per-entry rebuilding remains.
- Built — Place and draw. The bar; placing, scattering, painting; lines and regions on the plate; handles; the map overlay; mute and delete.
- The gate and the ladder. The verdict that jumps to the worst patch; seeds, sweeps and compare.
- The assistant.
- Every screen: the medium and narrow layouts and touch, tested on a tablet and a phone against a build on the computer.
- The desktop app, then the tablet and phone over the network.
What it does not do
- No second model. No hidden scene, no project file, no state that is not in the document (apart from the camera, the selection and the panes, which the browser remembers).
- No property sheet for everything. The docked sheet holds one selected entry's controls; there is no panel listing every control of every entry.
- No node graph or duplicate outline. The document is the ordering surface; the plan derives its execution order without asking the editor to show a second list.
- No modes. Placing ends with a click elsewhere or Esc; there is no edit mode, select tool or move tool.
- No sculpting. You do not push vertices. You change what a tile is made of, and the program grows the geometry; that is what keeps every tile printable.
- No loosening the gate. Nothing in the editor turns a limit off or hides overhang.
Open questions
- Whether placing several things writes each as its own entry (
rock at=…, three rocks, three lines) or gathers them into onescatterwith listed points, which the language does not have yet. It may depend on the case; to be worked out by trying both.