Standoff sniper enemy #45
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?
Part of #40. Depends on the enemy-foundation ticket.
Scope
EnemyStandoffComponent.tscn+.gd(capability_id = "standoff") - holds a preferred distance from the nearestplayer_shipsnode instead of ramming:preferred_range(suggest 620), advances when farther than that, retreats when closer thanpreferred_range * 0.75, drifts laterally in the band between. Do not put a pursuit component on the same enemy.EnemyRangedWeaponComponent.tscn+.gd(capability_id = "ranged_weapon") - fires anEnemyProjectileat the nearest ship's current position (deliberately not leading the target, so it is dodgeable):fire_range(suggest 700),fire_cooldown(suggest 2.2 s),projectile_speed(suggest 260 - well under the interceptor's 460max_speed, so a moving ship can evade),damage1.VesselWeaponComponent.gd, which is the reference implementation.SniperEnemyDefinition.tres-enemy_id = "sniper",max_hp4,speed~90, an elongated hull clearly different from the chaser's diamond, and its own glow colour distinct from the chaser red and the gas-bomb pink (a cold cyan or violet reads well against both surfaces).EnemyDefinitionsso it is placeable from a planet setup byenemy_id.Acceptance criteria
preferred_rangeand stays in that band - it never reaches contact range with a stationary fleet.fire_range, on cooldown.max_speedis not guaranteed to be hit - assert the projectile is slow enough that the ship clears the impact point.Tests
tests/test_sniper_enemy.gd(bash tests/run_tests.sh sniper), plus a 720x1280 screenshot showing it beside a chaser so the two are visually distinguishable.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_gas_bomber_cooldowns.gd.bash tests/screenshot.sh <res://Scene.tscn> <out.png> <frames> 720x1280. Use few frames (~10-20); 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://anywhere outside this ticket's explicit scope).GameStateis an in-memory autoload. Do not invent a save system.Implemented and pushed as
fc2b5ca.EnemyStandoffComponentholds a preferred distance from the nearest player ship instead of ramming: advances beyondpreferred_range, retreats insideretreat_range_factorof it, drifts laterally in the band between. Never paired with a pursuit component.EnemyRangedWeaponComponentmirrorsVesselWeaponComponentfor an enemy: fires anEnemyProjectileat the target's current position, not led, so a moving ship can dodge it (projectile_speed260 vs. the interceptor's 460max_speed).EnemyDefinitions- placeable from a planet setup byenemy_id, no other code touched.New test
tests/test_sniper_enemy.gdcovers standoff distance-holding (never reaches contact range), fire-range gating, cooldown, dodgeability, and hit/shield-absorption. This one took a few iterations: physics ticks can run ahead of a SceneTree test's own_process()clock under this device's load, so the cooldown-violation check ended up reading the component's ownfire_timerdirectly (a rising value means it refired) instead of comparing projectile counts against a wall-clock wait - and manually repositioned ships need theirmove_targetre-pinned, orShip's own steering silently drives them back to the stale target. Verified visually beside a chaser at 720x1280 for a clear hull/colour contrast.Part of the #40 conquest-mechanic breakdown, alongside #46.