Files
zombie-fps/docs/GAMEPLAY-IMPROVEMENTS.md
T

3.3 KiB
Raw Blame History

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.