Design · stages 1–4 built

The editor

The preview becomes the editor. You open a tile and it is on the plate, with its document beside it. Click any stone and its line in the document lights up; drag one of its numbers and the stone changes; type rock and click the bank to put one there. Every change, made by hand, in the view or by an assistant, is a change to the document's text, and the text is always the tile.

Try the mockup A made-up tile in your browser to click, drag, place on and ask. Nothing behind it is built.

One view
the preview is the editor
Surfaces
view, text, properties and bar
Truth
the .dtile text
Runs
web first, then desktop, then tablets and phones

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:

Four surfaces

The whole editor is four working surfaces. Each does several jobs, and each works the same on every screen.

water+grass▾ My tiles passes · band 0.03% tile size="1x1" line shore wobble=5 {…} region pool { … } region bank { … } stack { dirt at=bank grass at=bank ground at=pool … scatter at=pool count=2 { rock size="6..10" } water } document · completion · errors at their line Type an element, a command, or ask… the bar: place · command · completion · ask PROPERTIESHelp ↗ scatter · rock 1 of 2 count‹ 2 › size6‥10 mm seed⚄ 97 + 4 more Hide Delete the view: select · drag · place
Desktop. A rock is selected: its scatter is lit in the source and its property sheet fills the right sidebar, with Help at the top and Hide and Delete at the bottom.
ControlWhat it isWhat it does
The viewThe 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 sheetThe 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 textThe document, in a code editor.Typing, completion, errors at their line, and the other face of every selection.
The barOne 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

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.

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 valueIn the property sheet
NumberDrag 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.
SeedA 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

+ rock at="0.64,0.42" type rock, click the plate westeast line shore { through west … east } type line, click points; edges snap to words bank region bank { fill "0.4,0.8" } type region, click inside the lines
Placing, drawing a line, and filling a region. Each writes one node into the text.

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.

The map

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.

Many versions at once

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:

At once

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.

Under a second

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.

When ready

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.

Every screen

The same four surfaces on every screen, rearranged. The view always has the most room.

water+grass ▾ passes scattercount‹ 2 ›size6‥10 ‹ Type an element, a command, or ask… property sheet stays beside the view; text follows below water+grass ▾ scatter · rock 1 of 2 count ‹ 2 › size 6‥10 Type or ask… document stack { dirt at=bank grass at=bank scatter at=pool count=2 rock size="6..10" water Type or ask… Tablet, landscape Phone: the sheet low Phone: the sheet high
Tablet and phone. The view comes first, followed by the selected entry's property sheet and the document. The placing bar stays at the foot of the view, where a thumb reaches it.
ScreenLayout
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.
TouchDoes
One finger dragOrbit; on a handle, move it
Two fingersPan and pinch to zoom
TapSelect; tap again to climb
Long pressOn the tile while placing, place; on a value, sweep it
Two-finger tap, three-finger tapUndo, 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:

  1. In the browser, from dharmatiles on your own machine. This is the first version, and stays.
  2. 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.
  3. 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:

NeedBuilt 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.

  1. Built — Select. Owner paths in the mesh; hover, click and climb; the source and property panes linked to the view.
  2. Built — Edit. The source pane editable with completion and errors; the property sheet; writing the file; one undo; Make it mine; the write protection.
  3. Built — Draft. Draft builds answer while the property sheet is dragged. Per-entry rebuilding remains.
  4. Built — Place and draw. The bar; placing, scattering, painting; lines and regions on the plate; handles; the map overlay; mute and delete.
  5. The gate and the ladder. The verdict that jumps to the worst patch; seeds, sweeps and compare.
  6. The assistant.
  7. Every screen: the medium and narrow layouts and touch, tested on a tablet and a phone against a build on the computer.
  8. The desktop app, then the tablet and phone over the network.

What it does not do

Open questions