harvest/alien-overhaul-plan.md
Forrest 02117d8b9c Plan: pen fence is collidable, not decoration; flag #11 starting-gate and test rework
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:52:42 -04:00

12 KiB
Raw Blame History

Harvest Season — alien overhaul: review, decisions, and task plan

Status: planning complete, decisions resolved, implementation not started. Codebase review was run against the "Farm Defense Game" alien-invasion spec (Supply Shed, Workbench, alien-themed enemy roster, etc.) and compared to the existing prototype, which at review time had zero alien/UFO/robot/goop content anywhere (confirmed by independent greps across game/scripts, game/resources, and all .md docs). This is a full overhaul of the existing systems, not a different build — see Decision 1 below.

The live task list (with status/dependencies) is tracked in the session's Task tool as tasks #1–#15; this document is the narrative record of why those tasks exist and what was decided. Use TaskList/TaskGet for current status; use this file for the reasoning and open assumptions.

Headline finding from the review

A scarecrow defends a farm against three mundane enemy types (thief, crow, breaker) for 5 configurable nights. Several systems already match the spec's behavior closely (enemy roles, fear mechanic, most upgrade math) even though none of the alien theming or several structural pieces (Workbench gating, Animal Pen as a buildable, staged crop fields, hidden shop items) exist yet. Two numeric values that initial sub-research disagreed on were verified directly against game_config.gd/game_config.tres: Rapid Fire is already a live 3.0x (the .tres resource overrides the .gd script's stale 1.333 default), and Straw Bandages' base HP is 3 (not 10 — FarmState's 10 default is overwritten by GameConfig.scarecrow_max_hp=3 at campaign setup), so +2 from straw_stuffing already lands exactly on the spec's "5 HP."

Decisions (resolved)

  1. Scope: full overhaul of this codebase, not a separate/different build.
  2. Weapons: Potato Cannon, Shurikens, Propane Torch, Alien Ray, Radar are new weapons/items to build — not renames of existing ones. Corn Shooter and Pumpkin Bombs stay as-is.
  3. Workbench: auto-granted (not player-built), but becomes targetable by enemies — destructible and repairable like a structure.
  4. Animal Pen: becomes a player-built structure; animal start-state inverts to wandering. Correction (verified against code 2026-10-05): this is not a new buildable type. FarmZone.Kind.ANIMAL_PEN already exists and its rect already drives nav/flow-fields (farm_sim.gd:123,143,162,175-176); AnimalSystem.update_pen_open() (animal_system.gd:203) already implements "open if there's a way out crossing no structure". Second correction (2026-10-05, Batch 2 exploration): the pen's fence in farm.tscn (23 fence_024 instances under Zones/AnimalPen) is not inert decoration — each instance carries a StaticBody3D collider, and FarmNavigation.build() marks every StaticBody3D cell as permanently blocked. So today the pen is a real, indestructible enclosure whose only opening is closed by the starting gate structure (GameConfig.start_structures, x=4 z=-6), and update_pen_open() already works against it. Existing tests rely on that pre-built pen (test_targets.gd "the pen's gate shuts the pen", _pen_by_day, _breach; test_structures.gd fence-on-pen-edge "Blocked" check and _pen_breach), so #11 must rework those tests, and must decide what happens to the starting gate. The actual work is: delete the fence_024 instances, let players build ordinary fence/gate structures (already in StructureSystem.ORDER) around the existing pen rect, and set animals' initial status to the existing DROPPED/loose state (not HOME/"wander", which already means something else — in-pen grazing — in animal_system.gd). No new structure type, no new ORDER entry.
  5. Hidden shop items: show a "?" icon with no details until their reveal condition (Alien Goop collected) is met; then they become visible and purchasable for their defined cost.
  6. Crop field growth trigger: automatic, tied to a night threshold (see Decision 15). Fields should sit on "the two dirt fields on the map" — research could not confirm this zone exists (see Open assumptions below).
  7. Turret L3: 3 projectiles in a triangle spread pattern. Tar Patch: size doubles (L2, vs. original/L1 size).
  8. Buildable upgrades: per-instance, not account-wide — each placed turret/tar patch is upgraded independently of every other one of its type.
  9. Sprint: move to spec values (1.8x speed for 4s; cooldown stays 10s, already matched).
  10. Pouch capacity: base drops to 8, upgrade raises it to 16 (currently a flat, non-upgradable 16).
  11. Alien Goop drop: 1x quantity, ~33% drop rate from Aliens (the thief-type enemy), both values GameConfig-tunable.
  12. New enemy (UFO) stats: any reasonable default is fine as long as it's config-tunable.
  13. New weapon/item costs: defaults are fine, must be config-tunable.
  14. Turret fire-rate upgrade: matches the player's Rapid Fire multiplier — 3x.
  15. Night count: stays at 5 for now (the previously-discussed 30-night scale pass is deferred until after this overhaul is tested). New crop fields sprout after Night 2 and Night 4 respectively (ties into Decision 6).
  16. Radar function (asked separately after the above): minimap reveal — adds a map overlay showing enemy positions once purchased, not directional pings or an audio-only warning.

Open assumptions (flagged, not yet confirmed)

These were defaulted under "any default is fine as long as it's configurable," except the first two, which are factual/design gaps rather than balance numbers — worth a deliberate confirm before or during their task:

  • Crop field placement (blocks part of task #13): no "dirt field" zone currently exists in game/scenes/farm.tscn or game/LAYOUT.md — old decorative bare-soil patches were removed in a past layout cleanup (game/LAYOUT.md's changelog: "the north-west field's soil tile" removed, "1,122 plants in the three fields outside the map" removed). Default: place both new fields inside the perimeter fence (defendable, like the existing Crop Field), not in the outside gather zones. Needs an in-editor pick of two actual open rectangles.
  • Tar Patch L3 size: Decision 7 only confirmed L2 doubles. Defaulting L3 to triple (matching the original spec's "+200%"), not explicitly reconfirmed.
  • Turret L3 fire rate: defaulting to retaining L2's 3x fire rate in addition to the triangle multishot (upgrade-stacking convention), not explicitly reconfirmed.
  • Workbench destroy/rebuild: defaulting to repair-only (same proportional repair-cost pattern as other structures), not a full destroy-then-rebuild-from-scratch state.
  • Workbench wiring gap (found 2026-10-05, unresolved): the repair-cost-pattern default above assumes Workbench is "like other structures," but it currently isn't wired to be one at all. StructureSystem.structures is only ever populated via place() — player-initiated, cost-checked, validated against the build grid. workbench.gd is a bespoke Node3D with no HP and no presence in that array. Before starting #9, decide: (a) inject Workbench into structures via a non-purchased, unvalidated variant of place() so it rides the existing damage/repair pipeline, or (b) give it bespoke duplicate HP/damage/repair logic outside StructureSystem. This is a design decision, not just a numeric default. Resolved 2026-10-05: (a) — inject Workbench into StructureSystem.structures via a non-purchased, unvalidated place() variant so it reuses the existing damage/repair/targeting/save pipeline.
  • Animal Pen starting gate + pen tests (found 2026-10-05, blocks #11): once the collidable fence_024 ring is deleted, the starting gate (start_structures) stands alone in open ground. Decide whether #11 removes it (fully player-built pen, matching Decision 4) or keeps it as a free starter piece. Either way the existing pen tests listed under Decision 4 must build a fence/gate ring in their setup so they keep covering pen open/closed, straying, and breach behavior.
  • Supply Shed as a real purchase UI: the review flagged that shed_stock.gd is currently just a stockpile zone, not a store — all purchasing happens through the Workbench's UpgradePanel. Proceeding on the assumption that Supply Shed becomes its own purchase surface for weapons/items (matching the spec's two-store structure), separate from Workbench's player/weapon/buildable stat upgrades.
  • Per-instance upgrade trigger: assuming the upgrade prompt for a specific turret/tar patch opens by interacting with that structure in the world, not through a global menu.

Task breakdown (mirrors Task tool #1–#15)

No dependency chain | Independent, safe to start anytime:

  1. Rename Turret/Tar Patch display labels (automated_defense→Turret, slowing_trap→Tar Patch; UI text only, internal IDs unchanged for save compatibility).
  2. Sprint rebalance: sprint_speed_mult 1.6→1.8, sprint_time 3.0→4.0 (cooldown unchanged at 10s).
  3. Pouch capacity rework: base 16→8, new pouch_upgrade entry raises it to 16.
  4. Alien Goop resource + drop-on-kill from thief/Alien enemies (config: alien_goop_drop_chance default 0.33, alien_goop_drop_qty default 1).
  5. Workbench: auto-grant after Night 1, becomes a destructible/repairable world object. Wiring decision resolved as option (a) — see Open assumptions ("Workbench wiring gap"): inject it into StructureSystem.structures through a non-purchased, unvalidated place() variant.
  6. Per-instance Turret/Tar Patch leveling (L1-L3), independent per placed structure.
  7. Animal Pen: not a new buildable type (see corrected Decision 4) — remove the static decorative fence (Zones/AnimalPen in farm.tscn) and make its boundary buildable using the existing fence/gate structure types around the already-existing FarmZone.Kind.ANIMAL_PEN rect.
  8. Two new crop fields with staged growth (sprout after Night 2 / Night 4) — placement TBD, see Open assumptions.
  9. Enemy roster reskin: thief→"Alien" display name, breaker→"Alien Robot" display name, crow keeps its name plus alien-mind-control narrative framing. Zero behavior change, no visual/model work (placeholders stay, per standing guidance to defer visuals).
  10. UFO enemy: new flying:true 4th enemy type, reuses existing generic flying-nav infrastructure, needs a new FIGHT-capable flying attack behavior since crow's land-and-flee logic never fights.

Dependency chain | Blocked until their prerequisite lands:

  1. Hidden/reveal shop item system — blocked by #4 (needs Alien Goop to gate on).
  2. Supply Shed as a real purchase surface — blocked by #5.
  3. New weapons (Potato Cannon, Shurikens, Propane Torch, Alien Ray) — blocked by #6.
  4. Radar item (minimap reveal, function now confirmed) — blocked by #6.
  5. Invert animal start-state: set initial status to the existing DROPPED/loose state (not HOME/ "wander", which is already in-pen grazing in animal_system.gd) — blocked by #11 (needs a buildable pen boundary to herd back into).

Each task's full description and acceptance criteria live on its Task-tool entry (TaskGet); this list is the dependency map and one-line summary for quick reference.

Suggested starting order

#1, #2, #3, #14 first (zero risk, no dependencies, small diffs) → #4 → #9, #10, #11 in parallel → #5 → #6 → #7, #8, #12, #13 once their blockers clear → #15 whenever convenient (fully independent).