90 lines
5.5 KiB
Markdown
90 lines
5.5 KiB
Markdown
# Task 5 — Visual validation and responsive HUD completion
|
||
|
||
## Scope completed
|
||
|
||
Task 5 closes the visual-capture and responsive-HUD issues without changing gameplay, map generation, combat, or input behavior.
|
||
|
||
### Root-cause audit of inherited changes
|
||
|
||
The three pre-existing working-tree edits were retained because they address actual capture-contract causes:
|
||
|
||
1. **Explored-fog validator (`scripts/check-visual-capture.py`)**
|
||
- The old detector required the single RGB value `(19, 29, 39)`.
|
||
- Actual texture-preserving fog is a range of dark blue-shifted pixels: floor texture and GPU blend rounding make a renderer-independent exact RGB assertion invalid.
|
||
- The replacement accepts only a bounded, blue-shifted palette (`R 4–14`, `G 8–22`, `B 17–32`, with channel-separation guards), excluding HUD chrome and unmodulated brown terrain.
|
||
- `tests/scripts/test_godot_import_runners.sh` now emits a representative accepted palette pixel `(9, 14, 23)`, covering the updated contract rather than encoding an obsolete exact renderer sample.
|
||
|
||
2. **Deterministic exit capture (`scripts/game/game.gd`)**
|
||
- `Camera2D` scroll is applied during the frame cycle. Capturing immediately after moving the player to the exit could retain the previous camera framing.
|
||
- The capture now calls `camera.force_update_scroll()` before its frame waits.
|
||
- The entry cell is outside the exit crop, so it could not prove the remembered/explored rendering contract. The deterministic exit state explicitly retains a neighboring exit floor tile as explored while removing it from visible cells.
|
||
- The visual runner then verifies both visible terrain and remembered texture-preserving fog in the actual exit image.
|
||
|
||
### Responsive 1280×720 correction
|
||
|
||
Manual inspection of the original 1280×720 capture showed the three header text rows were too tightly stacked: the dynamic header values intruded into the lower edge of the top bar and were visibly clipped/overlapped by the header ornament. The underlying issue was that the rectangles scaled to 2/3 but all label font overrides remained at their desktop sizes; also, the `ResponsiveLayout` chrome painted after the direct HUD labels.
|
||
|
||
The repair:
|
||
|
||
- places the decorative `ResponsiveLayout` chrome behind direct live HUD values via `z_index = -1` in `Game.tscn`;
|
||
- scales the HUD’s text overrides with the existing artboard scale (bounded by the same 0.66 compact minimum);
|
||
- moves the dynamic header value baseline from reference y=78 to y=75, giving the 1280 layout sufficient top-bar height;
|
||
- adds `test_compact_1280_layout_scales_header_text_and_keeps_it_inside_the_top_bar`, which asserts the compact 11px header font, top-bar containment, and adequate label height.
|
||
|
||
No gameplay logic changed.
|
||
|
||
## Manual capture inspection
|
||
|
||
### 1920×1080
|
||
|
||
- Captured the initial state and deterministic exit state.
|
||
- The full shell is legible and the live header text remains clear of the ornament; no material clipping or overlap observed.
|
||
- The rails, command band, and centered map frame are distinct. The header deliberately uses three compact rows, but they have visible separation at this resolution.
|
||
- The exit capture shows visible terrain, unknown fog, and a dark blue remembered-terrain patch as required by the visual contract.
|
||
|
||
### 1280×720
|
||
|
||
- Before the repair, the header text was visibly crowded and partly clipped/overdrawn at the lower header edge; command/rail texts were correspondingly cramped.
|
||
- After the repair, header rows are contained in the top bar and no longer overdraw the ornament. Rail and command text are smaller but readable for a compact 720p presentation.
|
||
- The visual density remains necessarily high because this is the complete 1920×1080 artboard at two-thirds scale; however, no material header clipping/overlap remains.
|
||
|
||
Temporary comparison captures were removed after inspection; no capture PNG, `.import`, or other artifact is included in the commit.
|
||
|
||
## Cleanup
|
||
|
||
- Terminated the lingering `godot4 --headless --script res://tests/tmp_inspect_hud.gd` process.
|
||
- Removed `tests/tmp_inspect_hud.gd` and its UID if present.
|
||
- Removed the one-off HUD diagnostic script after use.
|
||
- Emptied generated `artifacts/` before commit. Existing Godot-generated `.import` files remain ignored and untracked.
|
||
|
||
## Verification
|
||
|
||
All commands completed successfully:
|
||
|
||
| Command | Result |
|
||
| --- | --- |
|
||
| `./scripts/test-unit.sh` | **221 / 221** tests passed, **34,509** assertions |
|
||
| `./scripts/run-visual-check.sh` | Passed initial + exit capture measurements |
|
||
| `./tests/scripts/test_godot_import_runners.sh` | Passed |
|
||
| `./scripts/verify.sh` | Passed unit, integration, E2E, visual, and strict parity gates |
|
||
|
||
`./scripts/verify.sh` results:
|
||
|
||
| Suite | Passing | Tests | Assertions |
|
||
| --- | ---: | ---: | ---: |
|
||
| Unit | 221 | 221 | 34,509 |
|
||
| Integration | 19 | 19 | 1,696,729 |
|
||
| E2E | 78 | 78 | 676 |
|
||
|
||
Visual measurements reported by the final verifier:
|
||
|
||
- `visual-check.png`: `dungeon_non_black_pixels=1102464`, `visible_pixels=82944`, `explored_pixels=18965`, `explored_luminance=0.004`, `unknown_pixels=890112`, `unknown_luminance=0.001`.
|
||
- `visual-check-exit.png`: `dungeon_non_black_pixels=1102464`, `visible_pixels=10368`, `explored_pixels=18965`, `explored_luminance=0.004`, `unknown_pixels=976128`, `unknown_luminance=0.001`.
|
||
- Strict parity: `matrix gate passed (rows=43 invalid=0)`.
|
||
|
||
Godot emitted pre-existing GUT invalid-UID and resource-cleanup warnings; none were script/parse/test failures, and all verifier commands exited 0.
|
||
|
||
## Git
|
||
|
||
The Task 5 implementation, regression coverage, and this report are committed locally. No push was performed.
|