| .claude/agents | ||
| .opencode | ||
| addons/GD-Sync | ||
| assets | ||
| benchmarks | ||
| docs | ||
| game | ||
| graphify-out | ||
| prototype | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| AGENTS.md | ||
| alien-overhaul-plan.md | ||
| export_presets.cfg | ||
| first-game-plan.md | ||
| first-game.md | ||
| GD-Sync_1.0.2.zip | ||
| icon.svg | ||
| icon.svg.import | ||
| plan.md | ||
| project.godot | ||
| README.md | ||
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 themove_*actions with gravity; the model turns toward travel and crossfades idle / walk (partial stick) / run. Clips come fromgame/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 withgame/resources/breaker_animations.res(Rig_Large, for the fence breaker) bygame/tools/build_player_animations.gd. Add clips to itsBUILDStable 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, sogame/tools/build_prop_collision.gdadds aCollisionStaticBody3D (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 forbox_005pads, 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;-- --forceregenerates 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 oneFarmZoneper area (crop field, animal pen, supply shed, work area, woodlot, scrap heap, haystacks) with its props as children, the 30CropUnits of the crop field, and the perimeter (fence, gapFarmMarkers, and scarecrow-onlyPlayerBoundson physics layer 3).FarmNavigationrasterizes 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.gdrenders a top-down picture (--zonesdraws 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.EnemySystemis 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.
ThiefBehaviordecides all of that.EnemyCharactersdraws 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.LootSystemholds 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.
AlertManagerdraws labeled edge-of-screen arrows: grouped, prioritized, escape alerts escalating, at most 5 at once. There's no message feed: events are heard, and shown by the alerts, the HUD, and the morning review.- 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, throughFarmProjectiles) 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 the number keys 1-6 outside build mode, key k picking the k-th weapon owned); the bombs sit in the off-hand, thrown with right mouse / LT. The models are the user's (assets/weapons/, posed on the scarecrow byWeaponModels); the HUD's hotbar (bottom center) shows the ones owned. 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 thirty-night vacation (GameConfig.campaign_nights): 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 ingame/resources/game_config.tres(GameConfig). The rules are ingame/RULES.mdand the development plan infirst-game-plan.md.CampaignDebugis a debug readout of the phase and farm state, hidden until F1. Debug keys: F4 unlocks everything (every upgrade and shop item at its last level, free;CampaignDebug.unlock_all; not F8, Godot's Stop shortcut when run from the editor), 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. In the morning review, F3 / Shift+F3 jump to the next / previous day's morning with the farm as it is (no autosave;CampaignDebug.jump_morning), to try a late night without playing up to it. N starts the night early (only whenallow_early_nightis 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 inFarmStatewith 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).ScarecrowHudshows the portrait (top left) in a ring that is fear's charge, a health bar with a segment per point of max health, and (once Sprint is bought) the sprint's stamina. The scarecrow still looks like the farmer mannequin; its look comes later.game/tools/soak_night.gdplays nights headless with a scripted scarecrow (--mode=idle | guard,--thieves=N) and prints what was stolen, recovered, and lost;--mode=gatherplays a day of gathering everything and reports the time and yield;--mode=cycle --cycles=Nplays 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=0turn parts off), reports each night's losses per target, and checks what carries over.--cycles=30plays the whole vacation. -
Economy — wood, scrap, and straw (
ResourceStoreinFarmState): 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 aGatherNode(4 per material, made of the zone's props) to gather by day; press at theWorkbench(work area table) to open the upgrade menu (UpgradePanel). Patching costs 2 straw. Points grow back overnight;ResourceHud(bottom left) is the backpack with the pouch's count; I / R3 opens the pouch panel (what's carried, and the shed's stock). Costs live inGameConfig.costs. -
Upgrades —
Upgrades(upgrades.gd) holds the eleven upgrades inGameConfig.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 inFarmState.upgrades. Systems read the upgraded value of their stat throughUpgrades.value()rather thanGameConfigdirectly. 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.UpgradePanelis 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. The pause menu shows "Crops · Animals · Supplies". 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 inFarmState.structures, and runs traps and automated defenses. Barriers are expensive cells inFarmNavigation's structure layer: thieves route around short fences, break through long ones (ThiefBehaviorBREAK), and the flow fields are rebuilt in slices (FieldJob) after every change.BuildMode+BuildHudare the build mode and hotbar;Interactionsrepairs. Rules and numbers:game/RULES.md. -
Day and night —
WaveDirector(game/scripts/wave_director.gd) plays each night'sNightPlan(game/resources/nights/night_1..30.tres, by count:FarmSim.night_plan_path).- 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_marginout, wherever there's a route in; crowsflyer_spawn_marginout). - Thirty nights. The first five each bring something new: crows only; a second target;
breakers; groups at once; UFOs. Nights 6–29 are generated by
game/tools/make_nights.gd(seed 30; it never overwrites a night without--force, and checks each plan as played): they grow from 182 to 427 enemies as played, in 3 to 5 waves. Every fifth night (10, 15, 20, 25) is a 30% heavier siege, and each night's enemies are a little faster and tougher (NightPlan.enemy_speed_scale/enemy_hp_scale, up to ×1.25 / ×1.625). Their titles and dusk hints are drafts. Night 30, "The last night", is the finale: 511 enemies in three waves over 180 s. From night 2, every group is played at seven times its size, about three times as often (GameConfig.wave_count_scale7,wave_spacing_scale0.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 right) is the sun / moon with "Day N of 30", the time left until the next phase and a line filling over it, a hint line under it (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.ReviewPanelis the morning review, a wooden sign with last night's results on it; "Start the day" ends it. Playtest findings and tuning notes:game/PLAYTEST.md.
- 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
-
Talking heads —
DialogueDirector(game/scripts/dialogue_director.gd) plays everyConversationsaved ingame/resources/dialogue/once, at its night and phase (night2,phaseMORNING is the morning of day 2;night18,phaseNIGHT is night 18),delayseconds in (the morning starts at once, and the morning sign waits until it's done).DialogueBoxshows it above the hotbar on a sheet of paper like the morning sign's: the speaker's name and words on their side, and their picture standing behind the paper's top edge. Words are written letter by letter while the head bobs (and flaps its mouth withtalk_frames) and blips (voice). To add one, in the editor's FileSystem dock: New Resource →DialogueSpeakerper character (game/resources/dialogue/speakers/: name, portrait, side, name and text color, font, size, italics, bold, speed, voice), then New Resource →Conversationingame/resources/dialogue/(night, phase, delay, pause the game, auto-advance, and its lines:DialogueLine, a speaker and text, with optional per-line face, color, size, italics, bold). Text takes BBCode:[i],[b],[color=#b02010],[font_size=48],[wave],[shake]. A conversation pauses the game by default (in co-op the farm can't stop, so the player's scarecrow stands still instead); one that doesn't takes no input and goes on by itself. A retried night doesn't replay its conversations; a new vacation does. From code:sim.dialogue.play(conversation). Debug: F5 plays the current phase's again. The example (example_morning_day_2.tres, the Scarecrow and a Little Green Alien) uses the HUD's painted icons as placeholder portraits (DialogueSpeaker.icon) until real pictures are set. -
The opening intro — every New vacation opens with a cutscene, about 70 s (
OpeningIntro,game/scripts/opening_intro.gd): on a summer morning the farmers load up their station wagon and drive off to the Bon Jovi concert; that night a bickering UFO crew loses control over the farm, a glowing part falls off, and its blue flash brings the scarecrow to life (the faint blue glow in its chest from then on); then a loading screen (LoadingScreen) and the first morning's sign. Hold Space / Enter / A (or E, or the mouse button) for a second to skip it (straight to the sign); Escape pauses it, and Restart the night skips it. Continue never plays it, and hosting co-op skips it. Its lines are talking-head conversations ingame/resources/dialogue/intro/(departure.tres,flight.tres,uh_oh.tres; edit the lines and speakers there: that folder never plays by itself), shown in the intro's own box, where they go on by themselves and a tap hurries them. It shares the car, the farmers, and the camera moves with the ending (CutsceneKit). Its staging points are ingame/LAYOUT.md. To review it shot by shot,game/tools/capture_intro.gdsaves a frame at every stage (its header has the command). -
Menus and saving —
Main(game/scripts/main.gd,game/scenes/main.tscn) hosts the farm under the menus.MainMenuis 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;ConfirmBoxasks before anything throws progress away.SaveGame(save_game.gd) writes the morning'sFarmStatetouser://savegame.jsonevery 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 inuser://settings.cfg: volumes per audio bus, stick dead zones, fullscreen, VSync, pixel size, 3D resolution scale, and tips;SettingsMenuedits them and shows every binding. -
Look —
ToonLook(game/scripts/toon_look.gd), added byMain, gives everything 3D a toon-shaded pixel-art look at runtime. Every lit, opaque StandardMaterial3D on the farm (imported props, KayKit characters, weapons, primitives built in code, and nodes added later) is swapped for a toon ShaderMaterial with the same color and texture (toon.gdshader/toon_double_sided.gdshader, lighting intoon_light.gdshaderinc, which the crow and UFO shaders include too); unshaded and transparent effects keep their own materials. A full-screen quad (pixel_outline.gdshader) darkens depth edges and lightens creases. The pixel size setting (default 4) renders the 3D view that many times smaller and scales it back up with sharp pixels and no MSAA, while the HUD stays at full resolution. Label3Ds would be pixelated too, so they don't render in 3D:ScreenLabels(screen_labels.gd) draws them as sharp text over the 3D view (under the HUD) where they project, at least 16 px tall, nudging overlapping ones apart. Game code keeps setting the Label3Ds' text, color, and visibility. The HUD is hand-drawn (Sketch,sketch.gd): a handwritten font (Gochi Hand,assets/fonts/, SIL OFL), wobbly sketched outlines, and painted icons drawn in code. The pouch panel, the build bar, the pause menu and its questions, and the workbench and shed shops share one panel look (a dark wash in a sketched ink frame, slots with a gold focus frame):UiTheme.sketch()is that look as a theme, its boxes drawn bySketchBox(sketch_box.gd).UiTheme(ui_theme.gd, written togame/resources/ui_theme.tresbygame/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) is a hand-drawn wooden sign with a sheet of paper nailed to it, the day on its top beam: last night's taken / recovered / lost per category, then the enemies defeated by type and the materials gathered, each row with its icon (all counted inFarmState.night_events, kept per night innight_log).EndPanelis 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 inGameConfig), 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 bygame/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/). Seeassets/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 |
| Talking heads: write the line / next line | Click, Enter, Space, E | A, X |
| Talking heads: skip the conversation | Backspace | Back |
| Pause / resume | Escape | Start |
| Hide the tips | Backspace | Back |
| Mute / unmute your microphone (co-op) | M | - |
| Skip the opening intro (hold 1 s) | Space, Enter, E, or left mouse | A, X, or right trigger |
| 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, 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, 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, sketch.gd, sketch_box.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 thirty 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,
make_nights.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, Forward+ renderer (the game's pixel outlines need
its normal buffer; the prototype began on Mobile), 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 campaign_nights (30) 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,
and zone-to-zone travel times (at most 12 s). 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 first five nights and the last tests, and the thirty nights' arc: breakers from
night 3 and UFOs from night 5, no night more than 15% lighter than the non-siege night before it,
sieges on every fifth night, each night's enemy speed and HP scales, and the last night the
longest. It also checks 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), the F3 night jump, and a sample
of the vacation played back to back to the farmers' return: nights 1–5, the night-10 siege, and
night 30, with the nights between skipped by F3's morning path. Each played 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 tables, 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 (its intro
skipped) 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.
The intro suite plays the opening intro through main.tscn: New vacation starts it, and Continue
and hosting don't; stepped through, it visits every stage in order with the farm held (no sign,
no HUD, the scarecrow frozen on its post) and ends on the focused morning sign; and a skip from
every stage, holding to skip, Restart the night, and Save & quit during it each leave the farm
exactly as a new vacation's first morning (the scarecrow at its start with input and glow, the
light and sounds given back, the game camera, nothing of the intro left).
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.