Space-time distorder drains energy while boosting #62
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Travelling above the fleet's default speed costs energy from the fleet hold, drained continuously while boosted.
Depends on: #54 (gas burner / energy resource) and #59 (space-time distorder). Land both first.
Scope
const ENERGY_DRAIN_PER_SECOND: float(suggest 2.0 at full boost). Drain scales with how far above default the fleet is travelling:(fleet_speed_multiplier - 1.0) / (MAX_MULTIPLIER - 1.0) * ENERGY_DRAIN_PER_SECOND, so a small boost costs proportionally less.GameState._process, alongside extractor mining and production - not in the component'stick(). Everything else that consumes or produces over time already lives in the autoload precisely so it keeps running across the space <-> surface scene swap, and the fleet keeps travelling in both scenes.mining_progressaccumulating to whole units) rather than rounding every frame, or the drain silently becomes zero at small multipliers.fleet_speed_multiplierback to 1.0, and theSpeedFadermust visibly follow it down - the control cannot keep showing a boost the fleet is not getting. Give the player a visible reason using the existing status-label idiom.Acceptance criteria
Tests
tests/test_distorder_energy.gd(bash tests/run_tests.sh distorder), measuring drain over a fixed simulated duration at two different multipliers and asserting the fader/multiplier reset at zero.Repo notes (read before starting)
/storage/emulated/0/GodotProjects/SpaceshipTest.touchon it. Android FUSE does not bump mtime under~/storage/shared, and Godot's import cache will silently keep serving the old version, making a correct fix look like it did nothing.bash tests/run_tests.sh <substring>; full suite with no argument. Tests areSceneTreescripts printingTEST_NAME: PASS/TEST_NAME: FAIL (reason)and callingquit(0|1)- copy the shape oftests/test_capture_points.gd.bash tests/screenshot.sh <res://Scene.tscn> <out.png> <frames> 720x1280. Use few frames (~15); the software rasterizer is slow.--headlessrenders nothing at all, so it cannot validate visuals.NeonDraw/NeonPiece; do not introduce a different visual idiom.*Definitionresources plus capability component scenes. Do not addif type == "..."branches.FileAccess, nouser://).GameStateis an in-memory autoload. Do not invent a save system.Traps that have already cost hours on this codebase
const X = preload(...)in a test file that is itself the-sentry point. It evaluates during that file's own early compilation, which can run before autoloads are registered; any script it pulls in that referencesGameStateinside a function body then fails to compile withIdentifier not found: GameState. Usevar X: Scriptplusload()inside_initialize()instead. See the header comment intests/test_capture_points.gd.[]to a typedArray[Resource]export from another script fails at runtime - the compiler only sees the target asResourceand cannot confirm the element type. Leave the declared default alone, or build the typed array inside the owning script.Fleet.spawn_ships(0, ...)does not empty the fleet - it falls back to one default interceptor by design. Clearfleet.shipsexplicitly if a test or preview needs genuinely zero ships.ship.positionwithout also settingship.move_targetletsShip._physics_processsteer it straight back toward the stale target within a few frames.SceneTreetest's own_process()clock under device load, even with--fixed-fps 60. Gate waits on the system's own state (a component's timer or flag), not onelapsed >= duration.queue_free()s itself (projectiles, shells) must not be re-read inside a per-frame wait condition - cache the scalar you need before the wait._screenshot_tool.gd's_initialize(), so their_ready()races the game scene's own_ready(). Do setup on the first_process()tick, andget_tree().paused = trueonce everything is placed if the scene must hold still.Implemented and pushed in
651f8b7.Sustaining a speed boost above 1.0x now continuously drains fleet energy while the fader is held above the neutral position, proportional to how far it's pushed - releasing it (or running out of energy) lets the multiplier fall back toward 1.0 rather than the boost being a one-off purchase. This keeps the distorder (#59) from being a free permanent speed-up once unlocked.
Tests:
tests/test_distorder_energy.gd(bash tests/run_tests.sh distorder_energy). Also updatedtests/test_space_time_distorder.gdto pre-stock fleet energy so its own boost measurements aren't cut short by the new drain. Full suite passed at the time (and again just now in the final full-suite run for this batch).