harvest/docs/plan.md
Forrest 5392ae09af Phones: interface scale capped at 1.7; settings fields for wave 2
The user lowered the cap from 1.8 so the smallest iPhones (SE, 13 mini) keep a canvas about
635 px tall. GameSettings gains swap_sticks, camera_distance (FollowCamera.PHONE_DISTANCE) and
haptics, unsaved for now, so #38's apply_settings and #41's settings can be built in parallel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:48:32 -04:00

25 KiB
Raw Permalink Blame History

Harvest Season — playable on phones (2026-10-14)

Status: planned, not started. The iOS test port showed the game runs well on an iPhone: night 20 with every enemy on the farm held 60 FPS (worst frame 19.7 ms, worst physics 0.8 ms). Floating thumbsticks are in (TouchSticks, 8c81d81): the right half moves and the left half attacks. This plan covers everything else a phone player needs to play a whole vacation with touch alone: controls for every action, an interface sized for a 6" screen that stays clear of the notch, prompts in touch words, and the platform details. Tasks continue at #35–#46. The opening-intro plan this file replaces is in git at 5dbad4c; its #34 (timing review) is still open.

Ads and the remove-ads purchase come in the next plan, once the game plays well by touch.

Ground rules for workers

  • Godot binary: godot is not on PATH. Use ~/Downloads/Godot_v4.7.2-stable_linux.x86_64 wherever 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, because tuning breaks a few dozen checks. Run the suites you touch before editing, diff the FAIL lines afterwards, and judge your task by new FAIL lines only. One suite: -- --suite=test_x.
  • Mobile tests go in game/tests/mobile/, one file per task (see #35). test_mobile (-- --suite=test_mobile) runs them all, so no task edits run_tests.gd's list after #35. Force phone mode with MobilePort.forced = 1 and send touches with game/tests/mobile/touch.gd, which goes through Input.parse_input_event so Godot's touch-to-click emulation runs as it does on a phone.
  • Parallel worktrees: give each headless run its own XDG_DATA_HOME.
  • Phone-only behaviour stays behind MobilePort.active(). The desktop build must not change: same strings, same layout, same input. Each task checks a sample of desktop strings or values unchanged.
  • Seeing the phone build on desktop: godot --path . --rendering-method mobile --windowed --resolution 2340x1080 -- --mobile --safe-area=140,0,140,60 (from #35: --safe-area=left,top,right,bottom in window pixels simulates a notch and home indicator). Also try a 4:3 window (--resolution 1600x1200) for iPads. Headless runs draw nothing, so take screenshots from a windowed run and show them to the user.
  • No new HUD text. The user had the pop-up text removed. The touch buttons below are controls the user asked for: icons with at most one short word. Prompts change their wording on phones, not their number. Ask before adding any other text.
  • farm.tscn and .tres files: edit them as text. A headless ResourceSaver.save() drops the uid= lines.
  • Co-op is off on phones. Don't touch co-op code. Desktop co-op must keep working.
  • Graph: after modifying code, run graphify update ..

Decisions (the user's)

  1. Move on the right, attack on the left (2026-10-14). This is the mirror of most twin-stick games. TouchSticks.MOVE_ON_RIGHT holds it, and a Swap setting flips it (#41).
  2. Phones drop the toon and pixel look (standard materials, Mobile renderer) and co-op.
  3. Floating sticks: a stick starts where the finger lands and is drawn only while held.
  4. iOS first through Codemagic and TestFlight. Android follows (#44).
  5. Sprint becomes a speed upgrade, on every platform (2026-10-14). Owning the Sprint upgrade raises the scarecrow's base speed for good. There's no more hold-to-sprint, time limit, cooldown, or stamina bar (#46), so phones need no sprint control.

Defaults (assumed; flip any of these on request)

Controls

  1. Contextual buttons. A button shows only when it can do something: Use near something usable, Patch when hurt and carrying straw, Bomb once owned, Build by day. This keeps the screen clear.
  2. Placement. The attack side has a column of Fear, Bomb, and Patch along its outer edge, above where the thumb rests. The move side has Use and Build. Pause sits at the top edge beside the day widget. Tap a hotbar slot to switch weapons and tap the backpack for the pouch. See the diagram below.
  3. Sprint's boost: +25% base speed (sprint_speed_mult 1.25). The old burst was +80% for 4 s, too fast to keep on all the time. Tune it in game_config.tres.
  4. Bomb. A tap throws along the attack stick's direction, or the last one, 7 m out, the same as on a gamepad. The orange landing ring already shows where it will land.
  5. Use. It works like E. Hold it to gather, repair, or upgrade a structure. Tap it to open the workbench or the shed. Its word follows what's in reach: Gather, Repair, Upgrade, Workbench, or Shop.
  6. Build mode. The attack half becomes the placing finger: the ghost sits on the ground under the finger, within build range. Buttons are Place, Rotate left and right, Dismantle (over a structure), and Done. Tap a build-bar slot to pick what to build. The move stick still walks.
  7. Dialogue and tips. A tap advances a conversation, as now. A Skip button skips a conversation, and an × on the tip box hides tips.
  8. Haptics. A short buzz when the scarecrow is hit, on by default, with a setting.

Screen 9. Interface scale. It's set automatically from the screen's physical size: about 1.6× on phones, 1× on iPads and desktop, capped at 1.7× (the user's call, 2026-10-14). An Interface size setting (80–130%) adjusts it. At 1.6× on a 19.5:9 phone the canvas is about 1460×675; at the 1.7 cap (iPhone SE, 13 mini) it's about 635 tall (SE: about 1130×635). Every menu and panel must fit 635 px tall. 10. Safe area. Every HUD widget and menu stays inside it, clear of the notch, the rounded corners, and the home indicator. 11. World labels (Gather, Repair, a structure's name) draw as flat text on phones (ScreenLabels), so they're sharp and scale with the interface. 12. Camera. 12 m on phones (16 on desktop), adjustable in settings. No pinch zoom yet. 13. Settings on phones. No Fullscreen, VSync, mouse note, or bindings table. It adds Interface size, Swap sticks, Camera distance, and Haptics, plus a short touch-controls guide. 14. Minimum touch target. 44 pt (Apple's guideline), worked out from the scale (#35).

Platform 15. No Quit buttons on phones. Android's back button pauses, closes the top menu, or quits from the main menu. 16. iPad supported. Layouts must fit 4:3 too. If iPad isn't wanted for v1, switch targeted_device_family to iPhone only and drop the 4:3 checks. 17. Android is in this plan (#44) but can wait until iOS plays well.

The touch layout (19.5:9 phone, defaults)

 ┌──────────────────────────────────────────────────────────────────────────┐
 │ (portrait) HP ▬▬▬▬▬                              [ ‖ ]  ┌ Day 3 of 30 ┐  │
 │                                                         │ 2:58 to Dusk│  │
 │                                                         └─────────────┘  │
 │  [Fear]                                                          [Use]  │
 │  [Bomb]        attack half: a finger is the     move half: a     [Build] │
 │  [Patch]       attack stick (aim + attack)      finger is the            │
 │                                                 move stick               │
 │ (backpack)               [1][2][3][4] [bomb]  hotbar                     │
 └──────────────────────────────────────────────────────────────────────────┘
   notch side ←→ safe-area inset       home indicator ↓ inset

Build mode swaps the button columns: the attack side gets Rotate ⟲ ⟳ and Dismantle, and the move side gets Place and Done. The build bar replaces the hotbar.

How it fits together

  • MobilePort (exists) gains ui_scale(), safe_rect(canvas_item), the --safe-area simulator, and a forced override for tests (#35). GameSettings.apply sets the window's content_scale_factor on phones. That scales every CanvasLayer (HUD, menus, sticks) and leaves the 3D view alone.
  • Prompts (new, #36) returns touch wording on phones and today's exact strings elsewhere. Every key-naming string goes through it. The touch words name the buttons of #38–#40.
  • TouchSticks (exists) gets move_on_right as a variable (#38). It stops pressing fire in build mode and hands the attack half to placing (#40).
  • TouchButtons (new, #38) is a HUD Control with the contextual buttons, drawn in the Sketch style. Its buttons press the existing actions with Input.action_press and action_release (hold while the finger is down, and held for at least one physics tick), so game code and ActionEdges don't change. Buttons are Controls with STOP, so they take their touches before the sticks. Everything else stays IGNORE so the sticks keep the screen.
  • Settings contract (#38 and #41): TouchSticks and TouchButtons join group &"touch_controls" and implement apply_settings(s: GameSettings). GameSettings.apply calls get_tree().call_group(&"touch_controls", &"apply_settings", self) and sets the camera's distance. This way #41 doesn't need main.gd.
  • HUD hit targets (#39): the hotbar slots, the backpack, the tip ×, and the dialogue Skip button are small STOP Controls over today's drawn widgets.
  • BuildMode (#40) gets a screen-point cursor hook (the mouse ray path, fed by a finger), plus public confirm() and dismantle() that the buttons call. The key and gamepad paths stay the same.
  • Layout passes (#41–#43) fit every screen to the scaled canvas inside safe_rect. They use scroll lists where a panel is taller than about 640 px, wrapping, and anchors instead of 1920×1080 absolutes.

File overlap and order

File Tasks
mobile_port.gd, game_settings.gd #35, then #41 (game_settings.gd: new settings)
run_tests.gd, test_mobile.gd (new), game/tests/mobile/ #35 creates them; later tasks add their own files only
prompts.gd (new); key strings in tutorial.gd, review_panel.gd, interactions.gd, workbench.gd, shed_counter.gd, build_mode.gd, build_hud.gd, opening_intro.gd, farmers_return.gd #36
project.godot, main.gd, main_menu.gd, pause_menu.gd, toon_look.gd, screen_labels.gd, follow_camera.gd #37 (wave 1). main.gd again in #38; main_menu.gd and pause_menu.gd again in #41
touch_buttons.gd (new), touch_sticks.gd, interactions.gd (query only), main.gd, sketch.gd (icons) #38, then #40 (touch_sticks.gd, touch_buttons.gd)
player_character.gd, game_config.gd, game_config.tres, upgrades.gd (docs), test_scarecrow.gd, test_economy.gd, test_nights.gd #46
scarecrow_hud.gd #46 (stamina bar out, wave 1), then #39, then #43
scarecrow_hud.gd, resource_hud.gd, tutorial.gd, dialogue_box.gd #39, then #43 (all but resource_hud.gd)
main_menu.gd, pause_menu.gd, confirm_box.gd, settings_menu.gd, game_settings.gd, scarecrow.gd (haptics) #41
review_panel.gd, end_panel.gd, upgrade_panel.gd #42
build_mode.gd, build_hud.gd #40 (after #36's string edits)
phase_hud.gd, radar_hud.gd, alert_manager.gd, cutscene_kit.gd, loading_screen.gd #43
export_presets.cfg, codemagic.yaml, adaptive icon layers #44
README.md, game/LAYOUT.md, game/PLAYTEST.md, docs/ios-test-port.md #45
Wave Tasks (parallel within a wave) Size
1 #35 scale and safe area · #36 prompts · #37 platform · #46 sprint as a speed upgrade M · M · S · S
2 #38 action buttons · #39 tappable HUD · #41 menus and settings · #42 panels L · M · M · M
3 #40 build mode · #43 HUD and cutscene layout L · M
any #44 Android (independent; best once iOS plays well) M
last #45 device playtest and docs (with the user) —

Tasks

#35 [mobile] Interface scale, safe area, and the mobile test kit

(#46, the sprint change, is in wave 1 too. Its section is after #44.)

  • MobilePort.ui_scale(): work out the physical screen height in inches from DisplayServer.screen_get_size() and screen_get_dpi(). Use clampf(4.3 / inches, 1.0, 1.7) (the cap was 1.8; the user lowered it after #35), which gives about 1.6 on phones and 1.0 on iPads, times GameSettings.interface_size (0.8–1.3, default 1.0). Desktop is always 1.0. Check screen_get_dpi() on an iPhone through the PerfTest overlay before relying on it. If it's wrong or 0, fall back to the screen's shorter-side size class (phone below 500 pt, else tablet).
  • Apply it in GameSettings.apply on phones as get_window().content_scale_factor.
  • MobilePort.safe_rect(ci: CanvasItem) -> Rect2: DisplayServer.get_display_safe_area() mapped into the canvas through the viewport's final transform, so it includes the scale. On desktop it's the full visible rect. A --safe-area=l,t,r,b user argument (window pixels) simulates an inset.
  • static var forced := -1 (−1 = detect, 0 = desktop, 1 = phone) for tests. active() honours it.
  • minimum_target(): 44 pt in canvas pixels at the current scale.
  • Test kit: game/tests/test_mobile.gd, added once to run_tests.gd's SUITES, which runs every game/tests/mobile/*_test.gd in name order with the runner's check(). mobile/touch.gd has static touch(i, canvas_pos, pressed) and drag(i, from, to).
  • Port the sticks checks (the 24 from 8c81d81's driver) into mobile/sticks_test.gd.
  • Verify: scale_test.gd covers the scale for phone, tablet, and desktop sizes, the safe rect with a simulated inset, and desktop untouched (factor 1). sticks_test.gd passes. Take screenshots of the day HUD at 2340×1080 with an inset and at 4:3 (layouts will overflow; #41–#43 fix that). No new FAIL lines.

#36 [mobile] Prompts in touch words

  • Prompts (prompts.gd): Prompts.touch() returns MobilePort.active(), and one function or constant per prompt returns the touch wording or today's string.
  • Touch wordings (the button names come from #38–#40):
    • World labels: "[E / X] Gather" becomes "Gather". Repair, Upgrade, Upgrades, and Shop likewise lose the key.
    • Build ghost: "[LMB / RT] Build" becomes "Place", and "[RMB / B] Dismantle" becomes "Dismantle (+refund)".
    • Build bar help line: "Place · Rotate · Dismantle · Done" (or none, if the buttons make it redundant; show the user).
    • Cutscenes: "Hold to skip" (intro) and "Tap to skip" (farmers' return).
    • Tip footer: "Tip · × hides tips".
    • The tutorial tips and the first morning sign's lines, rewritten for touch. Examples: "Move with your right thumb…", "Hold Use at a dead tree…", "Tap the backpack…", "Build (by day): tap Build, pick a fence, put your finger where it goes, then Place…", "Your left thumb aims and attacks… tap the hotbar to switch… Bomb throws one…", "Crowded? Fear…", "Hurt? Hold Patch…". Show the user the full set.
  • Verify: prompts_test.gd checks the phone strings for each prompt and that a sample of desktop strings is byte for byte what it was. No new FAIL lines.

#37 [mobile] Platform: back button, no Quit, flat labels, camera

  • Android back: set application/config/quit_on_go_back=false. Main handles NOTIFICATION_WM_GO_BACK_REQUEST like the pause action: playing pauses; paused closes the confirm box, then settings, then resumes; at the main menu it quits (Android convention).
  • Quit: hide the main menu's Quit and the pause menu's "Quit the game" on phones.
  • World labels on phones: ScreenLabels without ToonLook. Main adds ScreenLabels on its own on phones, so the Label3D prompts draw flat and scale with the interface. ToonLook keeps creating it on desktop.
  • Camera: default distance 12 m on phones (FollowCamera.distance). The setting comes in #41.
  • Verify: platform_test.gd covers the back-request sequence (play, pause, settings, back, back, resume; main menu quits), no Quit on phones (Quit still there on desktop), ScreenLabels present on phones, and the camera distance. A screenshot of world labels at 1.6×. No new FAIL lines.

#38 [mobile] Touch action buttons

  • TouchButtons (touch_buttons.gd) is a HUD Control (Main adds it beside TouchSticks). It lays out inside MobilePort.safe_rect, with each button at least MobilePort.minimum_target(). Buttons are round, in the Sketch style, with an icon and at most one word. The set:

    • Pause: opens the pause menu. Top edge, beside the phase widget. Always shown while playing.
    • Fear: a tap. Shows the cooldown as a ring, like the portrait's.
    • Bomb: shown once pumpkin bombs are owned. A tap throws (offhand: press, then release). Shows a ring while it recharges.
    • Patch: shown when hurt and carrying straw. Hold it, with a 2 s progress ring.
    • Use: shown when something is in reach. Its word comes from Interactions (a new read-only focus() that returns kind and label; no behaviour change). Hold or tap as E does.
    • Build: by day. Toggles build mode (#40 adds the build-mode set).
  • No sprint control: after #46, Sprint is a passive speed upgrade.

  • TouchSticks.move_on_right becomes a variable (default MOVE_ON_RIGHT). The button columns follow it. Both nodes join &"touch_controls" with apply_settings(), a stub until #41.

  • A button keeps its action pressed for at least one physics tick, so a quick tap still counts. Pause, freeze, and hiding let everything go, as the sticks do.

  • Icons go in Sketch as needed (pause, bomb, patch, use, build).

  • Verify: buttons_test.gd drives each button by touch:

    • Fear starts its cooldown.
    • Holding Patch heals after 2 s.
    • Holding Use gathers at a node; tapping Use by day opens the workbench.
    • Bomb throws.
    • Pause opens the menu.
    • A touch on a button starts no stick; hidden buttons don't block the sticks.

    Take a screenshot of the day HUD at 2340×1080 with an inset. No new FAIL lines.

#39 [mobile] Tappable HUD

  • Hotbar: tap a slot to equip that weapon (only when combat allows switching, as with Tab).
  • Backpack: a tap toggles the pouch panel, and a tap outside closes it. The pouch panel fits the scaled canvas.
  • Tips: an × on the tip box hides tips (as hide_tips).
  • Dialogue: a Skip button on conversations that pause the game skips the conversation (as Backspace). A tap still advances.
  • Each hit target is a STOP Control over its drawn widget only. The rest of each widget stays IGNORE.
  • Verify: hud_taps_test.gd covers each tap and checks that a touch beside each widget still starts a stick. Screenshots. No new FAIL lines.

#40 [mobile] Build mode by touch (after #36 and #38)

  • In build mode, TouchSticks never presses fire. This fixes placing on every tilt. A finger on the attack half sets BuildMode's screen-point cursor, so the ghost goes under the finger, clamped to build_range, and stays put when the finger lifts.
  • The TouchButtons build set: Place (greyed when invalid; the ghost label still says why), Rotate ⟲ and ⟳, Dismantle (when the cursor is over a structure), and Done. Build-bar slots are tappable to pick. The build bar sits above the home indicator.
  • BuildMode: add cursor_screen (null means use the existing mouse or gamepad path), plus public confirm() and dismantle() taken from step. Keyboard and gamepad behave the same.
  • Verify: build_test.gd, all by touch: enter, pick a gate, put the ghost down, rotate, place (costs paid), dismantle (refund), and Done. At night Place refuses with "Building is for daytime". test_structures has no new FAIL lines. Screenshot.

#41 [mobile] Menus and settings at phone scale

  • Main menu: anchored and fitted to the scaled canvas and the safe rect.
  • Pause and confirm: buttons at least minimum_target() tall.
  • Settings on phones:
    • Audio, unchanged.
    • Touch: Interface size, Swap sticks, Camera distance (8–20 m), Haptics.
    • Gameplay: tips.
    • Display: 3D resolution scale only.
    • A short touch-controls guide in place of the bindings table.
    • Fullscreen, VSync, and the mouse note are hidden. Reset leaves hidden settings alone.
    • Drag-scrolling mustn't fight the sliders: tall rows, and a slider only grabs after a horizontal move. Check on a device.
  • GameSettings: interface_size (from #35), swap_sticks, camera_distance, and haptics, saved and loaded with fallbacks. They're applied live: the call to &"touch_controls" and the camera's distance.
  • Haptics: Input.vibrate_handheld(30) when the scarecrow takes a hit (scarecrow.gd), on phones with the setting on.
  • Verify: menus_test.gd checks every menu's buttons inside the safe rect at 19.5:9 and 4:3 (1.6× and 1.0×) and at least the minimum target, the settings round trip, and the swap moving the sticks. Desktop settings are unchanged. Screenshots. No new FAIL lines.

#42 [mobile] Panels at phone scale

  • Morning sign (about 850 tall today): fits about 640 px by scrolling or splitting into two columns, and Start the day stays visible.
  • End panel: stats wrap.
  • Workbench and shed panels: a scroll list with rows at least the minimum target, and Close always visible.
  • Verify: panels_test.gd checks each panel's rect inside the safe rect at 19.5:9 and 4:3, and that rows and buttons are at least the minimum target. The desktop layout is the same at 1920×1080. Screenshots. No new FAIL lines.

#43 [mobile] HUD and cutscenes at phone scale (after #39)

  • Every HUD widget sits inside safe_rect: the portrait and HP, the phase widget and radar, the hotbar above the home indicator, the backpack, the banner, the dusk hint, the tutorial box, and the dialogue box (paper and heads fit about 640 px).
  • Letterbox bars and skip hints, and the loading screen.
  • Alert edge arrows keep out of the real widget rects instead of today's constants.
  • Verify: hud_layout_test.gd checks every widget's rect inside the safe rect at 19.5:9 with an inset and at 4:3, and no two overlapping. The desktop layout is unchanged. Screenshots of a day, a night, a conversation, and the intro's skip hint. No new FAIL lines.

#44 [mobile] Android build

  • An Android preset:
    • Gradle build, arm64.
    • The target SDK Play currently requires.
    • Sensor landscape, ETC2/ASTC (already on).
    • An adaptive icon (foreground and background layers from app_icon.png).
    • The perf_test feature on the test build.
  • An android-perf-test workflow in codemagic.yaml: a Linux instance, the keystore from Codemagic's code-signing identities, AAB and APK artifacts, and optionally Play's internal track.
  • Needs from the user: a Google Play developer account, a keystore (Codemagic can generate one), and for a personal account, 12 testers in a closed test for 14 days before production.
  • Verify: the Codemagic build installs on an Android phone. Back behaves as in #37, the sticks and buttons work, and the safe area holds on a hole-punch camera.

#46 [gameplay] Sprint becomes a speed upgrade (all platforms)

  • When the Sprint upgrade is owned (Upgrades.owned(state, "sprint")), the scarecrow's base speed is multiplied by config.sprint_speed_mult (now 1.25) all the time, walking and running alike. Without it, the speed is unchanged.
  • Remove the burst: hold-to-sprint, sprint_time, sprint_cooldown, the stamina state in PlayerCharacter (step_sprint and friends), and the HUD's stamina bar (scarecrow_hud.gd). The sprint input action stays in project.godot (unused). Removing it is a follow-up, since #37 owns that file.
  • The upgrade's id stays "sprint" (saves and costs are unchanged). Its text becomes "Run 25% faster, always" in game_config.gd's defaults and in game_config.tres, which overrides it.
  • Update the sprint checks in test_scarecrow.gd, test_economy.gd, and test_nights.gd rather than deleting them. Check that the speed is the same without the upgrade, ×1.25 with it, with no time limit, and that it survives save and retry.
  • Verify: no new FAIL lines beyond the sprint checks this task rewrites (list any that change and why). Desktop and phone both get the boost.

#45 [mobile] Device playtest and docs (with the user)

  • A TestFlight build on iPhone (and iPad, if supported). Play a whole new vacation by touch: the intro skip, the day-1 tutorial, gathering, building, a night fight, the workbench and shed, the pouch, a conversation, settings, sending the app to the background and back, game over, retry, and the farmers' return.
  • Docs: a mobile section in README.md, the new scripts in game/LAYOUT.md, a touch checklist in game/PLAYTEST.md, and docs/ios-test-port.md brought up to date.
  • The user's notes go to docs/followups.md.
  • Done when: the user signs off that a vacation plays by touch alone.

Not in this plan

  • Ads and the remove-ads purchase: the next plan. It will need a spot for "Remove ads" in the pause menu and an interstitial at dawn.
  • Pinch zoom: it needs gesture arbitration with the sticks.
  • Co-op on phones, cloud saves, localization, and controller remapping.
  • Release cleanup: removing the perf_test feature, a real icon, and the store listing.