Add classic HUD, auto reload, furniture pathfinding and death flatline

This commit is contained in:
enne2
2026-10-11 00:58:28 +02:00
parent d6d25fabaa
commit 8a0c441af6
14 changed files with 438 additions and 19 deletions
+61
View File
@@ -0,0 +1,61 @@
# Classic HUD, automatic reload, furniture navigation, death audio
## HUD
`scripts/game_hud.gd` replaces the debug-style text block with translucent black
panels and amber classic-FPS typography. Health and magazine numbers are large,
low health (<=25) and low ammo (<=5) turn red. Reload status is explicit; wave,
score and grenade cooldown are compact at top center. Panels are above touch
controls; every HUD Control ignores mouse events so the Web start gesture works.
Desktop instructions are hidden in touch mode. `30 / 30` means loaded/max magazine,
not a fictional reserve-ammo counter (reloads remain unlimited).
## Automatic reload
The last shot triggers `start_reload()` immediately. An empty magazine detected in
physics also triggers it. Guarded against duplicate requests, full magazines and
death. Existing duration1.57s and reload sounds remain; no refill after death.
Manual R and touch reload are unchanged.
## Shared grid navigation on the room's XZ floor
`scripts/room_navigation.gd` builds a shared35x35 AStarGrid2D with0.5m cells.
Obstacles come from `office_props` box collisions transformed into world-space
XZ rectangles (including rotated chairs). Rectangles are expanded0.60m to protect
the zombie capsule radius0.35m plus grid/edge margin. Diagonals are allowed only
when both adjacent cells are free. Grid setup calls update BEFORE solid flags,
since update clears them.
Targets/start cells inside expanded obstacles are snapped to the nearest free
cell. Each zombie caches direct visibility or an A* route, refreshing approximately
every0.55–0.67s with staggered intervals rather than every physics frame. Clear
routes use direct pursuit; blocked routes follow waypoints. Entry window tween,
animations, gravity, attack range and corpse behavior remain unchanged.
Melee also checks a world-geometry ray below desk-top height: chest-high rays can
pass over tables even when the actors cannot physically approach each other.
This map is for static furniture: moved/new props require rebuilding it. Existing
body collisions still separate zombies, but this is not a full crowd avoidance
solver. No mobile FPS guarantee is made. The algorithm uses the existing simple
flat room and does not require runtime navmesh baking or native extensions.
Reference: https://docs.godotengine.org/en/stable/classes/class_astargrid2d.html
## Death sound
Copied the ORIGINAL local Half-Life `valve/sound/fvox/flatline.wav` to
`assets/audio/fvox/flatline.wav`, no source modification. SHA256:
`6fc00ca83a1310b8ff373a77ff895c5396c35416c00a974a0fa55b3fb14bd772`.
Duration3.994s, mono11025Hz. Played once at-9dB on death alongside the existing
player vocal; nonpositional so it remains audible through the camera fall.
## Verification
`tools/test_gameplay_improvements.gd`: HUD values/colors/touch hints, immediate
last-shot reload, duplicate-request guard, physical pursuits around both desks,
chairs (including rotated chair) and barrel, blocked melee through desk,
idempotent flatline and no refill after death. Passed headless and with real
PulseAudio output. All eight prior test suites pass. Touch screenshot of new HUD
inspected via test_office_atmosphere --screenshot --touch.
Existing test-shutdown resource-in-use warnings remain. Device touch feel and
smartphone performance still need real-device validation.
+3 -3
View File
@@ -3,8 +3,8 @@
`scripts/office_atmosphere.gd` adds two desks, three chairs and a metal fire barrel.
Props use low-poly primitives with simple static collisions on world layer 1.
Positions avoid the four cardinal entry corridors and the central combat space.
The zombies still use their existing direct pursuit, not a new pathfinding system;
props can obstruct arbitrary paths when the player hides behind them.
Zombies now route around furniture using the shared XZ grid described in
`GAMEPLAY-IMPROVEMENTS.md`; static collision bounds feed the navigation map.
The central ceiling OmniLight was removed. Ambient energy is 0.12 with a cool blue
color, preserving silhouette readability rather than total darkness. Two warm desk
@@ -40,4 +40,4 @@ Three screenshots `/tmp/zombie-office-{0,1,2}.png` inspected, including the barr
All seven prior suites pass: health/sky, music, grenade, waves, death, damage, touch.
Existing resource-in-use warnings at test shutdown remain. Actual smartphone
performance has not been measured; this is a small light/particle budget, not an
FPS guarantee. Keep testing arbitrary zombie routes around the new obstacles.
FPS guarantee. Physical furniture-pursuit tests are in `test_gameplay_improvements.gd`.
+8
View File
@@ -1,5 +1,13 @@
# Web build and compressed deployment
## Gameplay improvements release: 7ebf03fe3c88be15
See `docs/GAMEPLAY-IMPROVEMENTS.md`: amber HUD, automatic reload, shared furniture
pathfinding and original Half-Life flatline. PCK 3,972,620 bytes; gzip payload total
12,424,176 bytes. Previous releases retained; root backup `index-before-gameplay.html`.
Serial staging import workaround retained.
## Office atmosphere release: fd65770c62e811fe
See `docs/OFFICE-ATMOSPHERE.md`: two desks, three chairs, two desk lamps and