No description
Find a file
Forrest b9dcd24b5d Task #7: four new shed weapons (Potato Cannon, Shurikens, Propane Torch, Alien Ray)
All four go in the main hand alongside the pitchfork and corn shooter, cooldown-based
with no ammo, every stat GameConfig-tunable: Potato Cannon is a slow heavy shot,
Shurikens a fast cheap throw, Propane Torch a sustained cone DoT while held (shares
the pitchfork's cone-hit test), and Alien Ray a fast powerful shot that stays hidden
in the shop until enough Alien Goop is collected. FarmProjectiles.fire() gained
optional speed/lifetime overrides (backward compatible) so each ranged weapon can fly
at its own pace. WeaponModels gained tinted placeholder pivots for the new weapons
(no new art), and the number-key switch loop and HUD panel layout were fixed to not
go out of bounds now that there are more main weapons than number keys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:39:56 -04:00
.claude/agents Co-op voice/session work, config retune, net budget tool, overhaul plan 2026-10-05 13:35:53 -04:00
addons/GD-Sync updates 2026-10-04 12:07:36 -04:00
assets updates 2026-10-04 12:07:36 -04:00
benchmarks init 2026-10-03 12:14:28 -04:00
docs tasks: check off #6; note #12 old-save migration edge case 2026-10-05 15:16:51 -04:00
game Task #7: four new shed weapons (Potato Cannon, Shurikens, Propane Torch, Alien Ray) 2026-10-05 15:39:56 -04:00
prototype init 2026-10-03 12:14:28 -04:00
.editorconfig init 2026-10-03 12:14:28 -04:00
.gitattributes init 2026-10-03 12:14:28 -04:00
.gitignore updates 2026-10-04 12:07:36 -04:00
AGENTS.md Co-op voice/session work, config retune, net budget tool, overhaul plan 2026-10-05 13:35:53 -04:00
alien-overhaul-plan.md Plan/tasks: crop field placement decided; UFO follow-ups 2026-10-05 14:46:16 -04:00
export_presets.cfg updates 2026-10-04 12:07:36 -04:00
first-game-plan.md updates 2026-10-04 12:07:36 -04:00
first-game.md init 2026-10-03 12:14:28 -04:00
GD-Sync_1.0.2.zip updates 2026-10-04 12:07:36 -04:00
icon.svg init 2026-10-03 12:14:28 -04:00
icon.svg.import init 2026-10-03 12:14:28 -04:00
plan.md init 2026-10-03 12:14:28 -04:00
project.godot updates 2026-10-04 17:30:48 -04:00
README.md updates 2026-10-04 17:30:48 -04:00

Harvest Season — horde survival prototype

A small enclosed 3D arena under a fixed orthographic isometric camera. Birds chase the player and attack at close range; the player shoots traveling, pooled projectiles. Three accepted hits kill the player; eliminating every bird wins. Restart restores the complete initial round.

Built with Godot 4.7.2 (stable, official) and typed GDScript only. Measured results are in benchmarks/REPORT.md.

Running

Requirements: Godot 4.7.2 (Godot_v4.7.2-stable_linux.x86_64 was used; no other engine version or language). The project is configured for the Mobile renderer (Vulkan).

The project's main scene is the game (res://game/scenes/main.tscn: the title screen over the farm, see Farm scene). The farm scene on its own (res://game/scenes/farm.tscn, F6 in the editor) starts straight at the first morning, without menus or saving. The prototype arena is launched by passing its scene explicitly:

# The game (main scene; F5 in the editor)
godot --path .
# The farm on its own: no menus, no save
godot --path . res://game/scenes/farm.tscn
# Prototype: normal demo, 50 birds
godot --path . res://prototype/scenes/main.tscn
# Prototype with 25 birds
godot --path . res://prototype/scenes/main.tscn -- --enemies=25
# Prototype with the performance overlay
godot --path . res://prototype/scenes/main.tscn -- --overlay

In the editor, open prototype/scenes/main.tscn and press F6 to run the prototype. The default bird count is enemy_count in res://prototype/resources/default_config.tres.

Farm scene

The game proper: game/scenes/farm.tscn with the farmer (game/scenes/player.tscn, the scarecrow from Step 4), a follow camera, sun + sky lighting, and props from the ithappy farm pack (assets/farm/ithappy/farm/prefabs/assets/).

  • Player — PlayerCharacter (game/scripts/player_character.gd): camera-relative movement on the move_* actions with gravity; the model turns toward travel and crossfades idle / walk (partial stick) / run. Clips come from game/resources/player_animations.res, an AnimationLibrary of KayKit Rig_Medium clips (idle, walk, run, sneak, interact, pick-up, use item, dig, chop, hammer, lockpick, punch, hit, wave, death; the ground thieves share it), built with game/resources/breaker_animations.res (Rig_Large, for the fence breaker) by game/tools/build_player_animations.gd. Add clips to its BUILDS table and re-run it with the editor closed.

  • Camera — FollowCamera (game/scripts/follow_camera.gd): framing from pitch / yaw / distance (inspector), smoothed follow, mouse-wheel zoom. It is a tool script, so the editor viewport preview shows the in-game framing.

  • Level — ithappy prefabs instanced directly under Level/, on a 120 × 120 m plane + box floor. The pack ships without collision, so game/tools/build_prop_collision.gd adds a Collision StaticBody3D (layer 1) to each prefab farm.tscn places: trimesh for ground / road tiles (walk on the visible surface), trunk cylinders for trees, cylinders for bushes and barrels, a ramp-edged slab for box_005 pads, a footprint box for everything else, nothing for crops (plant/). The shapes live in the prefab files, so every instance collides. After placing a new prefab type, re-run it with the editor closed (prefabs that already have a CollisionShape3D are skipped, so hand-tuned shapes survive; -- --force regenerates its own). Animals (animal/) get none either; the open pen gate (fence_018) has a hand-made thin box.

  • Zones — the playable map is 60 × 60 m (x −13…47, z −45…15). What's left of the perimeter fence runs along its north and east sides, with 3 gaps; the south and west are open. Enemies arrive at random points all along the map's edge. The rest of the farm is scenery. Zones/ holds one FarmZone per area (crop field, animal pen, supply shed, work area, woodlot, scrap heap, haystacks) with its props as children, the 30 CropUnits of the crop field, and the perimeter (fence, gap FarmMarkers, and scarecrow-only PlayerBounds on physics layer 3). ZoneBanner shows the zone's name when the scarecrow walks in. FarmNavigation rasterizes the farm's collision into a 0.5 m grid for ground enemies. Details, travel times, and how to edit: game/LAYOUT.md. game/tools/render_overview.gd renders a top-down picture (--zones draws the zones).

  • Enemies and theft — FarmSim (game/scripts/farm_sim.gd) runs the farm's simulation in a fixed order each physics tick and applies the phase rules.

    • EnemySystem is forked from the prototype's horde: pooled slots, handles with generations, one MultiMesh for the flyers. It runs three types from the type table (GameConfig.enemy_types).
    • Crows fly straight to a crop, over fences and traps, land, take it, and fly straight off the farm.
    • Ground thieves go for animals and supplies along flow fields: the inside of the pen, each shed pile. They break barriers that block their way, and carry their loot to the farm's nearest edge.
    • Fence breakers follow a field to the barriers guarding valuables and smash them. They turn on the scarecrow when it comes close or shoots them, and hunt it, along a field toward the scarecrow, once nothing is left to break.
    • ThiefBehavior decides all of that. EnemyCharacters draws the ground enemies with a fixed pool of KayKit characters: a dark Mannequin_Medium thief, a rust-red Mannequin_Large breaker with a primitive club. Clips follow what each is doing, hits flash, and they glow at night.
    • LootSystem holds every stealable item in one id space (crop units, animals, sacks of supplies). It tracks each item's state (home / carried / dropped / following / lost) and its feedback:
      • a "!" over a targeted item and a filling ring while it's taken;
      • a token outlined in the category's color, and a badge, on the carrier or on the ground.
    • AlertManager draws labeled edge-of-screen arrows: grouped, prioritized, escape alerts escalating, at most 5 at once. ToastFeed shows event toasts.
    • Shooting a carrier drops its loot, and walking up to it recovers it. A carrier that gets off the farm loses it for good.
    • The scarecrow's weapons (ScarecrowCombat): mouse or right-stick aim, hold fire. It starts with the pitchfork (melee: a stab every 0.5 s at the nearest few enemies in reach and in front). The corn shooter (the prototype's gun, through FarmProjectiles) and pumpkin bombs (thrown, bursting over 3 m: PumpkinBombs) are workbench upgrades. The pitchfork and corn shooter are main weapons (fire; switch with Tab / d-pad down or 1-2 outside build mode); the bombs sit in the off-hand, thrown with right mouse / LT. The models are the user's (assets/weapons/, posed on the scarecrow by WeaponModels); the HUD's weapon panel (bottom right) shows them. Shots, the corn shooter, and enemy hit proxies sit at 1.8 m, above the sunflowers and the pen fence.
  • Campaign — CampaignController (game/scripts/campaign_controller.gd) runs the five-night vacation: Morning → Day → Dusk → Night → Dawn per night, then the farmers' return, with Game Over from any phase. FarmState (farm_state.gd) is the single source of truth for what persists; settings are in game/resources/game_config.tres (GameConfig). The rules are in game/RULES.md and the development plan in first-game-plan.md. CampaignDebug is a debug readout of the phase and farm state, hidden until F1. Debug keys: F6 ends the current phase, F7 cycles 1× / 5× / 20× speed, F9 sets the scarecrow to 0 HP, F10 strips the farm (every category), R retries after a Game Over, and T / G / H send in a thief / a crow / a fence breaker. F2 cycles tonight's plan through the debug scenarios (game/resources/scenarios/). They introduce the enemies one type at a time (crows, thieves, fence breakers), then pairs, then all three. N starts the night early (only when allow_early_night is on). On the farm the scarecrow moves with WASD / left stick, aims with the mouse / right stick, and fires with the left mouse button / right trigger.

  • Scarecrow kit — Scarecrow (game/scripts/scarecrow.gd): health in FarmState with 1 s of invulnerability after a hit (the model blinks, the screen tints), fear (Q / LB: enemies within 6 m flee for 2 s, carriers drop their loot, 12 s cooldown), patching up (hold F / Y: rooted 2 s for +3 HP, cancelled by a hit or letting go), and the fall at 0 HP. Thieves hit it when touching it, and fence breakers when fighting it (EnemySystem.evaluate_attacks). ScarecrowHud shows health pips, the fear cooldown, and the patch hint. The scarecrow still looks like the farmer mannequin; its look comes later. game/tools/soak_night.gd plays nights headless with a scripted scarecrow (--mode=idle | guard, --thieves=N) and prints what was stolen, recovered, and lost; --mode=gather plays a day of gathering everything and reports the time and yield; --mode=cycle --cycles=N plays whole days and nights (gather, rebuild the pen's gate, build a fixed defense plan, buy upgrades with what's left, guard all three targets and lead loose animals home; --build=0 / --guard=0 / --upgrades=0 turn parts off), reports each night's losses per target, and checks what carries over. --cycles=5 plays the whole vacation.

  • Economy — wood, scrap, and straw (ResourceStore in FarmState): shed stock plus the scarecrow's 15-unit pouch, which empties into the shed when it walks into the Supply Shed zone. Interactions (game/scripts/interactions.gd) handles the interact action: hold at a GatherNode (4 per material, made of the zone's props) to gather by day; press at the Workbench (work area table) to open the upgrade menu (UpgradePanel). Patching costs 2 straw. Points grow back overnight; ResourceHud (top right) shows the shed and pouch. Costs live in GameConfig.costs.

  • Upgrades — Upgrades (upgrades.gd) holds the eleven upgrades in GameConfig.upgrades: the corn shooter, rapid fire, heavy seeds, pumpkin bombs, wide fear, quick fear, straw stuffing, sprint, reinforced fences, long-range defenses, and sticky tar. Sprint and the two weapons change no stat: they unlock sprinting (PlayerCharacter: hold Shift / L3 while moving, 1.6 times as fast for 3 s, then 10 s to recharge, shown on the scarecrow HUD) and the weapons (ScarecrowCombat). Rapid fire and heavy seeds need the corn shooter first ("requires"). Each is bought once and kept in FarmState.upgrades. Systems read the upgraded value of their stat through Upgrades.value() rather than GameConfig directly. The stats are the corn shooter's fire rate and damage, fear's reach and recharge, fence and gate health, the automated defense's range, and trap slow time. UpgradePanel is the menu, grouped by track, showing costs and what's missing; mouse, keyboard, and gamepad all work.

  • Animals and supplies — AnimalSystem (animal_system.gd) turns the pen's farm-pack animals into moving entities. They wander the pen with a procedural hop or waddle. Loose animals head for the farm's nearest edge, and animals the scarecrow touches follow its trail home (at most 3). At night an open pen lets one wander out every few seconds; the pen's gate is a normal gate structure, standing from the start (GameConfig.start_structures). ShedStock (shed_stock.gd) shows the shed's stock as piles of logs, crates, and hay that grow and shrink with it, and gives supply thieves a spot at each pile. AssetHud (top center) shows "Crops · Animals · Supplies", flashing on change. Rules: game/RULES.md; the piles: game/LAYOUT.md.

  • Construction — StructureSystem (game/scripts/structure_system.gd) validates, places, draws, damages, repairs, and dismantles the four buildables (fence, gate, slowing trap, automated defense), recorded in FarmState.structures, and runs traps and automated defenses. Barriers are expensive cells in FarmNavigation's structure layer: thieves route around short fences, break through long ones (ThiefBehavior BREAK), and the flow fields are rebuilt in slices (FieldJob) after every change. BuildMode + BuildHud are the build mode and hotbar; Interactions repairs. Rules and numbers: game/RULES.md.

  • Day and night — WaveDirector (game/scripts/wave_director.gd) plays each night's NightPlan (game/resources/nights/night_1..5.tres).

    • A plan has a title, a dusk hint, an optional night length and scales, and groups of enemies by type, time, count, spacing, and target. Where isn't planned: each enemy arrives at its own random point along the farm's edge (on foot GameConfig.spawn_margin out, wherever there's a route in; crows flyer_spawn_margin out).
    • The five nights each test something new: crows only; a second target; breakers; groups at once; three waves. From night 2, every group is played at seven times its size, about three times as often (GameConfig.wave_count_scale 7, wave_spacing_scale 0.3). Night 1 sets its own scales to 1 (NightPlan.count_scale / spacing_scale), so it plays as designed: 11 crows.
    • NightPlan.problems() checks a plan against the farm.
    • At dusk the phase HUD lists what tonight brings, from every side (nothing is marked on the farm itself). DayNight (day_night.gd) eases the sun, sky, ambient light, and a whole-picture brightness / saturation between day, sunset, night (moonlight), and sunrise; the scarecrow carries a lantern that lights up as it gets dark, and thieves glow faintly at night. PhaseHud (top left) is the sun / moon dial with "Night N of 5", the phase and its time left, a hint line (what tonight brings, enemies on the farm), and a banner at each phase change ("Night 3: Breakers at the fences"), with the dusk hint under it from dusk into the night. ReviewPanel is the morning review: last night's losses per category, what's left, what needs repair, materials, and tonight's title; "Start the day" ends it. Playtest findings and tuning notes: game/PLAYTEST.md.
  • Menus and saving — Main (game/scripts/main.gd, game/scenes/main.tscn) hosts the farm under the menus. MainMenu is the title screen (Continue, New vacation, Settings, Quit) over the paused farm, with a camera circling it. PauseMenu (Escape / Start) pauses the whole tree and offers Resume, Restart the night, Settings, Save & quit to menu, and Quit the game; ConfirmBox asks before anything throws progress away. SaveGame (save_game.gd) writes the morning's FarmState to user://savegame.json every morning (atomically, full float precision) and reads it back defensively: missing, damaged, and newer saves are refused with the reason, and older ones are upgraded (SaveGame.migrate). Continue resumes at that morning; finishing the vacation deletes the save. GameSettings (game_settings.gd) keeps the settings in user://settings.cfg: volumes per audio bus, stick dead zones, fullscreen, VSync, 3D resolution scale, and tips; SettingsMenu edits them and shows every binding. UiTheme (ui_theme.gd, written to game/resources/ui_theme.tres by game/tools/build_ui_theme.gd) is the project's default theme, with a gold focus ring so keyboard and gamepad players always see where they are.

  • Results and endings — the morning screen (ReviewPanel) opens with last night's results: a taken / recovered / lost table per category, enemies defeated by type, damage, and materials gathered and spent (all counted in FarmState.night_events, kept per night in night_log). EndPanel is the failure screen (the cause, the night and its plan, what's left, the totals, Retry the night and Main menu) and, after the farmers' return, the final assessment: Assessment (assessment.gd) scores the share of each category kept (weights and rating tiers in GameConfig), with a bar per category and the vacation's totals. FarmersReturn (farmers_return.gd) is the ending: the farmers' station wagon drives in at the driveway gap and parks by the house, and the two farmers (tinted mannequins in straw hats) walk to the porch, wave to the scarecrow, and cheer, under a cutscene camera; any of fire, interact, or Enter / A skips it.

  • Co-op — two players over GD-Sync (addons/GD-Sync/): on the same network with no account, by the host's address (VPNs, strict firewalls), or online with the project's GD-Sync API keys. Each player has a scarecrow (P1 gold, P2 blue, name tags), a partner panel and an edge arrow show the other one, and voice chat runs over GD-Sync (M mutes). The host simulates and saves; the partner's farm is a replica that moves only its own scarecrow (CoopSession). How to play, the rules, the protocol, and the plugin patches: game/COOP.md.

  • Outside the fence — the scarecrow can walk off the farm (through the fence's gaps, or across the open south and west), as far as the old farm's outer fences. Four areas there have more to gather (3 per charge): the North Grove (wood), the Old Hangar and the East Road (scrap), and the South Fields (straw). Building, navigation, and the night stay inside the fence, and dusk warns anyone still outside. game/LAYOUT.md.

  • Tips — Tutorial (tutorial.gd) shows short contextual tips on the first day and night: move, gather, store, build, the dusk warning, shoot, fear, recover, and patch, each when it's useful and gone once done. Backspace / Back hides them; Settings turns them off.

  • Audio — FarmAudio (farm_audio.gd) plays every sound by cue name through the Master, Music, SFX, and Ambience buses (game/resources/audio_buses.tres): footsteps, the gun, hits and deaths by enemy type, crow caws and arrivals from where they come in, theft and breach alarms, building, repairs, traps, the automated defenses, gathering, upgrades, the dusk bell and phase stingers, the outcome jingles, and the day and night ambience. Positional sounds are heard from the scarecrow facing the way the camera does. Sounds are Kenney's CC0 packs (assets/audio/kenney/, licenses included) plus ambience, crows, the farmers' car, the pitchfork's whoosh, and the pumpkin bomb's burst, made by game/tools/synth_audio.gd (assets/audio/synth/). Music: "On the Farm" on the title screen and by day, DavidKBD's "Purgatory" at night, none at dusk and dawn (assets/audio/music/). See assets/audio/CREDITS.md.

Farm controls

Action Keyboard / mouse Gamepad
Move WASD or arrow keys Left stick
Aim Mouse cursor (aim marker) Right stick
Fire (hold) Left mouse button Right trigger or right shoulder
Fear Q Left shoulder
Patch up (hold) F Y
Interact: hold to gather, press at the workbench E X
Build mode (toggle) B D-pad up
In build mode: build / rotate / pick / dismantle or leave LMB / Z, C / 1-4, Tab / RMB RT / d-pad left, right / d-pad down / B
Repair a damaged structure (hold) E X
Start the day (morning review) Click, Enter A
Pause / resume Escape Start
Hide the tips Backspace Back
Mute / unmute your microphone (co-op) M -
Skip the farmers' return Space, Enter, E, or click A or X
Menus and end screens Click, arrows + Enter, Escape to go back D-pad + A, B to go back

game/tools/configure_input.gd writes these actions into project.godot (editor closed).

Controls

Action Keyboard / mouse Gamepad
Move (camera-relative, normalized diagonals) WASD or arrow keys Left stick
Aim Mouse cursor (aim marker shows the target) Right stick (radial dead zone, last aim retained)
Fire (hold, 6 shots/s) Left mouse button Right trigger or right shoulder
Restart (any time) R Start
Restart button on the end screen Click, Enter/Space A (button is focused automatically)
Performance overlay F3 Back / Select

The active aiming device switches only on deliberate input: 12 px of accumulated mouse travel or a click selects the mouse; right-stick deflection beyond the dead zone (0.3) or the fire trigger selects the gamepad. After any restart, fire must be released and pressed again.

Layout

game/
  RULES.md    rules of the vacation
  LAYOUT.md   the playable farm: zones, the edge and the fence's gaps, travel times
  PLAYTEST.md playtest results and what to tune
  scenes/     main.tscn (main scene: the menus over the farm), farm.tscn, player.tscn
  scripts/    player_character.gd, follow_camera.gd, campaign_controller.gd, farm_state.gd,
              game_config.gd, campaign_debug.gd, farm_zones.gd, farm_zone.gd, farm_marker.gd,
              crop_unit.gd, farm_navigation.gd, zone_banner.gd, farm_sim.gd, enemy_system.gd,
              thief_behavior.gd, loot_system.gd, farm_projectiles.gd, scarecrow_combat.gd,
              weapon_models.gd, pumpkin_bombs.gd,
              alert_manager.gd, toast_feed.gd, scarecrow.gd, scarecrow_hud.gd,
              end_panel.gd, resource_store.gd, gather_node.gd, workbench.gd,
              interactions.gd, resource_hud.gd, structure_system.gd, build_mode.gd,
              build_hud.gd, action_edges.gd, night_plan.gd, wave_director.gd, day_night.gd,
              phase_hud.gd, review_panel.gd, animal_system.gd, shed_stock.gd, asset_hud.gd,
              enemy_characters.gd, upgrades.gd, upgrade_panel.gd, main.gd, main_menu.gd,
              pause_menu.gd, settings_menu.gd, confirm_box.gd, save_game.gd, game_settings.gd,
              ui_theme.gd, assessment.gd, farmers_return.gd, tutorial.gd, farm_audio.gd, avatar.gd,
              remote_controls.gd, coop_session.gd, coop_link.gd, gdsync_link.gd, coop_lobby.gd,
              coop_voice.gd, coop_hud.gd, coop_menu.gd
  resources/  player_animations.res and breaker_animations.res (generated), game_config.tres,
              audio_buses.tres, ui_theme.tres (generated),
              nights/ (night plans), scenarios/ (debug plans), thief (crow) / enemy overlay /
              steal ring / loot icon / fear burst / HP bar shaders
  tests/      headless test runner and suites (campaign rules, farm layout, theft, scarecrow,
              economy, structures, all three targets, the enemy roster, the five nights, full
              cycle, saving and settings, the whole game through its menus, co-op)
  tools/      build_player_animations.gd, build_prop_collision.gd, render_overview.gd,
              configure_input.gd, soak_night.gd, synth_audio.gd, build_ui_theme.gd, coop_smoke.gd
prototype/
  scenes/     main.tscn (round), player.tscn, hud.tscn
  scripts/    gameplay systems (one class per file, see Architecture)
  resources/  default_config.tres, floor / bird / hit-flash shaders
  tests/      headless test runner and suites
  tools/      configure_project.gd, inspect_assets.gd, probe_hand_pose.gd
addons/       GD-Sync (the co-op plugin; four small patches, see game/COOP.md)
benchmarks/   run_benchmarks.sh, summarize.py, results/*.json, REPORT.md
assets/       the original asset kits (unchanged; referenced in place); audio/ holds the game's
              sounds (Kenney CC0 packs and synthesized ones, CREDITS.md)

Configuration

All tunables live in one resource: res://prototype/resources/default_config.tres (PrototypeConfig, prototype/scripts/prototype_config.gd). Key defaults:

Setting Value
Arena playable area 32 × 32 m (compact); stress "enlarged" layout = labeled 2× copy
Camera orthographic, 45° yaw, 35° pitch, frames the whole arena at any aspect
Physics tick 60 Hz, physics interpolation on (player, birds, bullets)
Player 6 m/s, capsule r = 0.4 m, 3 health, 1 s invulnerability after an accepted hit
Birds 2.5 m/s, 1 hit, body radius 0.30 m, hit proxy 0.35 m, 1 s attack cooldown, reach 0.2 m
Weapon 6 shots/s, 24 m/s, 2 s lifetime, pool 64
Enemy pool 64 (normal); stress presets allocate their capacity before the run
Navigation 0.5 m cells, flow field rebuilt on player-cell change at ≤ 10 Hz, sliced 1200 cells/tick
Steering 20 Hz per bird in 3 staggered cohorts, separation ≤ 16 candidates / ≤ 6 neighbors
Combat height 1.1 m (gun muzzle, bullets, bird bodies)

Project settings written by prototype/tools/configure_project.gd (re-runnable, editor closed): main scene, 1920 × 1080 reference resolution, Mobile renderer, MSAA 2×, physics interpolation, InputMap actions (move_*, aim_*, fire, restart, toggle_overlay; the built-in ui_accept / ui_cancel cover UI confirm/cancel on keyboard and gamepad), and physics layer names. All pre-existing settings (Jolt Physics, D3D12 on Windows, stretch mode) are preserved.

Collision layers

Layer Name Used by
1 world One StaticBody3D ("WorldCollision"): floor box + one box per obstacle footprint
2 player The player CharacterBody3D (mask = world)

Birds and bullets are not physics bodies. Bird ↔ world uses circle-vs-footprint queries (ArenaNavigation), bullet ↔ world uses one physics ray per bullet per tick against layer 1, bullet ↔ bird uses HordeSystem.sweep_hit. Every obstacle's physics box, navigation occupancy, and visual are derived from the same authored footprint (ArenaLayout).

Asset inventory and mappings

Recorded with prototype/tools/inspect_assets.gd (full output: prototype/tools/asset_inventory.txt). Source assets are never modified; derived data exists only in memory and is built during LOADING.

Bird — res://assets/bird/Bird_01.obj (+ .mtl). One surface, 386 triangles, one material (blinn3SG, albedo 0.01 — a black crow; the other .mtl entries are unused). Authored with +X forward, +Z up, wings along ±Y, in ~cm (bounds 179 × 241 × 58). AssetCatalog builds a derived mesh: re-centered on the torso (pivot 18.6, 0, 84 source units), scaled by 0.0055 (≈ 1.0 m long, 1.33 m wingspan) and rotated to Godot's −Z forward. Rendered by one MultiMeshInstance3D with a shared shader (bird.gdshader: per-bird wing flap from instance custom data, rim light). Birds are ground-bound (flat XZ navigation) and drawn hovering at combat height. Body collision radius 0.30 m fits the torso (x[−39.9, 77.1], z[62.5, 105.5] source units), not the wings.

Player — res://assets/kaykit_characters/characters/Mannequin_Medium.glb: 6 mesh parts, 6,916 triangles, one embedded-texture material, 21-bone skeleton at Rig_Medium/Skeleton3D, ≈ 2.2 m tall, faces +Z (rotated 180°). The mannequin has no clips; they come from the shared Rig_Medium_*.glb animation files (same rig root and bone names, plus handslot.l/.r, which the mannequin lacks — those tracks are dropped when the library is built). All source clips are non-looping and in place (root translation stays 0), so loop flags are set on the in-memory copies and no root motion is used; gameplay owns the position.

Role Clip (file) Notes / fallback
idle Idle_A (General)
move forward Running_A (MovementBasic) matches 6 m/s
move backward Walking_Backwards (MovementAdvanced) no backward run clip: walking stride, some foot slide
strafe Running_Strafe_Left/Right (MovementAdvanced) diagonals are BlendSpace2D blends
aim (right arm only) Ranged_1H_Aiming (CombatRanged) filtered Blend2 on upperarm/lowerarm/wrist/hand.r
death Death_A (General) holds the last frame
victory Cheering (Simulation)

Full-body facing follows the aim; legs use the 2D blend space in the facing frame. Hit_A exists but is full-body, so the hit cue is a red flash on the mannequin plus a brief screen tint.

Gun — built from primitives (barrel cylinder, body box, grip box) on a stable aiming pivot under the facing node, positioned so the grip sits in the aim clip's right hand (hand.r measured at (0.35, 1.0, −0.6) in the facing frame by probe_hand_pose.gd). The visible muzzle is exactly the gameplay muzzle (1.05 m forward, 0.35 m right, 1.1 m up).

Arena — res://assets/prototype_kit/Pieces/: fence.fbx (36 tris), box.fbx (108), pillar.fbx (12), cube6.fbx (12, thin wall), wall.fbx (12), ground.fbx (2). The kit's pieces carry baked offsets from their source scene (e.g. box.fbx spans x[2, 4]), so each piece is fitted by its measured AABB onto its footprint. The FBX materials reference no texture (the kit's 8×8 texture.png palette is not linked), so obstacle groups get flat tints. Layout: far (−X/−Z) perimeter 2 m fence, near (+X/+Z) perimeter 0.6 m fence so the camera sees over it, and five cover clusters at 1.5 m: crate L, U-shaped fence, pillar grove, two-wall corridor, and a central wall. Passages are ≥ 2 m wide (≥ 3 bird diameters).

Not used: the Stylized Nature MegaKit, the KayKit large rig, and the prototype kit's character.

Architecture

Ordinary scenes for the arena, player, camera, weapon, and UI; the horde and projectiles are centralized systems over preallocated packed arrays (no per-bird nodes, bodies, agents, timers, or scripts). RoundController drives one deterministic simulation step per physics tick:

input → player move → flow field slice → bird motion + player contact + world collision → spatial grid → melee → firing → projectile sweeps → steering cohort → deferred removals → render upload → outcome (loss evaluated before victory).

Component File Responsibility
RoundController round_controller.gd LOADING → READY → PLAYING → WON/LOST (+ RESETTING), seed, restart
PrototypeConfig prototype_config.gd all settings, capacities, stress flags
AssetCatalog asset_catalog.gd explicit asset paths, derived bird mesh, filtered animation library
ArenaLayout / Arena arena_layout.gd, arena.gd footprints → visuals + physics boxes
ArenaNavigation arena_navigation.gd inflated occupancy, sliced octile flow field, footprint queries
SpatialGrid spatial_grid.gd per-tick counting-sort buckets of bird indices
ChaseBehavior chase_behavior.gd replaceable policy: desired direction per bird
HordeSystem horde_system.gd dense pooled bird state, motion, contacts, melee, sweeps, removal
HordeRenderer horde_renderer.gd MultiMesh dense prefix + interpolated buffer upload (birds and bullets)
ProjectileSystem projectile_system.gd fixed pool, swept world + bird hits, expiry
PlayerController player_controller.gd movement, facing, animation, authoritative health
WeaponController weapon_controller.gd cadence, fresh-press rule, gun, fire requests
PlayerInput / ScriptedInput player_input.gd, scripted_input.gd devices, dead zones, switching / benchmark script
CameraRig camera_rig.gd fixed ortho framing, camera-relative basis, cursor projection
PrototypeHUD prototype_hud.gd health, birds left, end screen, 4 Hz overlay
PerfStats / BenchmarkRunner perf_stats.gd, benchmark_runner.gd timing rings, presets, reports

Key mechanics:

  • Pools. Birds: dense slots + stable ids with generation counters; swap-removal moves the last bird (all state + render slot) into the freed slot and updates id ↔ slot mappings. Kills are deferred to the end of the tick. Reused slots reset every field. Exhaustion skips the spawn and increments a visible counter; pools never grow mid-round and live bullets are never stolen.
  • Rendering. One MultiMesh batch per pool with a fixed arena AABB; visible_instance_count = active count, so dead birds and spent bullets stop rendering immediately. Buffers are written once per tick and interpolated by the RenderingServer (verified at a 2 Hz tick rate: birds move between frames of the same tick); spawned/swapped slots reset their interpolation.
  • Navigation. One shared flow field toward the player's reachable cell (nearest free cell if the player stands in the inflated clearance band). Obstacles are inflated by bird radius + 0.05 m; diagonal steps never cut a blocked corner; costs 5/7. Unreachable birds hold position. Within 2.5 m and with line of sight, birds steer straight at the player.
  • Collision. Player: CharacterBody3D (floating mode) against the world boxes. Birds: circle vs footprint push-out with sliding; every world resolve sees ≤ 0.19 m of displacement (one tick of motion + one bounded 0.15 m push), below half the thinnest footprint (0.25 m), so a bird can never tunnel. Birds yield to the player; birds pinned between player and wall push the player back through a collision-checked move. Crowds compress softly (measured ≤ 0.15 m bird/player overlap).
  • Projectiles. Zero-width rays with a visible tracer. Each tick the full segment is tested against the world (physics ray) and birds (exact relative-motion circle test over every grid cell the segment can touch, margin = hit radius + max per-tick bird displacement); the nearest hit wins, one bullet damages one bird. The weapon-origin → muzzle segment is tested at spawn.
  • Melee. Birds in reach, off cooldown, with an unobstructed footprint line attack; the player's invulnerability is authoritative, so several same-tick attacks cost one health. A bird's cooldown starts on every attempt, accepted or not.

Decisions that differ from or refine the plan

  • Mouse aim plane. The cursor is projected onto the horizontal plane at combat height, not the floor. At a 35° pitch, floor projection makes shots pass up to ~1.6 m from the cursor over a bird; the combat-height plane puts the cursor on the bullet path. The facing is corrected for the gun's 0.35 m side offset so the bullet line passes exactly through the cursor point.
  • Flow-field slicing. Measured before adding it: a full rebuild costs ~2.2 ms (compact, 4,624 cells) / ~9 ms (enlarged, 17,956 cells) in GDScript. Rebuilds are processed 1,200 cells per tick (≤ 0.8 ms/tick); the previous field is used until the new one completes. No threads.
  • Near-side fences are low (0.6 m) so the camera sees the whole floor; bullets fly over them and are recycled at the arena edge.
  • Attack cooldown starts even when invulnerability rejects the hit.

Tests

godot --headless --path . --script res://game/tests/run_tests.gd                   # game
godot --headless --path . --fixed-fps 60 --script res://prototype/tests/run_tests.gd  # prototype

Game: 908 checks, about 80 s. Covers FarmState round trips (also through JSON) and rejection of invalid data, every outcome rule including the loss-before-completion tie on the final dawn and a stripped farm across all three categories (spent supplies don't count), failure in every phase, the untimed morning, phase order and lengths, exactly five nights, starting the night early (off by default), per-night loss records, and retrying a failed night from its morning. The farm layout suite checks one non-overlapping zone per kind inside the 60 × 60 m map, zone lookup, the 30 crop units, the farm's edge and its side names, the remaining north and east fence with no holes outside its gaps (and the open south and west), ground-enemy routes from anywhere on the edge to every zone, that the scarecrow can walk out through a gap, zone-to-zone travel times (at most 12 s), and the zone banner. The theft suite runs crop theft on the real farm, by crows: claiming, flying in and landing, the steal timer, carrying, escaping over the fence (crop lost), one hit killing a crow and dropping its crop exactly once, touch recovery, stale handles after slot reuse, shots hitting thieves and cruising crows and stopping at the barn, stick aim and the fresh-press rule, the sunrise retreat, the end of the dawn grace, retry, night arrivals, and FarmState agreeing with the loot state. The scarecrow suite covers invulnerability, thief melee (cooldown, cover, not while fleeing), fear (range, drops, lost progress, cooldown, recovery), patching (heal, rooted, every cancel), sprint, defeat ahead of a stripped farm, the end panel's Retry, the morning revive, and the new input actions. The weapons suite covers starting with only the pitchfork, its stab (reach, arc, the nearest three, damage, cadence, held fire, not through walls), buying the corn shooter and pumpkin bombs (and rapid fire / heavy seeds needing the corn shooter), switching (cycling, 1-3, owned only, not in build mode, falling back, each weapon's own wait), a bomb's throw, flight, burst, range, and recharge, the models on the scarecrow, and the HUD's weapon panel. The economy suite covers the resource store's rules and validation, the gather points' layout and reachability, gathering (day only, charges, every cancel, a full pouch, the used-up/full focus rule), the shed drop-off, overnight regrowth, retry, the patch's straw cost, and buying Straw stuffing from the workbench's menu (opening, what's missing, closing). The structures suite covers every placement rule, build mode driven by gamepad input, the sliced rebuild, gates, a thief shut in the pen breaking its gate to get out, traps, the automated defense's range, damage and breaking, repair and dismantling, persistence and retry, and two A/B nights (two at a time, scarecrow away). Crows: open field 15 crops lost, fence ring 15 (nothing broken), ring + 6 automated defenses 2. Thieves after supplies: open shed 40 units, fenced 35 (2 breaks), fenced + 3 automated defenses 0. The targets suite covers the animals (wandering kept in by the pen's gate, an animal thief breaking in, catching, carrying, a dropped animal running for the farm's edge, leading three back through a gate, the fourth waiting, a pen breach letting animals wander out at night but not by day, losses, the dawn return, retry), the supplies (bundles from the most stocked pile, never more than the shed holds, dropping, recovery, carrying off, a raided shed, the piles scaling with the stock), thieves falling back to another target, the asset HUD, and a farm stripped of all three. The roster suite covers the type table, crows flying over fences and traps but shot down by automated defenses and never fighting, thieves keeping to animals and supplies (and a hit restarting their theft), fence breakers smashing the barriers that guard valuables (heavy hits, the next one after, a gap a thief then walks through, hunting and hitting the scarecrow, turning on it when shot, six hits to stop), the character pool (one per ground enemy, spawns skipped past it, corpses taken over), the alert manager (grouping, escape priority and escalation, breaches before thefts, the cap), and the debug scenarios. The nights suite checks every night plan and debug scenario against the farm (and that broken plans are caught), what each of the five nights tests, every upgrade's effect on the real systems (fire rate, damage, fear, max health, fence health, defense range, trap time), that upgrades can't be bought twice or at night and persist (next morning, JSON, retry, not into a new vacation), and all five nights played back to back to the farmers' return. Each night brings its own plan's enemies under its own banner, each morning is its night's snapshot, and the last night is longer. The cycle suite plays one whole day and night on the real farm: the morning review, the phase HUD, a day's gathering and building, no thieves by day, the dusk warnings, the lighting of each phase, the night plan's arrival times and targets at random points all along the edge, the dawn retreat, everything carrying into the next morning (structures and their damage, materials less what was carried off, losses in every category, health), the morning screen's results table and lines, and an exact retry. The save suite covers saving and loading reproducing the farm state field for field, missing, damaged, rule-breaking, non-morning, newer, and too-old saves refused with a reason, a version 2 save upgraded, the autosave every morning, retry restoring the saved morning, the save deleted when the vacation is finished, settings saved, loaded, clamped, and applied (bus volumes, dead zones), and the final assessment's score, tiers, and renormalized weights. The flow suite plays the game through main.tscn: the title screen over the paused farm, New vacation and Continue (and their questions), pausing freezing the simulation tick, settings applying and saving from the pause menu, Restart the night and Save & quit leaving the save untouched, a damaged save refused, the failure screens and Retry, the farmers' return to the final assessment (and skipping it), the first day's and night's tips, and the sounds hooked to the game. The co-op suite runs a host and a partner in one process (the partner's farm in its own world, over a loopback link): the join, the partner's requests, moves, gathering, and shots, enemies, loot, and shots arriving, the fall rule and Retry, a crowd with dropped packets and message sizes, and either side leaving. game/tools/coop_smoke.gd plays the same over real GD-Sync between two processes.

Prototype: 107 checks, ~1.5 s. Covers pool acquire/release/exhaustion and swap identities, slot reuse hygiene and stale handles, U-shape routing, corner cutting, unreachable spawns, octile costs, nearest-hit / wall-blocks / high-speed / muzzle-through-wall / relative-motion / dead-target sweeps, bullet exhaustion and expiry, mouse aim in 96 directions, gamepad aim in 8 directions, dead zones, device switching, normalized diagonals, three-hit death, same-tick invulnerability, melee blocked by cover, fire cadence and fresh-press rule, victory, loss, the tie policy, idempotent restart, exact restarts from play/victory/death, 20 resets with stable object/node counts and signal connections, and 15 s of a 64-bird bottleneck crowd with zero footprint overlaps.

Benchmarks

./benchmarks/run_benchmarks.sh        # fullscreen on screen 0, ~15 min, writes benchmarks/results
python3 benchmarks/summarize.py       # Markdown table of all results

Single run example: godot --path . --fullscreen -- --preset=stress2000 --layout=enlarged --scenario=spread --bench --warmup=10 --duration=60 --vsync=off --quit-after=72. See the header of prototype/scripts/benchmark_runner.gd for every option (--screenshot, --camera-zoom, --physics-ticks, --seed, ...). Presets are labeled stress configurations: invulnerable player, killed birds recycled, scripted route and sweeping fire — collision, melee, and navigation stay fully enabled.

Known limitations and unverified items

  • Not a release build. No export templates are installed; all measurements run the project with the 4.7.2 editor binary and are labeled as such.
  • Gamepad not physically tested (no controller was connected). Gamepad aim, dead zones, and switching are covered by tests that inject actions/events, not by hardware.
  • VSync and hidden windows. On this desktop (labwc via XWayland), a VSync-enabled window that is not visible is throttled to ~1 FPS by the compositor; VSync-on checks need a visible window.
  • Measured on one machine only (see the report); minimum hardware is not defined.
  • Sounds were chosen without listening. Cues were picked from Kenney's file names and a pitch analysis of the jingles; the synthesized ambience, crows, and car were checked as waveforms only. Each cue is one line in FarmAudio.CUES, so a bad one is a one-line swap.
  • Native Wayland (--display-driver wayland) was not tested; Godot ran under X11/XWayland.
  • Animation: backward movement uses a walking clip (foot slide at run speed); no hit reaction clip.
  • Birds' wings overlap visually in dense crowds (collision fits the torso by design).
  • GDScript bounds the scalable population (see report); native code would be a separate scope decision.