Proposal — Groundworks

← Wiki

Built Four features that make the ground itself something you buy, so that shaping the route stops costing a gun. Phases 1–3 shipped — Rampart, Tar, Cut and the detour readout are in the game. Phase 4, the Detour Dividend, was deliberately not built; see the phases below for why. The page is kept as the record of the argument, and the board halfway down is still a live mockup you can play with.

What shipped

All three verbs and the readout are live. Everything below this section is the original proposal, unedited apart from the phase list — a proposal rewritten after the fact to match what was built stops being a record of why it was built.

Twenty-nine assertions in tools/smoke.mjs cover the three verbs, including that a rampart blocks pathing, that a resumed one still does, that tar slows a creep standing on it and not one beside it, and that a rampart cannot seal the base.

The problem

The wiki opens by saying TerraTD is a tower defense game about shaping the route. There is exactly one way to shape it: place a tower. Towers are the walls, so every tile of shape is also a gun you bought, and the cheapest gun in the shop is —

What shape costs, measured

This is measurable without guessing, because the game already measures it. The map-quality gate's mazeGain lays wall segments near the current route one at a time and keeps only the ones that make the walk longer — the same greedy the generator uses to decide whether a map is worth serving you. Give it a budget in tiles and it reports the exchange rate between walls and route.

Run below, in your browser, on maps generated from a fixed seed — so this table is the current generator's answer, not a screenshot of an old one.

—

Two curves in that table have never been reconciled with each other. The quality gate models a player who builds —. The economy models a player who can afford a small fraction of that for most of a run. The generator certifies a map as mazeable using a budget the wallet does not issue.

A third of every map is inert

—

src/core/level.js has three tile values — GROUND, ROCK, LANE — and a player can change none of them. Rock cannot be walked, built on, shot over or removed, and nothing that happens in a run ever touches it. On Maul maps that is roughly a third of the arena sitting outside the game.

The late game changes numbers, never the board

Past tier 4, overcharge is the only sink, and by design it never touches range or fire rate — a tower that grew its footprint every level would redraw your maze under you. That is the right call for a stat upgrade. It also means that once your last tile is placed, a run has no board decisions left in it: the maze you have at wave 20 is the maze you die with, and every purchase after that is the same button at —

The proposal

Four features. Three of them are ways to spend coins on the ground instead of on a gun, all placed on the same tiles, from the same wallet, under the same rules as a tower. The fourth is the readout that makes the other three legible.

Nothing here relaxes the one rule that keeps the game safe. A placement that would leave any spawn with no path to the base is refused today by a trial BFS in tryPlaceTower. Rampart, Cut and Tar all go through that same check, so none of them can build a softlock — and Cut, which removes a wall, can never fail it at all.

Why a Rampart rather than just a cheaper tower

Because the interesting tension is supposed to be shape versus firepower, and today that tension is hidden inside a Sword's price tag. A tower bought as a wall is a purchase you are quietly overpaying for and slightly embarrassed about. Split the two and the decision becomes explicit: a Rampart produces nothing, ever, and the tile it takes is a tile no gun will stand on. You are choosing to buy walking time instead of damage, and you can see the exchange rate while you do it.

Why Cut escalates

Overcharge exists because a run's income has to have somewhere to go, and its cost grows faster than its power on purpose so that spending is unbounded while board power is not. Cut borrows the shape of that curve for the opposite kind of purchase: instead of another increment on a number, each one changes the map. Late-run money buys you a new switchback carved through rock that was never yours — expensive, escalating, and never the same twice.

Why Tar is allowed on lane

Lane is the author's reservation: this ground was never yours, and it exists so you cannot wall a spawn shut. Tar does not block anything, so it does not touch what the rule is protecting — and it gives Maul maps the one thing they lack, which is any decision at all about the corridors that make them Maul maps. This is the most arguable of the four; see the risks.

What this is not

What the wallet buys, before and after

Same money, same maps, same measurement as the table above — the only thing that changes is whether shape is priced as a gun.

The fourth feature: the detour readout

The number the whole game is about is currently invisible. The path field needed to compute it is recomputed on every build already, so this is a division and a HUD pill.

Route length across every spawn, over the same map's shortest route with your towers removed. It is ×1.00 on an empty board and it is the only honest score of how well you are playing the game's stated verb.

Try it

A real generated map, seeded so everyone reading this page gets the same ground. Pick a verb, then tap tiles. The route redraws, the detour recomputes, and a placement that would strand a spawn is refused exactly as the game refuses one now.

Loading the map…

Rampart and Cut are fully live here: both re-run the real BFS, and both refuse exactly what the game refuses. Two things are mockup-only — Tar is drawn but not simulated, because there are no creeps on this board for its slow to act on, and taking a placement back is free, where in game a Rampart would sell back at the same — everything else does.

Phases

  1. BuiltPhase 1 — Rampart and the detour readout. One shop entry, one tile state, one HUD pill. Rampart reuses the tower placement path wholesale: same buildable-terrain check, same trial BFS, same sell refund, same blocked-tile set. Shippable alone, and on its own it is the whole thesis — measure it with npm run endless before deciding anything else is needed.
  2. BuiltPhase 2 — Tar. Needs a per-tile slow applied during enemy movement. The slot machinery exists: Cryo and Slow Field already occupy separate multiplicative slots, so ground slow becomes a third one and nothing has to be redesigned to make them stack sanely.
  3. BuiltPhase 3 — Cut. The big one, because it mutates lv.tiles mid-run. Resume is free — saveGame already serializes the whole level and resumeFromSave rebuilds the path field from the restored tiles — but the map's identity is no longer purely its seed, which matters to anything that compares two runs of the same daily map.
  4. Not builtPhase 4 — the Detour Dividend, only if. The "only if" was not met, so it was not built. Per-day scoreboard scoping still does not exist, and this phase said in advance not to ship a new income source before it did. The readout that would feed it is live, so the door is open whenever the board is ready. Pay a per-wave bonus scaled by the detour multiplier, so shaping the route pays directly rather than only through more seconds under fire. Deliberately last and deliberately conditional: it is a new income source, and the scoreboard is all-time. Do not ship it before per-day scoring exists.

Risks & open questions