harvest/docs/plan.md
Forrest 5dbad4c915 plan: opening intro (#29-#34)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:33:54 -04:00

317 lines
20 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Harvest Season — opening intro (2026-10-07)
Status: planned, not started. The user asked for a cutscene at the start of every new vacation:
the farmers leave for the Bon Jovi concert, and that night a bickering UFO crew drops a part that
brings the scarecrow to life. Then a loading screen, then the first morning's instructions. Tasks
continue the numbering at **#29–#34** (#1–#28 are merged; the thirty-nights plan this file
replaced is in git at 6a9575d). Line numbers point at bbd8012 plus the uncommitted dialogue work,
so re-check them before editing.
**Before any worker starts:** the talking-head dialogue system is still uncommitted in the user's
tree. That covers `conversation.gd`, `dialogue_*.gd`, `game/resources/dialogue/`,
`test_dialogue.gd`, and the edits to `campaign_controller.gd`, `farm_sim.gd`, `main.gd`,
`tutorial.gd`, `campaign_debug.gd`, `run_tests.gd`, and `farm.tscn`. Worktrees branch from HEAD,
so it must be committed first, or the workers won't have it.
## Ground rules for workers
- **Godot binary:** `godot` is not on PATH here. Use `~/Downloads/Godot_v4.7.2-stable_linux.x86_64`
everywhere these docs say `godot`. Exit code 127 means the binary wasn't found, not a pass.
- **Tests:** `godot --headless --path . --script res://game/tests/run_tests.gd`. The exit code is
the failure count and is never 0 here: about 25 checks fail because of tuning, and the
test_roster "All three" check is flaky. Run the suite before editing, diff the FAIL lines
afterwards, and judge your task by new FAIL lines only. One suite: `-- --suite=test_x`.
- **Parallel worktrees:** give each headless run its own `XDG_DATA_HOME` so `user://` saves don't
collide.
- **`farm.tscn` and `.tres` files:** edit them as text. A headless `ResourceSaver.save()` drops
the `uid=` lines; if you must save from a script, restore them the way
`game/tools/build_prop_collision.gd` does.
- **Co-op is untouched:** the intro is local, solo-only, and runs before any partner can join.
Nothing here changes the save format, `state.to_dict()`, or the wire format.
- **No new HUD text:** gameplay feedback still goes through menus, sound, and world visuals. The
intro's own captions ("Later that night....", the skip hint) are cutscene chrome the user asked
for, like the ending's caption, and appear only while it plays.
- **Look:** the user named the luggage, the UFO's flight, the part, the blue flash, the chest
glow, and the loading screen, so those are in scope. The farmers stay the tinted mannequins
from the ending. Talking heads are sketch placeholders (real portraits go in the speaker
`.tres` later). New lit `StandardMaterial3D`s get the toon look from `ToonLook` automatically;
a custom `ShaderMaterial` must `#include "res://game/resources/toon_light.gdshaderinc"`.
- **Graph:** after modifying code, run `graphify update .`.
## Decisions (the user's, 2026-10-07)
1. **Dialogue in the talking-head box** (`DialogueBox`, the morning sign's paper with portraits).
Lines go on by themselves in time with the action; a tap hurries them.
2. **The part is absorbed into the scarecrow.** A faint blue glow stays in its chest all game.
It sets up the day-2 alien's "You have something of ours" (`morning_day_2.tres`).
3. **Loading screen:** `assets/pictures/screens/splash-screen.png` with a slow pan, the title in
the handwritten font, and a sketch UFO wobbling along a hand-drawn progress bar, about 3 s.
4. **It plays on every New vacation, and can be skipped.** Continue never plays it. Hosting co-op
skips it.
## Defaults (assumed; flip any of these on request)
**Controls.**
- A tap (Space / Enter / E / A / click) is the box's own input and goes to the next line.
- Holding Space / Enter / A for 1 s skips the whole intro. The hint is "Hold [Space / Enter / A]
to skip", bottom right, with a ring that fills while held.
- The intro polls `Input` for the hold, because the box takes the press.
**Skipping, pausing, and quitting.**
- A skip fades straight to the first morning sign, without the loading screen.
- Escape opens the pause menu as usual: the tree pauses, so the intro freezes, and the box waits
(`blocked`).
- "Restart the night" during the intro acts as a skip.
- "Save & quit to menu" clears the intro. The save is night 1's morning (`new_campaign` autosaves),
so Continue from there plays no intro.
**Names and lines.**
- Speakers: **Farmer**, **Farmer's Wife**, **Little Green Alien** (the existing speaker, who comes
back on day 2), and **Big Green Alien**. They're editable in `speakers/*.tres`.
- The user wrote "etc." for the bickering. The extra lines below marked *(draft)* are
placeholders to rewrite freely in the `.tres`.
**Staging.**
- The car waits parked nose-out (facing north) for the departure, so it drives straight off.
- The same luggage rides on the ending's car (one shared kit), so the farmers come home loaded.
- If the house model's front door is a separate node, it swings open. Otherwise the farmers appear
on the porch with a door creak.
- The scarecrow stands on a wooden post at its start spot (3, −13) in its rest pose, arms out
(check that the mannequin's rest pose is a T-pose; if it isn't, ask).
- Its lantern stays dark until the flash. Only player 1's scarecrow exists during the intro.
- The chest glow is on every scarecrow (the co-op partner's too) from then on. It's a fixed part
of the look, so nothing is saved for it.
## The storyboard
About 75 s if nothing is skipped or hurried. Stage names are `OpeningIntro.stage` values.
| # | Stage | Light | Camera | What happens | Sound |
|---|---|---|---|---|---|
| 1 | `leave` | morning (forced) | Wide from the yard's north-east, looking south-west at the porch and the parked car | The farmers come out of the door (19.6, −29.8) and walk to the car's doors. The **departure** conversation starts as they step off the porch, and they wait at the doors until it ends. ~18 s | door creak, day ambience |
| 2 | `board` | | same | The farmer gets in on the left and the wife on the right; each disappears with a door slam. The engine starts and the luggage jiggles. ~2 s | car door ×2, engine |
| 3 | `drive` | | Follows behind the car (the ending's follow camera), then stops at GapDriveway and watches it shrink down the road | The car drives the ending's route backwards: north along the yard road, east out GapDriveway (a horn toot), then south down the road at x 52 and away. The luggage sways on the turns. ~12 s | engine, horn |
| 4 | `card` | night (forced, snapped while black) | — | Fade to black. "Later that night...." is written letter by letter in the handwritten font, centered. ~3.5 s | night ambience fades in |
| 5 | `flight` | night | Low on the farm, looking up at the night sky; it pans to track the UFO | A big UFO (`EnemySystem.build_ufo_mesh` at scale ~8, `ufo.gdshader`, lights pulsing) crosses from the far north-east toward the farm. Its path jerks and banks with each line of the **flight** conversation (a tug-of-war on the controls). ~18 s | UFO hum (loop) |
| 6 | `wobble` | | Holds on the UFO above the farm | It stops over the scarecrow at about (3, 20, −13). It sways side to side (±3 m, ±20° tilt) faster and faster, then spins up hard. ~4 s | rising whine |
| 7 | `drop` | | Cuts to the scarecrow on its post as the part comes into frame | A part flies off the rim and tumbles down with a blue trail. It lands about 0.8 m in front of the scarecrow with a thud and a puff of dust. ~2.5 s | falling whistle, thud |
| 8 | `flash` | | Close on the scarecrow | The part pulses three times, then a **blue flash**: a light spike, a full-screen blue-white flash fading out, and a ring across the ground. The part streaks into the scarecrow's chest and the chest glow comes on. The scarecrow drops off its post (`Hit_A`), lands, its lantern lights, and it looks around (`Idle_B`), then up. ~5 s | shimmer zap |
| 9 | `uh_oh` | | Low behind the scarecrow, looking up at the hovering UFO | The **uh-oh** conversation. The UFO shifts guiltily. ~7 s | hum |
| 10 | `escape` | | Holds on the scarecrow looking up | The UFO tilts and zooms off up and away, its lights streaking. ~2.5 s | whoosh |
| 11 | `loading` | morning (released, snapped) | — | Fade to black, then the loading screen, about 3 s. Under it the farm is put back: post and part gone, the scarecrow idle at its start, HUD and input back, the light snapped to the morning look. ~4.5 s | |
| 12 | `end` | | the game camera | Fade into the first morning sign ("The farmers are away", `review_panel.gd:164-170`). `finished` is emitted. | |
## The lines
**`intro/departure.tres`**
- Farmer: "Well, I sure hope the farm will be okay."
- Farmer's Wife: "Well then, you should have paid someone to come watch it for you instead of
buying those front row tickets to the Bon Jovi concert."
- Farmer: "Ah, it'll be alright. What's the worst that could happen?"
**`intro/flight.tres`**
- Little Green Alien: "I want to fly the ship!"
- Big Green Alien: "You flew it all the way from the Andromeda galaxy! It's my turn!"
- Little Green Alien: "Your tentacles don't even reach the pedals!" *(draft)*
- Big Green Alien: "Mother said we take turns! Give me the stick!" *(draft)*
- Little Green Alien: "Hands off! [shake]HANDS OFF![/shake]" *(draft; the wobble starts on this line)*
**`intro/uh_oh.tres`**
- Big Green Alien: "Uh oh.... we should go tell mother."
- Little Green Alien: "Are you crazy!!! Let's just get out of here, maybe no one will notice!"
## How it fits together
**`OpeningIntro`** (`game/scripts/opening_intro.gd`)
- A `Node3D` under `FarmSim`, built and wired in `_ready` like `FarmersReturn` (`farm_sim.gd:312`).
- Everything is built in `start()` and freed in `clear()`, so nothing exists during play.
- `step(delta)` drives the stage machine, so tests can step it headless the way
`test_flow.gd:_ending` steps the ending.
- Its API is `start()`, `skip()`, `clear()`, `running`, `done`, `stage`, and `signal finished`.
**`CutsceneKit`** (`game/scripts/cutscene_kit.gd`): static helpers shared with `FarmersReturn`.
- The car with its roof luggage.
- The tinted farmer mannequins with straw hats, and their `AnimationPlayer`s.
- Camera easing (`_move_camera`) and the follow-behind camera.
- The letterbox overlay with its caption label and the skip hint.
**Its own `DialogueBox`** sits in the intro's overlay `CanvasLayer`, because the HUD layer is
hidden.
- Its conversations live in `game/resources/dialogue/intro/`. `DialogueDirector.load_all` skips
subfolders, so they never play by themselves.
- They use `pause_game = true` (the box takes input) with `auto_advance` ≈ 1.6 s, so lines go on
by themselves and a tap hurries them. The intro plays them with `box.play()`, never through
`DialogueDirector.play()`, so the tree isn't paused.
- Main sets the box's `blocked` the same way as `sim.dialogue.box.blocked` (`main.gd:66`).
- **Framing:** the paper is 1360×350, 118 px above the bottom, and the heads stand above it. Keep
the action in the upper half of the frame while a line is up. If that isn't enough, give
`DialogueBox` a size scale at the timing review (#34).
**Hooks it needs:**
- **`DayNight.forced`** (empty = normal): `target()` returns the named look ("morning" = the
MORNING mix, "night" = `NIGHT`). A way to keep a lantern dark.
- **The morning sign:**
- `ReviewPanel.refresh()` keeps the sign hidden while `sim.intro` is running.
- `DialogueDirector` doesn't start morning conversations or call `_sign(true)` while the intro
runs.
- When the intro ends, it hands over: night 1's morning conversations (none today), then the
sign.
- **`Tutorial`** hides while the intro runs.
- **Freezing and focus:** `sim.freeze_local(true)` stops the scarecrow's input (morning input
isn't otherwise gated). Audio focus goes to the cutscene's subject (`sim.audio.focus`), and the
HUD layer is hidden (`FarmersReturn._set_hud`).
- **`Main.new_vacation()`** (`main.gd:162`): after `new_campaign()`, call `sim.intro.start()`
unless hosting. `_host_coop` must not start it. `to_menu()` clears it.
**`LoadingScreen`** (`game/scripts/loading_screen.gd`) is a self-contained `Control` with
`play(seconds)` and `signal finished`, so it can be reused later.
## File overlap and order
| File | Tasks |
|---|---|
| `farmers_return.gd` | #29 (moves pieces into the kit) |
| `cutscene_kit.gd` (new) | #29, used by #33 |
| `day_night.gd` | #30 |
| `farm_audio.gd`, `game/tools/synth_audio.gd`, `assets/audio/synth/` | #30 |
| `player_character.gd` (or wherever the scarecrow's model is built) | #30 (chest glow) |
| `sketch.gd` | #31 (two icons) |
| `game/resources/dialogue/` | #31 |
| `loading_screen.gd` (new) | #32 |
| `opening_intro.gd` (new), `farm_sim.gd`, `main.gd`, `review_panel.gd`, `dialogue_director.gd`, `tutorial.gd` | #33 |
| `test_flow.gd` | #29 (ending still passes), #33 (new-vacation flow) |
| `README.md`, `game/LAYOUT.md`, `game/PLAYTEST.md`, `RULES.md` | #33 |
- **Wave 1 (parallel):** #29, #30, #31, #32. They touch different files.
- **Wave 2:** #33, after all of wave 1.
- **Wave 3:** #34, the timing review with the user.
## Tasks
### #29 [intro] Cutscene kit and the loaded-up car
- **Extract from `FarmersReturn`:** the car instancing (collision layers off, engine player), the
farmer building (tinted mannequins, straw hats, `AnimationPlayer` with
`player_animations.res`), `_move_camera` / `_follow_camera` / `_face`, and `_build_overlay`. Put
them in `CutsceneKit` as static functions or small helper classes. `FarmersReturn` keeps its
behavior exactly.
- **Roof luggage** (`CutsceneKit.load_roof(car)`), National Lampoon's style:
- A tall, slightly crooked stack on `car_002`'s roof rack, as children of the car so it rides
along.
- Use the farm pack's `bag_001..003` and `box_004/005` props, scaled, plus 3–4 primitive
suitcases in different colors. Add 2–3 thin dark straps over the top, tied down, and one item
hanging off the side (a rolled mattress or a bike, primitives are fine).
- Find the roof height from the car mesh's AABB, not a hard-coded number.
- A small sway, driven by the car's turning and braking (`CutsceneKit.sway_luggage(delta, turn,
accel)`).
- The ending's car gets the luggage too.
- **Verify:** `test_flow.gd`'s `_ending` passes unchanged. A new check confirms the car has its
luggage and the luggage sits above the roof's AABB top. No new FAIL lines. Take a screenshot of
the parked car (headless can't render, so use the editor binary with a window, as in
`render_overview.gd`) and show it to the user.
### #30 [intro] Hooks: forced lighting, sounds, the chest glow
- **`DayNight.forced: String`** (`""`, `"morning"`, `"night"`): `target()` returns that look while
it's set, and `snap()` still works. Add a lantern override (`lanterns_dark := false`) so the
intro can keep the scarecrow's lantern off until the flash.
- **Sounds** (`synth_audio.gd`, written to `assets/audio/synth/`, registered in `FarmAudio`):
- `ufo_hum`: a loop, a low wobbling drone.
- `ufo_whine`: a rising spin-up, ~2 s.
- `part_fall`: a falling whistle, ~1.5 s.
- `life_flash`: a bright shimmer-zap.
- `ufo_zoom`: a doppler whoosh away.
- `car_door`: a dull metal thunk.
- `door_creak`: try `kenney/rpg/creak*` first (already used for `thief_arrive`).
- Reuse `fall`, `horn`, `truck_engine`, and the ambiences.
- **Chest glow:**
- A small emissive blue core on each scarecrow's model at chest height, with a faint pulse and a
weak `OmniLight3D`. Keep it subtle in daylight and visible at night.
- It's on by default, and `set_core_glow(on)` lets the intro hide it until the flash.
- It must not break the hit-flash material swap or the toon look.
- **Verify:** unit checks that `forced` overrides `target()` and clears back, and that the new
sound names resolve to streams. No new FAIL lines. Take a screenshot of the scarecrow at night
showing the glow.
### #31 [intro] Speakers and the three conversations
- **Speakers** in `game/resources/dialogue/speakers/`:
- `farmer.tres` (left side, low voice pitch).
- `farmers_wife.tres` (right side, higher pitch).
- `big_green_alien.tres` (icon `"thief"`, right side, `portrait_height` ~380 so it's literally
bigger than the Little Green Alien's 300, lower pitch).
- The existing `little_green_alien.tres` stays as it is, on the left.
- **Two new `Sketch.ICONS`:** `"farmer"` (a round face, a straw hat, a moustache) and
`"farmers_wife"` (a straw hat with a flower, curls), drawn the way the existing icons are.
- **Conversations** in `game/resources/dialogue/intro/` (`departure.tres`, `flight.tres`,
`uh_oh.tres`), with the lines from "The lines" above:
- `pause_game = true`, `auto_advance` 1.6, `enabled = false`.
- Being in a subfolder already keeps them from playing by themselves; `enabled = false` is a
second guard.
- Write them as text, with uids.
- **Verify:** `test_dialogue.gd` loads each one and checks the speakers and line counts.
`DialogueDirector.load_all(DIR)` still returns only `morning_day_2`. No new FAIL lines. Take a
screenshot of the box with each new speaker up.
### #32 [intro] The loading screen
- **`LoadingScreen extends Control`:** full-rect, on its own `CanvasLayer` (the caller adds it).
- **Splash art:** `splash-screen.png`, scaled to cover (crop, never letterbox), with a slow
Ken-Burns pan and zoom over the screen's time.
- **Title:** "Harvest Season" in `Sketch.font()` with the outline style (there's no logo image
yet; `assets/pictures/logo/` is empty).
- **Progress:** a hand-drawn progress bar (`Sketch.box` / `Sketch.line`) fills over `seconds`. The
sketch `"ufo"` icon bobs and wobbles along its leading edge. "Loading..." is written under it,
with the dots cycling.
- **API:** `play(seconds := 3.0)` fades in from black, runs, and emits `finished` at full
progress. The caller fades it out.
- It works while the tree is paused (`PROCESS_MODE_ALWAYS`).
- **Verify:** a unit check that `finished` fires once after `seconds` of steps. Take a screenshot
mid-way.
### #33 [intro] The opening intro
Blocked by #29–#32.
- Build `OpeningIntro` per "How it fits together" and the storyboard. That means stages 1–12, the
hold-to-skip, its own `DialogueBox`, and the hooks into `ReviewPanel`, `DialogueDirector`,
`Tutorial`, `freeze_local`, the HUD layer, audio focus, and `DayNight.forced`.
- **The part:** a primitive-built gizmo, about 0.5 m: a dark metal cylinder and a torus, a glowing
blue core (emission plus an `OmniLight3D`), and a blue trail while it falls (a `GPUParticles3D`
or a few fading quads).
- **The flash:** an `OmniLight3D` energy spike, a full-screen `ColorRect` in the overlay going
blue-white and fading, and a ground ring (reuse `fear_burst.gdshader` if it fits).
- **The UFO:** a `MeshInstance3D` with `build_ufo_mesh(8.0)` and a `ufo.gdshader` material, set up
as `FarmSim` does for the enemy UFOs (`farm_sim.gd:201`) but its own instance. Spin it with the
shader's spin plus node rotation for the fast spin. Give it night glow.
- **Wiring:**
- `FarmSim` builds `intro` next to `ending`.
- `Main.new_vacation()` starts it, except from `_host_coop`. `to_menu()` clears it.
- "Restart the night" skips it.
- Main sets the intro box's `blocked`.
- **Ends cleanly:** after `finished` (or a skip), the farm must be exactly what `new_campaign()`
leaves:
- the scarecrow at its start, input back, HUD back, the lighting un-forced and snapped;
- the post, the part, the UFO, the car, and the farmers freed;
- the morning sign up with focus on its Start button.
- **Docs:** README (what happens on New vacation; the skip), `game/LAYOUT.md` (the intro's staging
points, next to "The car's route"), `game/PLAYTEST.md` (a line to watch it once and try a skip),
and RULES.md if it describes starting a vacation.
- **Verify:**
- A new `test_intro.gd` (registered in `run_tests.gd`) covers these:
- New vacation starts it, and Continue doesn't.
- Hosting doesn't start it.
- Stepping to the end visits every stage in order, ends with `done`, and the sign is visible.
- During the intro the sign is hidden, the HUD layer is hidden, and the scarecrow can't move.
- A skip at each stage ends clean.
- `to_menu` mid-intro leaves no intro nodes. Restart mid-intro ends clean.
- The lighting is back to the MORNING target, and the chest glow is on after.
- No new FAIL lines.
- A windowed run with frames captured at every stage, to show the user.
### #34 [intro] Timing review with the user
Run the intro in a window and capture each shot. Then go through the user's notes: line timing
(`auto_advance`, letters/s), shot framing against the dialogue box (add a box size scale if
needed), UFO sway and spin feel, flash strength, the luggage's look, the loading screen's length,
and rewrites of the *(draft)* lines. No acceptance beyond the user's sign-off.