DES-05 - A proper tower-defense farm (for David's OK)

Status: DRAFT 2026-10-07 by Claude, from David's round-2 notes. Nothing here is built until David says OK.

Covers REVIEW-23 (map, building, paths) and REVIEW-24 (unlocks).

The idea in one breath

Bugs walk from the forest to your crops along the shortest open path. You build fences, walls and defences in a wide

yard around the farm to make that path long and lead it past the things that hurt them. Termites and wall-breakers are

the answer to a perfect maze: they break through.

What changes for the player

1. More room. The yard around the farm goes from 2 tiles to 3 tiles on every side (David: "three blocks gap

buffer"), and the plains around it widen so there is room to walk and to grow. The frog's rain circle and the

wizard's rune stone move out to the edge of the plains, out of the way of the farm as it expands.

2. Build in the yard, crops in the farm. Anything that is not a crop goes in the 3-tile yard. The farmland stays

crops-only (scarecrows still sit between crops).

3. Bugs follow paths you shape. Every bug walks the shortest open path to a crop. A fence or wall changes that path

at once; you see the new route as a faint trail while placing.

4. You cannot wall the farm shut. A piece that would leave bugs no path at all is refused (the check turns red and

says why). This keeps it a maze, not a box.

5. Termites and wall-breakers keep the maze honest. Termites still plan ONE breach road through your walls to your

best crops and chew it (as built in ENEMY-03); rhino and stag beetles smash stone and brick. So a long maze has a

weak point, and walls need repair (REPAIR ALL stays).

6. The farmer walks through small things. Fences, walls, traps and decor never block him; only big buildings

(house, barn, windmill, greenhouse) do.

7. Drag to build. Place a fence, drag, and it lays a line that joins up, the price counting up as you drag

(The Sims 2 wall tool). The X and check sit above what you are placing.

8. Apiaries feed nearby hives. One apiary feeds the 2-3 nearest hives by itself.

9. Unlocks, not free upgrades (REVIEW-24). You start with wood fences and the basic defences. Better versions

unlock as you progress: cobblestone walls at wave 10, brick at wave 20, each needing an upgrade bought first.

The same rule for every "better version" of a thing - never on day one for about the same price.

Choices for David (my pick first)

1. Maze style: you shape the path, but can never fully block it (my pick) - or fixed roads you build beside

(classic tower defense, less freedom).

2. Yard size: 3 tiles all round (my pick, your words) - or bigger.

3. Unlock gates: by wave number plus an upgrade purchase (my pick) - or by upgrades only.

4. Bug path preview while placing: yes (my pick) - or hidden, players find out.

For the lanes - technical notes

• WorldLayout: YARD_DEPTH 2 -> 3; PLAINS_WIDTH 4 -> 7 (room for 3-tile yard + 2-cell walk ring + the moved rain

circle / rune stone); MAX_FARM stays 9. Everything that reads YARD_DEPTH (TutorialGifts, DogSystem, WorkerRest,

WorkerSystem, GameTester, GameTutorial) follows the constant - check each.

• Pathing: bugs already use GridPath; add structures as blocked cells for walkers, recompute on every placement /

removal (dirty flag, once per frame at most). Flyers (moth, locust) ignore it as today.

• "Never fully block": at placement, flood-fill from every spawn edge to the farmland; if any spawn edge loses all

paths, refuse with a reason. Unit test: a ring of walls is refused at the last piece.

• Termites: ENEMY-03's BreachPlanner (weighted GridPath.cheapest) keeps working - walls are high-cost, not blocked,

for termites only.

• Farmer collision: only Building footprints (house, barn, windmill, greenhouse, big buildings) block the farmer; fences,

walls, traps, decor are walkable for him (not for bugs).

• Drag-to-build: BuildController gets a line mode for fence/wall kinds - press, drag along a row or column (L-shape

allowed), a live total price; confirm buttons rendered above the ghost.

• Spawns stay on the forest edge (SPAWN-01's permanent test must keep passing with the bigger map).

• Unlocks: an unlock field per buildable (wave + upgrade id); BUILD greys locked items with "Unlocks at wave 10 +

Stonemason upgrade"; the plan critic gets F-071's rule (a strictly better variant needs a stated unlock).

• Tickets after the OK (sizes ~1 run each): MAP-03 (bigger plains, yard 3, move circle + stone), PATH-01 (structures

shape bug paths + never-fully-block), PATH-02 (path preview while placing), WALK-01 (farmer walks through small

things), BUILD-03 (drag-to-build lines, price while dragging, buttons above), APIARY-02 (one apiary feeds 2-3 hives),

UNLOCK-01 (unlock tiers + BUILD greys locked items), plus their T1 device checks and the spawn test.