This commit is contained in:
Forrest 2026-10-04 12:07:36 -04:00
parent 276d43613d
commit 4298caf5cb
552 changed files with 42990 additions and 776 deletions

View file

@ -7,11 +7,15 @@ The playable farm built in Step 2 of `first-game-plan.md`. All numbers here are
- **Playable area: 60 × 60 m**, x −13…47 and z −45…15 (`FarmZones.playable`). The rest of the
old farm is out-of-bounds scenery.
- **Perimeter:** a wooden fence (`fence_005`, 101 segments) with **6 gaps**. Ground enemies enter
and escape through the gaps. Crows (Step 9) fly over the fence.
- **Scarecrow bounds:** invisible walls on the fence lines (`Zones/Perimeter/PlayerBounds`, physics
layer 3 `player_bounds`). Only the scarecrow collides with them (its mask is 1 + 3), so the
scarecrow can step into a gap but not leave the farm. Enemy navigation ignores them.
- **Perimeter:** what's left of the wooden fence (`fence_005`, 52 segments): the north side and
the east side, with **3 gaps**. The south side and most of the west side were taken out, so the
farm is open ground there.
- **The farm's edge** is where enemies come from and go: every enemy arrives at its own random
point along it, and carriers escape across it (see "The farm's edge" below).
- **Scarecrow bounds:** invisible walls on the old farm's outer fences (`Zones/Perimeter/PlayerBounds`,
physics layer 3 `player_bounds`). Only the scarecrow collides with them (its mask is 1 + 3). It
walks off the farm to the gathering areas outside (see "Outside the fence" below), but not off
the map. Enemy navigation ignores them.
- **Scarecrow start:** (3, −13), between the barn apron and the animal pen.
Top-down picture with zone outlines:
@ -30,13 +34,49 @@ name when the scarecrow walks in.
| Zone | Rectangle (x, z) | What's there | Purpose |
|---|---|---|---|
| Crop Field | 14…46, −18.6…11.4 | The sunflower field: 6 plots, 30 crop units, two 2 m walkways between the plot bands | Exposed asset; crows' target |
| Supply Shed | −6…8, −24…−14 | The red barn's south doors and the apron in front of them, with stock piles: crates and sacks (west of the doors), logs, hay, and barrels (east of the doors) | Stored materials; ground thieves' target (Step 8) |
| Supply Shed | −6…8, −24…−14 | The red barn's south doors and the apron in front of them, with stock piles that grow and shrink with the stock (`ShedStock`): crates for scrap (west of the doors), logs for wood and hay bales for straw (east of the doors); also sacks and barrels | Stored materials; supply thieves' target |
| Work Area | 8…14, −24…−15 | Tool table, workbench, chair, bucket, between the barn and the house | Crafting, repairs, and upgrades |
| Animal Pen | −10…4, −11…−1 | Brown paddock fence, gate opening on the east side (panel swung open), henhouse, 4 chickens, 2 pigs, 2 sheep | Livestock (Step 8). Enemies can only reach the inside through the gate |
| Animal Pen | −10…4, −11…−1 | Brown paddock fence, a gate in the opening on the east side (a gate structure, standing from the start), henhouse, 4 chickens, 2 pigs, 2 sheep | Livestock; animal thieves' target. Enemies can only reach the inside by breaking the gate |
| Woodlot | 37.5…46.5, −35…−21 | The fir tree line, dead trees and branches, log piles | Wood |
| Scrap Heap | 25.5…36.5, −44…−33 | Old pickup, wagon, wheelbarrow, lawn mower, barrels, crate, on the farmyard dirt | Scrap |
| Haystacks | 14…22, −44…−35 | The old hay stack (moved in from beyond the north fence) and 3 round bales | Straw |
### The shed's stock piles (Step 8)
`ShedStock` (`game/scripts/shed_stock.gd`) takes over some of the shed zone's props and adds more
next to them. One prop shows per few units stored:
| Pile | Props | Units per prop | Thieves' spot |
|---|---|---|---|
| Wood | 7 log stacks east of the doors (2 from the scene) | 4 | (2.6, −18.6), beside the doors |
| Scrap | 10 crates and barrels west of the doors and along the barn wall (4 from the scene) | 3 | (−3.0, −15.1), in front |
| Straw | 6 hay bales east of the doors (1 from the scene) | 4 | (6.75, −16.25), in front |
Every prop collides and is in place when the navigation is built, so enemies always route around
a pile's full footprint. A hidden prop stops colliding for the scarecrow and shots. Each spot has
its own flow field, so a supply thief goes to the pile it wants even when another is nearer.
### Gather points and the workbench (Step 5)
Each point is a `GatherNode` under its zone, holding the props it is made of.
| Zone | Point | Props | Charges | Gathering clip |
|---|---|---|---|---|
| Woodlot | DeadTree, Snag | dead trees | 2 each | Chopping |
| Woodlot | Deadfall | big dead tree | 3 | Chopping |
| Woodlot | LogPile | stump with logs | 2 | PickUp |
| Scrap Heap | Wreck | old pickup | 3 | Hammering |
| Scrap Heap | Wagon | wagon | 2 | Hammering |
| Scrap Heap | Mower | lawn mower | 2 | PickUp |
| Scrap Heap | OldBarrels | two barrels | 2 | PickUp |
| Haystacks | Haystack | the 12-bale stack | 4 | PickUp |
| Haystacks | BaleA, BaleB, BaleC | round bales | 2 each | PickUp |
- Every point yields 2 per charge and grows back fully overnight.
- `Workbench` (the work area's tool table) sells Straw Stuffing.
- `test_economy` checks that the scarecrow's body can stand within reach of every point and the
workbench.
The middle and south-west of the map (x −13…14, z −1…15) are deliberately open ground for
building defenses.
@ -54,22 +94,29 @@ visible.
| Middle band (z −6.5…0.4) | Plot 3: units 11–15 | Plot 4: units 16–20 |
| South band (z 2.4…9.4) | Plot 5: units 21–25 | Plot 6: units 26–30 |
## Perimeter gaps and approach directions
## The farm's edge and the fence's gaps
Each gap is 3 m wide (the driveway is 4 m) and marked inside by a signpost. A `FarmMarker` (kind
GAP) sits 3 m outside each gap, where ground enemies spawn and escape.
**Arrivals.** Every enemy arrives at its own random point along the farm's edge
(`FarmZones.edge`, `WaveDirector`), not at fixed gates:
- On foot: 3 m outside the map (`GameConfig.spawn_margin`), at any free navigation cell along that
line that has a route onto the farm (`WaveDirector.ground_spawns`, nearly all of it). The same
line is where carriers escape and loose animals are lost.
- Crows: 8 m outside the map (`flyer_spawn_margin`), anywhere along it. They leave straight out
the nearest side.
**The gaps** in what's left of the fence are each 3 m wide (the driveway is 4 m) and marked inside
by a signpost. A `FarmMarker` sits 3 m outside each one. Enemies arriving behind the fence walk in
through them (or around the fence's ends); nothing can be built in them, so the scarecrow can
always walk out to the gathering areas.
| Gap | Fence side, position | Leads to |
|---|---|---|
| GapNorth | north, x 10.5…13.5 | Haystacks, work area, barn apron |
| GapDriveway | east, z −41.5…−37.5 (the farm road) | Scrap heap and farmyard. The farmers' truck uses it in the ending (Step 11) |
| GapDriveway | east, z −41.5…−37.5 (the farm road) | Scrap heap and farmyard. The farmers' car comes in here in the ending (Step 11) |
| GapEast | east, z −20…−17 | Woodlot and the crop field's north-east corner |
| GapSouthEast | south, x 29.5…32.5 | Crop field, south side |
| GapSouthWest | south, x −5.5…−2.5 | Open south-west ground, pen (south side) |
| GapWest | west, z −7.5…−4.5 | Pen's west fence: enemies must go round it to the gate |
Crow approach markers (kind CROW, about 8 m outside the fence): CrowNorth (17, −53),
CrowEast (55, −5), CrowSouth (17, 23), CrowWest (−21, −15).
The signposts of the three gaps that were in the removed south and west fence (SignSouthEast,
SignSouthWest, SignWest) still stand.
## Travel times
@ -80,29 +127,31 @@ routes to it go through the gate.
| From \ to | Crop Field | Supply Shed | Work Area | Animal Pen | Woodlot | Scrap Heap | Haystacks |
|---|---|---|---|---|---|---|---|
| **Crop Field** | — | 7.2 s | 5.4 s | 6.8 s | 5.9 s | 7.3 s | 8.0 s |
| **Supply Shed** | 7.2 s | — | 2.8 s | 4.7 s | 9.7 s | 9.1 s | 8.3 s |
| **Work Area** | 5.4 s | 2.8 s | — | 4.8 s | 7.1 s | 6.6 s | 5.7 s |
| **Animal Pen** | 6.8 s | 4.7 s | 4.8 s | — | 10.8 s | 11.0 s | 10.4 s |
| **Supply Shed** | 7.2 s | — | 2.8 s | 4.3 s | 9.7 s | 9.1 s | 8.3 s |
| **Work Area** | 5.4 s | 2.8 s | — | 4.7 s | 7.1 s | 6.6 s | 5.7 s |
| **Animal Pen** | 6.8 s | 4.3 s | 4.7 s | — | 10.8 s | 11.0 s | 10.3 s |
| **Woodlot** | 5.9 s | 9.7 s | 7.1 s | 10.8 s | — | 3.5 s | 5.3 s |
| **Scrap Heap** | 7.3 s | 9.1 s | 6.6 s | 11.0 s | 3.5 s | — | 2.3 s |
| **Haystacks** | 8.0 s | 8.3 s | 5.7 s | 10.4 s | 5.3 s | 2.3 s | — |
| **Haystacks** | 8.0 s | 8.3 s | 5.7 s | 10.3 s | 5.3 s | 2.3 s | — |
The longest trip is 11.0 s (Animal Pen ↔ Scrap Heap). The rule is no key area more than 12 s from
another. The two defended fronts sit 6–7 s apart: the crop field in the south-east, and the pen
and shed in the west. Holding one leaves the other exposed. The gathering spots are in the north,
so a day of gathering pulls the scarecrow away from both fronts.
Ground-enemy path from each gap to the nearest edge of each zone, in meters (enemy radius 0.35 m):
Ground-enemy path from the middle of each side of the farm's edge (3 m out) to the nearest edge of
each zone, in meters (enemy radius 0.35 m). Enemies arrive anywhere along the edge, so these are
samples, not routes everyone takes; arriving behind the north fence means walking round to a gap.
| Zone | North | Driveway | East | South-east | South-west | West |
|---|---|---|---|---|---|---|
| Crop Field | 30 | 23 | 4 | 7 | 24 | 34 |
| Supply Shed | 26 | 49 | 43 | 42 | 36 | 16 |
| Work Area | 24 | 46 | 37 | 40 | 38 | 30 |
| Animal Pen (inside) | 46 | 63 | 51 | 39 | 28 | 32 |
| Woodlot | 39 | 10 | 7 | 42 | 60 | 62 |
| Scrap Heap | 26 | 14 | 24 | 52 | 63 | 56 |
| Haystacks | 6 | 32 | 35 | 57 | 62 | 49 |
| Zone | North | East | South | West |
|---|---|---|---|---|
| Crop Field | 35 | 6 | 7 | 30 |
| Supply Shed | 31 | 45 | 36 | 10 |
| Work Area | 29 | 39 | 35 | 24 |
| Animal Pen (inside) | 51 | 53 | 30 | 28 |
| Woodlot | 44 | 9 | 48 | 56 |
| Scrap Heap | 30 | 26 | 55 | 50 |
| Haystacks | 11 | 37 | 55 | 43 |
## Navigation
@ -113,10 +162,10 @@ Ground-enemy path from each gap to the nearest edge of each zone, in meters (ene
- Obstacles are inflated by the mover's radius.
- Distance fields use octile Dijkstra with no corner cutting.
For enemies: the playable area plus a 5 m margin is 20,164 cells. 423 shapes are rasterized, and
For enemies: the playable area plus a 5 m margin is 20,164 cells. 390 shapes are rasterized, and
the grid builds in about 25 ms (headless, editor binary). Because the grid comes from the same
collision the player walks against, physics and navigation can't drift apart. Step 3 adds flow
fields toward the crop plots and the gaps on top of it.
fields toward the crop plots and the farm's edge on top of it.
## What changed from the old farm
@ -128,9 +177,10 @@ fields toward the crop plots and the gaps on top of it.
- **Moved:** the hay stack from beyond the north fence into the farmyard (Haystacks).
- **Collision:**
- `build_prop_collision.gd` generated collision for the newly placed prop types.
- Animals get none (they become moving entities in Step 8).
- The open gate (`fence_018`) has a hand-made thin box along its panel, so the pen opening stays
clear.
- Animals get none: they are moving entities (`AnimalSystem`).
- Step 8 removed the pen's propped-open gate panel (`fence_018`). The opening is shut by a
gate structure instead: `GameConfig.start_structures` puts it at (4, −6), turned to run north
to south. It can be broken, repaired, or rebuilt like any gate.
- **Rendering cost:**
| View | Draw calls before | Draw calls after |
@ -149,3 +199,41 @@ fields toward the crop plots and the gaps on top of it.
- Run `godot --headless --path . --script res://game/tests/run_tests.gd -- --suite=test_farm_layout`
to check the result: zones, fence integrity, reachability, and travel times. It prints the
tables above.
## The farmers' return (Step 11)
`FarmersReturn` (`game/scripts/farmers_return.gd`) uses fixed points on this map:
- **The car's route:** the station wagon (`car_002`) comes north up the road east of the fence
(x 52), turns in at GapDriveway (z ≈ −39.5), and runs west along the yard road. It turns south
past the wagon and parks at (32.8, −29.5), facing south.
- **The farmers:** they get out on both sides of the car and walk to the porch steps on the
house's north side (the house is x 15.8…25.2, z −29.6…−21.3; the steps are at about (19.6, −29.8)).
They stop at (18.9, −31.4) and (20.5, −31.5).
- **The scarecrow** waits at (24.6, −34.0), beside their way.
- **The yard shot** looks south at the porch from (28, 10, −45.5).
- **What to avoid:** the tractor parked east of the house (about (30, −25)) hides anything at the
house's east side from the south-east.
## Outside the fence
The scarecrow can leave through the fence's gaps or across the open south and west sides. The invisible walls (`Zones/Perimeter/PlayerBounds`)
now stand on the old farm's outer fences, not on the farm's own fence: x −27.6…54.8, z −59.6…47
(`FarmZones.roam`). Building, the enemies' navigation grid, and the night stay inside the fence
(`FarmZones.playable`).
Four outside zones (`FarmZone.outside`) hold more to gather. Every point there yields 3 per charge.
| Zone | Rectangle center, size | Points | Nearest gaps |
|---|---|---|---|
| North Grove (wood) | (12, −52), 16 × 12 | GroveDeadTree, GroveSnag, GroveDeadfall (dead trees, 3 charges), GroveLogs (log pile, 3) | GapNorth |
| Old Hangar (scrap) | (38, −53), 18 × 13 | HangarWreck (old SUV, 4), HangarBarrels (3), HangarCart (3) | GapNorth, GapDriveway |
| East Road (scrap) | (51.5, −15), 6 × 14 | RoadsideCar (the abandoned red car, moved in from `Level/`, 4), RoadsideBarrels (3) | GapEast |
| South Fields (straw) | (9.5, 31), 66 × 30 | FieldStackWest, FieldStackEast (4-bale stacks, 4), FieldBaleWest, FieldBaleEast (round bales, 3) | none: the south side is open |
`FarmZones.zone(kind)` only ever returns the farm's own zone, and `zones()` lists only the farm's.
`outside_zones()` lists these, and `zone_at()` finds both (the zone banner says "North Grove
(outside the fence)").
**Placing outside points:** the North Grove sits east of the tall barn on purpose. Behind the barn
(x < 9), the game camera can't see the scarecrow. The semi-trucks west of the farm are beyond the
old west fence (x ≈ −28.5), so they're out of reach.