From f2b493abc0f941a5a21e5129c93ecec5fe3ebc26 Mon Sep 17 00:00:00 2001 From: dandovlatov Date: Tue, 24 Nov 2026 01:09:09 +0400 Subject: [PATCH] FBC: NIGHT SHIFT - reviewed the level design: floor route, Projector ritual skill, clearance gates and side-room rewards --- README.md | 12 +- docs/GAME_DESIGN_PASS.md | 20 ++ docs/LEVEL_DESIGN_REVIEW.md | 365 ++++++++++++++++++++++++++++++++++++ docs/MAP_FLOW.md | 29 ++- docs/ROADMAP.md | 2 +- src/game/floor.cpp | 43 ++++- src/game/floor.hpp | 14 ++ src/game/game.cpp | 71 +++++++ src/game/game.hpp | 6 + src/game/ritual.cpp | 36 +++- src/game/ritual.hpp | 21 ++- src/game/weapons.cpp | 4 + src/game/weapons.hpp | 4 +- src/render/presenter.cpp | 58 +++++- src/render/ui.cpp | 27 ++- 15 files changed, 678 insertions(+), 34 deletions(-) create mode 100644 docs/LEVEL_DESIGN_REVIEW.md diff --git a/README.md b/README.md index d60e616..45e69ef 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ enemy. See `docs/GAME_DESIGN.md`. Pre-alpha vertical slice (M0–M2 plus the M3–M5 art/systems kickoff): move/dash + autoshoot, 4 Objects of Power (levels + Altered Forms, enable/disable), level-ups that roll offers as real-time HUD entries per GAME_DESIGN.md §2.2 (no picking — -the run is never paused), 3 enemy archetypes, corruption clock, +the run is never paused), 4 enemy archetypes, corruption clock, death screen. OoP rituals, scene-wide buffs/debuffs and world objects are in and wired into the HUD. The look is a brutalist 3D diorama with **sculpted low-poly Blender actors** (no 2D standees or box kits). The player is a dedicated @@ -38,7 +38,10 @@ Office Suite (full S16 GLB office kit, right of Silos) → Silos → Threshold Stairwell, plus four side rooms — with real wall collision, room-local spawning, a Threshold Key in the Silos and a floor jump through the stairwell. Shared layout/collision lives in `src/game/floor.{hpp,cpp}`; the old 260 m arena is kept -as the non-floor fallback. +as the non-floor fallback. The Projector ritual now claims a permanent OoP skill, +and Clearance 01 gates the three side-room doors until that stamp is earned +(each side room pays a one-time reward). Details and outstanding gaps are in +`docs/LEVEL_DESIGN_REVIEW.md`. ## Build & run @@ -88,9 +91,10 @@ raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compi - `src/game/floor.{hpp,cpp}` — playable Floor 01 room/wall/prop data, collision and spawn helpers - `docs/ART_DIRECTION.md` — the 3D-env + low-poly-actor diorama look, UI, audio - `docs/TECHNICAL.md` — stack, architecture, module map -- `docs/ROADMAP.md` — milestones M0–M6 and current status +- `docs/LEVEL_DESIGN_REVIEW.md` — 2D map vs. client audit, findings and fix status +- `docs/ROADMAP.md` — milestones M0–M7 and current status - `docs/concept/` — rendered Blender concept frames (visual target for M5) -- `docs/ENV_ENHANCEMENT.md` — enhancement slices S0–S15 for the environment/actors +- `docs/ENV_ENHANCEMENT.md` — enhancement slices S0–S17 for the environment/actors - `ConcreteMaterial.blend` + `tools/blender/bake_cgtrader_concrete.py` and `process_concrete_maps.py` — CGTrader concrete source and the reproducible 2K bake/post-process used by floor/walls/pillars diff --git a/docs/GAME_DESIGN_PASS.md b/docs/GAME_DESIGN_PASS.md index 142582b..79196c2 100644 --- a/docs/GAME_DESIGN_PASS.md +++ b/docs/GAME_DESIGN_PASS.md @@ -29,3 +29,23 @@ 5. Enforce caps and stacking. 6. Add audio + fonts. 7. Add automated smoke tests. + +## Status update (2026-11-24) + +The "What lacks" list above is a historical snapshot. Current state: + +- **Done since the pass:** XP offers now award weapon levels, Directives and + passives (`game.cpp`); evolutions have real behavior changes; Floor 01 is a + playable 160 x 120 m blockout with room collision, side rooms, a key in the + Silos and a threshold door in the stairwell; player build stats (regen, + armor, passives) exist; audio/fonts are still outstanding. +- **Done in the level-design follow-up:** the Projector is now a ritual that + grants a permanent OoP skill (`WeaponType::Projector`); a completed ritual + can be replaced by another one and each ritual is claimable once per run; + the three side-room doors are clearance-gated and each side room has a + one-time reward; the blocked Projector -> Office route is open. +- **Still open:** 6 of 7 floors, Oceanview Motel, 7 bosses, 5 enemy archetypes, + elite affixes, `spawn_rate_mult`, audio, bundled OFL fonts, balance telemetry. + +See `docs/LEVEL_DESIGN_REVIEW.md` for the full audit and `docs/MAP_FLOW.md` +for the current floor-flow status. diff --git a/docs/LEVEL_DESIGN_REVIEW.md b/docs/LEVEL_DESIGN_REVIEW.md new file mode 100644 index 0000000..c98bd43 --- /dev/null +++ b/docs/LEVEL_DESIGN_REVIEW.md @@ -0,0 +1,365 @@ +# FBC: NIGHT SHIFT — Level Design Review: 2D Map vs. Game Client + +**Date:** 2026-11-24 +**Scope:** Floor 01 blockout, whole-house flow map, level-related design docs, and the runtime assets they depend on. +**Method:** Static cross-review of the authored 2D plans (`docs/maps/*.svg`), the level data and systems in `src/`, the design docs in `docs/`, and a literal code-path ↔ filesystem asset audit. Every numeric claim below was checked against source; no files were modified by the review. + +--- + +## 1. Executive summary + +**Verdict:** The Floor 01 *geometry* is in excellent sync with its 2D plan — all 10 room bounds, all dimensions, and most of the intended route match to the metre. The problems are not in the room table; they are in **connectivity, authored content, and scope**. The single most important finding is that **the designed route step 3 → 4 (Projector Room → Office Suite) is physically blocked in the client by an unbroken wall**, even though the map draws an arrow there and the client draws a corridor slab. Beyond that, the client implements **one of seven promised floors**, **two buff-only rituals where the map promises a Projector OoP that grants a skill**, and **no bosses, no motel shop, no clearance gating, and no cross-room pathfinding**. + +| Area | Health | Notes | +|---|---|---| +| Room bounds & dimensions (map ↔ client) | ✅ Pass | 10/10 rooms exact match, including side rooms | +| Intended route connectivity | ❌ Fail | 1 of 5 route legs blocked; 2 dead-end stubs; 3 passable links lack floor slabs | +| Walls / collision data | ⚠️ Partial | 67 wall rects; key and hazard door are non-colliding | +| OoP / ritual placement | ❌ Fail | Projector ritual absent; ritual anchors in Plaza, not Offices or Projector | +| 7-floor run flow | ❌ Fail | 1 floor implemented, reused 6× with a corruption bump | +| Enemy / boss roster | ❌ Fail | 4 types (1 undocumented) of 8+ promised; 0 of 7 bosses | +| Asset references (broken links) | ✅ Pass | 0 missing files across 40 referenced paths | +| Asset completeness | ⚠️ Partial | 9 orphan assets; audio/env/fonts dirs empty despite doc promises | +| Doc consistency | ❌ Fail | 4-vs-7 floors, camera values, arena size, stale status docs | + +**Finding count:** 2 Critical, 6 High, 7 Medium, 3 Low (18 total). + +### 1.1 Implementation status (2026-11-24) + +The findings above are the audit baseline. Fixes have since landed in four phases: + +| Phase | Findings | Status | Evidence | +|---|---|---|---| +| 1 — Connectivity | C-01, M-01 | **Fixed** | `floor.cpp`: Projector north gap `{{116,132}}`, 3 corridor slabs added, south stub sealed; BFS verifies all 8 route links | +| 2 — OoP skill | C-02, M-02, L-01 | **Fixed** | `ritual.*`: `RitualType::Projector` at world (49,−2), 20 s briefing reel, claimable once, replaceable; `weapons.*`: `WeaponType::Projector`; `game.cpp`: ritual completion grants the skill; `presenter.cpp`/`ui.cpp`: anchor, marker and strings | +| 3 — Clearance & side rooms | H-04, L-03 | **Fixed** | `floor.*`: 3 gated door walls + `DoorId`; `game.*`: `clearance`, side-room rewards, reset/floor-jump handling; `presenter.cpp`: locked/open door visuals and A–D labels; `ui.cpp`: real clearance stamp + reward banner | +| 4 — Doc hygiene | M-07, L-02 | **Fixed** | `README.md`, `ROADMAP.md`, `MAP_FLOW.md` and `GAME_DESIGN_PASS.md` reconciled | + +**Still open (out of scope for these phases):** H-01/H-02 (floors L2–L7, bosses, motel, finale), H-03 (enemy roster/affixes), H-05 (cross-room pathfinding), H-06 (physical key/door interaction), M-03 (legacy 260 m anchors), M-04 (unused prop kinds), M-05/M-06 (audio, fonts, orphan assets), M-02's doc claim about art for other OoPs. + +Verification performed: `cmake --build build -j6` clean; standalone C++ harnesses for the ritual state machine and clearance/side-room flow pass; `--floor-overview` screenshots confirm the new corridor, projector marker, locked doors and HUD stamp. + +--- + +## 2. Sources reviewed + +| Source | Role | +|---|---| +| `docs/maps/floor_01_security.svg` / `.png` | Authored 2D tactical floor plan (Rev 02), 6 px/m, 160 × 120 m | +| `docs/maps/oldest_house_flow.svg` / `.png` | Authored 7-floor vertical flow map | +| `docs/MAP_FLOW.md` | Floor 01 detailed design + 7-floor ladder + status | +| `docs/GAME_DESIGN.md`, `docs/GAME_DESIGN_PASS.md`, `docs/RPG_LITE.md` | Systems / OoP / enemy design | +| `docs/ROADMAP.md`, `docs/ENV_ENHANCEMENT.md`, `docs/ART_DIRECTION.md`, `docs/TECHNICAL.md`, `README.md` | Milestone, art, and presentation intent | +| `src/game/floor.{hpp,cpp}` | Authoritative client level data (rooms, walls, corridors, props, spawn helpers) | +| `src/game/game.{hpp,cpp}`, `corruption.*`, `ritual.*`, `enemies.*`, `director.*`, `weapons.*`, `buffs.*` | Runtime level/progression logic | +| `src/render/presenter.cpp`, `dressing.cpp`, `models.*`, `concrete.*`, `layout.hpp` | Level visualization and asset loading | +| `assets/**`, `src/main.cpp`, `src/render/ui_font.cpp` | Asset inventory and load paths | + +Coordinate convention: the plan is 160 × 120 m with **+y up**; the world is plan-centred with `to_world(x,y) = (x−80, 60−y)` (`src/game/floor.hpp:53-58`). SVG pixel space is y-down, so `map_x = (px−40)/6`, `map_y = (810−py)/6`. Both conversions were used to verify the SVG against the code. + +--- + +## 3. What we have in the 2D map + +### 3.1 Floor 01 tactical plan (`floor_01_security.svg`, Rev 02) + +Floor plate **160 × 120 m at 6 px/m**; grid 10 m. Room schedule (SVG lines 117–126): + +| # | Room | Size (m) | Role (per legend / MAP_FLOW §3) | +|---|---|---|---| +| 1 | Security Gate / Checkpoint | 48 × 26 | Spawn, turnstiles, guard desk, Clearance 01 barrier, first radio line, no combat initially | +| 2 | Central Plaza | 94 × 42 | Hub: red carpet cross, pillar grid, TV / Hotline / Duck / Pedestal OoPs, debris, Hiss spill; first horde arena | +| 3 | Projector Room / Briefing | 26 × 42 | Hiss briefing reel; **Projector OoP ritual → run skill**; seating rows | +| 4 | Office Suite | 76 × 36 | Repurposed S16 open-plan GLB kit (desks, computers, chairs, partitions, meeting table, sofas, lamps, plants, cabinets, crates) on a teal island | +| 5 | Silos | 52 × 36 | Storage vaults / world objects; **Threshold Key vault**; some guarded by a Hiss Brute | +| 6 | Threshold Stairwell | 26 × 6 | Red hazard door above Silos; key consumed; floor jump → motel → L2 | +| A | Records Archive | 14 × 34 | Side: records / lore / key chance | +| B | Locker Room | 16 × 32 | Side: shard greed | +| C | Janitor Closet | 40 × 18 | Side: Ahti chore flavour | +| D | Security Booth | 46 × 26 | Side: world-object cache | + +**Intended route** is explicitly drawn and labelled: **1 → 2 → 3 → 4 → 5 → 6** (SVG arrows at lines 78–82; legend at 127–131). The design notes add: +- Gate has three exits but only one is **lit**; others open with clearance/keys (`MAP_FLOW.md:90-91`). +- Plaza is the hub: north to Silos and Office Suite, east to Projector, side to Locker (`MAP_FLOW.md:92-93`). +- Office ↔ Silos is a short east-west corridor, an exposed 4 → 5 crossing (`MAP_FLOW.md:94-95`). +- Key in Silos vault; stairwell door stays shut until taken (`MAP_FLOW.md:96-97`, SVG line 131). + +The SVG's colour legend marks the Projector room yellow as **"OoP RITUAL / KEY"** and the status box reads **"RITUAL: PROJECTOR — PENDING"** (SVG lines 111, 135). + +### 3.2 Whole-house flow map (`oldest_house_flow.svg`) + +A vertical clearance ladder, 7 floors, one continuous corruption clock, with an Oceanview Motel reroll stop between each floor and a finale line. Per-floor promises (SVG lines 65–134; `MAP_FLOW.md:34-42`): + +| Floor | Identity | Rooms / identity | OoP ritual | Key from | Boss / gate | +|---|---|---|---|---|---| +| L1 | Security & Administration | Gate, Offices, Projector, Silos | **Projector** | Silos vault | none (teach loop) | +| L2 | Maintenance | Boiler hall, service corridors, mold pits | Light Switch | Boiler elite | Mold-1 (optional) | +| L3 | Research | Open labs, meeting suites, X-Ray bay, TV stage | Benicoff TV + X-Ray Lightbox | TV quest | Hiss Elevated pack | +| L4 | Communications | Switchboard, broadcast hall, Jukebox lounge | Hotline + Jukebox | switchboard room | esseJ (mirror) | +| L5 | Containment / Panopticon | Cell block, Panopticon core, Silo Annex | Floppy Disk + Launch | guard elite | The Former | +| L6 | Astral / Threshold | Sliding thresholds, Hotline pier, Board antechamber | Polaris / Board Favor | Board trial | Hiss-Choice | +| L7 | Executive | Reception, Director's office, Board chamber | Charge / Board's light | final key | Hiss-Marshall → **Jesse arrives** | + +The design grammar repeats on every floor: `GATE → MAIN ROOMS → SIDE ROOMS → THRESHOLD KEY → THRESHOLD DOOR → MOTEL → next gate` (`MAP_FLOW.md:17-25`, SVG line 143). + +### 3.3 Broader design promises relevant to levels + +- **Mega Man reward:** completing a ritual makes the OoP a permanent run skill (`GAME_DESIGN.md:53-55`; README:10-11). +- **OoP roster of 10** (`GAME_DESIGN.md:179-190`): Spin, Shatter, Charge, Rubber Duck, Floppy Disk, Benicoff TV, Hotline, Launch, Jukebox, X-Ray Lightbox. +- **Enemy roster** (`GAME_DESIGN.md:285-305`): Hiss Corrupted Staff, Hiss Elevated, Hiss Cluster, Mold Spore, Mold Host, Threshold Creature, Taken, Hiss Brute; elite affixes Resonant/Phasing/Volatile/Shielded/Mending; bosses esseJ, the Former, Mold-1, Hiss-Marshall. +- **Art slices** (`ENV_ENHANCEMENT.md`): S0–S17; S4 "breadth: floors" (Oceanview Motel, Maintenance variant) is still *planned*; S5 is *partial*, pending fonts; audio and OFL fonts promised in `ART_DIRECTION.md:81-92`. + +--- + +## 4. What we have in the actual game client + +### 4.1 Floor data (`src/game/floor.cpp:33-125`) — authoritative layout + +All 10 rooms are hardcoded; dimensions match the SVG exactly. World bounds are derived by `rect_from_map()` (`floor.cpp:13-17`). + +| Map bounds (x0,y0,x1,y1) | Room | Kind | flow label | +|---|---|---|---| +| (56,0,104,26) | SECURITY GATE | Gate | 1 | +| (18,30,112,72) | CENTRAL PLAZA | Plaza | 2 | +| (116,30,142,72) | PROJECTOR ROOM | Projector | 3 | +| (70,76,146,112) | OFFICE SUITE | OfficeSuite | 4 | +| (14,76,66,112) | SILOS | Silos | 5 | +| (16,114,42,120) | THRESHOLD STAIRWELL | Stairwell | 6 | +| (146,34,160,68) | RECORDS ARCHIVE | Side | 0 | +| (0,36,16,68) | LOCKER ROOM | Side | 0 | +| (6,4,46,22) | JANITOR CLOSET | Side | 0 | +| (110,0,156,26) | SECURITY BOOTH | Side | 0 | + +**Walls** (`floor.cpp:57-93`): 67 rectangles, interior 3.2 m high, outer shell 4.2 m, six plaza pillars 4.0 m. Gaps are doors. Notable gaps/seals, in map coordinates: + +| Room | bottom y0 | top y1 | left x0 | right x1 | +|---|---|---|---|---| +| Gate | x 76–84 | x 72–88 | y 14–18 | y 14–18 | +| Plaza | x 72–88 | x 34–50, x 76–100 | y 46–54 | y 44–56 | +| Projector | x 116–132 | **sealed** | y 44–56 | y 46–54 | +| Office Suite | x 76–100, x 116–132 | **sealed** | y 92–104 | **sealed** | +| Silos | x 34–50 | x 24–36 | **sealed** | y 92–104 | +| Stairwell | x 24–36 | sealed | sealed | sealed | +| Archive / Locker / Janitor / Booth | — | — | one gap each | one gap each | + +**Corridors** (visual floor slabs, `floor.cpp:46-55`): 8 — Gate↔Plaza, Plaza↔Projector, Plaza↔Silos, Plaza↔Office, Silos↔Office, Office↔Projector, Projector↔Archive, Silos↔Stairwell. + +**Props** (`floor.cpp:108-125`): 6 turnstiles, 6 pillars, 1 screen + 4 seats (Projector), 6 silos, 11 shelves (side rooms), 1 hazard door, 1 key. `PropKind::Desk` and `PropKind::MeetingTable` exist in the enum but are never placed. Only pillars participate in collision; all other props and both the key and hazard door are visual only. + +**Spawns:** player at `to_world(80,13)` = world `(0,47)` inside the Gate (`floor.hpp:60`). Enemies use `Floor::spawn_near()` (`floor.cpp:186-207`), constrained to **the player's current room** (32 polar tries at 22–34 m, then 24 in-room tries, then a resolve fallback). No fixed enemy spawn points or "enemy rooms". + +**Key → door → floor jump** (`game.cpp:206-230`): key at map (55,106) = world (−25,−46) in Silos, picked up at radius 3.0. Door trigger at map (29,117) = world (−51,−57) in the Stairwell, radius 4.0, requiring `has_key` + Stairwell room. On success: `corruption.floor_cleared()` (+0.35 corruption), `++floor_number`, `++floor_clears`, clear enemies/pickups/buffs/rituals, respawn at Gate. **The geometry never changes.** + +**Rituals** (`ritual.hpp:27-40`): only `TV` at world (13,17) → map (93,43) and `Lightswitch` at world (0,−8) → map (80,68). Both positions are **inside Central Plaza**. Completion applies a timed buff (`TV LIVE` damage taken ×0.9 for 600 s; `FLUORESCENT LIGHT` damage taken ×1.25 for 12 s), never a weapon/skill. The presenter draws only these two OoP models and carries the comment *"Ritual anchors still live in the Offices on this floor"* (`presenter.cpp:601-608`) — factually wrong per the constants above. + +### 4.2 Implemented systems (level-adjacent) + +- Floor 01 is the default playable layout; `Presenter::init()` always sets `floor_mode_ = true` (`presenter.cpp:224-225`). +- Floor-aware dressing scatters document stacks, loose sheets and garbage cans in the Office Suite and Plaza, destroyed by area blasts (`dressing.cpp:21-73`). +- Corruption clock with 9 tiers, Director spawn economy, real-time level-up offers, 4 weapons with simplified evolutions, 9 world-object buffs, scene-wide buff/debuff system — all implemented. +- 4 enemy types: HissStaff, MoldSpore, HissBrute, HissGhost (`enemies.hpp:10`). HissGhost is undocumented in the design docs. +- No bosses, no motel, no clearance gating, no win/finale state (`GameState` = Title/Playing/GameOver only). + +### 4.3 Assets actually loaded + +Every one of the **40 distinct asset paths** referenced in `src/` exists on disk: 25 GLBs, 9 shaders, `glow.png`, `actor_ramp.png`, 3 concrete maps, `gamecontrollerdb.txt`. No broken links. All 25 `ActorModel` enum values resolve to a GLB. + +--- + +## 5. Cross-comparison results + +### 5.1 Map ↔ client room bounds: full match ✅ + +All 10 SVG rectangles convert to exactly the code's `rect_from_map(...)` arguments. Room sizes in `MAP_FLOW.md` §3 match the SVG schedule and `floor.cpp`. This is the strongest part of the level work: the plan, doc and code genuinely share the same room table. + +### 5.2 Intended route connectivity: broken ❌ + +Walking the designed route against the actual wall gaps: + +| Leg | Intended (SVG arrow) | Client reality | +|---|---|---| +| 1 → 2 Gate → Plaza | px (520,774)→(520,594), map x≈80 | ✅ Gate top gap x72–88, corridor (72,26,88,30), Plaza bottom gap x72–88 | +| 2 → 3 Plaza → Projector | px (640,510)→(796,510), map y≈50 | ✅ Plaza right gap y44–56, corridor, Projector left gap y44–56 | +| **3 → 4 Projector → Office** | px (796,414)→(796,330), map x≈126 | ❌ **Blocked.** Corridor slab (116,72,132,76) exists and Office bottom gap x116–132 exists, but the **Projector top wall is sealed** (`floor.cpp:81`) | +| 4 → 5 Office → Silos | px (700,246)→(448,246), map y≈94 | ✅ Office left gap y92–104, corridor (66,92,70,104), Silos right gap y92–104 | +| 5 → 6 Silos → Stairwell | px (220,162)→(214,120), map x≈29–30 | ✅ Silos top gap x24–36, corridor (24,112,36,114), Stairwell bottom gap x24–36 | + +Additional connectivity defects: +- **Projector bottom gap (x116–132 at y30) is a dead-end stub.** It opens into the strip above the Security Booth, whose top wall is sealed; the Plaza right wall is solid at that height. +- **The Office↔Projector corridor is a one-sided stub**: the Office end opens, the Projector end does not. +- **Three passable links have no corridor floor slab** in `corridors_`: Gate↔Booth (map x104–110), Gate↔Janitor (x46–56), Plaza↔Locker (x16–18). They are walkable over bare floor, so they read as unfinished. +- **The Gate's "only one lit exit" rule is absent**: all four Gate gaps are open from the start. No clearance or key gating exists (`MAP_FLOW.md:90-91` vs `floor.cpp:78`). +- **Key and hazard door are non-colliding** (`floor.cpp:105-125`); the stairwell is completed by a proximity trigger, not by a door that physically opens. + +### 5.3 OoP / ritual placement conflicts ❌ + +| Expectation | Source | Client reality | +|---|---|---| +| Projector ritual grants the Projector skill; L1's signature beat | SVG legend/status, `MAP_FLOW.md:36,71-73,100-102` | No Projector ritual exists; `RitualType` is only `{TV, Lightswitch}` (`ritual.hpp:27`) | +| TV / Hotline / Duck / Pedestal OoPs are in the Plaza | `MAP_FLOW.md:68-69`, SVG circles + legend | Only `TV` model is drawn, as a ritual anchor; Hotline/Duck/Pedestal GLBs are loaded but never placed in the level | +| Ritual anchors "live in the Offices" | `presenter.cpp:601` comment | Both anchors compute to map (93,43) and (80,68), inside the Plaza (`ritual.hpp:30,34`) | +| Ritual completion grants a permanent skill | `GAME_DESIGN.md:53-55`, README:10-11 | Grants a timed buff only (`ritual.cpp:30-43,60-66`); `GAME_DESIGN_PASS.md:15` confirms | +| Of 10 promised OoPs, all are obtainable | `GAME_DESIGN.md:179-190` | Only 4 weapons exist (Spin, Shatter, Charge, Launch); Rubber Duck/TV/Hotline are art-only, Floppy Disk/Jukebox/X-Ray have no art or code | + +### 5.4 Whole-flow scope gap ❌ + +The client ships **exactly one 160 × 120 m floor**. `Game::floor_pass()` increments `floor_number` and corruption but reuses the same `Floor` object and respawns at the same Gate (`game.cpp:218-229`; `MAP_FLOW.md:117-120` documents this as an M3 prototype). Consequently L2–L7 rooms, 7 bosses, the Oceanview Motel, the finale, diegetic clearance gating, and the Jesse arrival have **no implementation**. `MAP_FLOW.md:126-128` itself lists these as "still to do", along with enemy pathfinding outside the player's room. + +### 5.5 Asset audit ⚠️ + +**No missing assets.** Orphans and gaps: + +| Asset | Status | +|---|---| +| `assets/models/guard.glb` | Unused — `ActorModel::Guard` loads `agent.glb` (`models.cpp:271`); no path references `guard.glb` | +| `assets/sprites/glyph_a.png`, `glyph_b.png`, `glyph_c.png`, `guard.png`, `hiss_brute.png`, `hiss_staff.png`, `mold_spore.png`, `shard.png` | Unused — S6 retired standees; only `glow.png` is loaded (`presenter.cpp:31`) | +| `assets/blender/*.blend*` (17 files) + root `ConcreteMaterial.blend` | Authoring sources only; correct to be unreferenced at runtime | +| `assets/audio/` | Empty (`.gitkeep`) — no `LoadSound`/`PlaySound` anywhere; drone, chanting, radio, impacts all absent (`ART_DIRECTION.md:87-92`) | +| `assets/fonts/` | Empty — runtime uses absolute system TTFs (`ui_font.cpp:16-23`); promised Archivo / IBM Plex Mono not bundled | +| `assets/env/` | Empty — environment is procedural by design | +| No bosses, Oceanview, Floppy Disk, Jukebox, X-Ray, Projector models | Promised art absent (`ENV_ENHANCEMENT.md:121-126`, S4 planned) | + +### 5.6 Doc self-consistency ❌ + +- **Floor count:** `GAME_DESIGN.md:307-314` lists 4 floors (Maintenance, Research, Containment, Executive); `MAP_FLOW.md:34-42` lists 7 with different numbering. `MAP_FLOW.md:45-47` acknowledges the reuse but the docs were never reconciled. +- **Camera tuning:** `ART_DIRECTION.md:48-49` and `ENV_ENHANCEMENT.md:314-316` say fov 48 / height 18 / forward 14; `TECHNICAL.md:74-77` and `ENV_ENHANCEMENT.md:440-445` say fov 55 / 16 / 15. Client `camera_tuning.hpp:6-8` uses 55 / 16 / 15. +- **Arena size:** README simultaneously claims a 260 × 260 m floor (line 30) and the 160 × 120 m Floor 01 as default (lines 34-41). Both coordinate systems remain live: `GameConfig::arena_half = 130` (`game.hpp:31`) vs `Floor::kWidth/kHeight` (`floor.hpp:51-52`); the presenter's concrete/strips still use the 260 m values (`presenter.cpp:623,761-775`). +- **Stale status docs:** `GAME_DESIGN_PASS.md` still claims no run structure, no weapon awards, no player stats, data-only evolutions — all now false. ROADMAP M3–M7 status cells are blank although Floor 01 is shipped. README says M0–M6 / S0–S15 / "3 enemy archetypes"; actual docs cover M7 / S17 / 4 enemy types. +- **Ritual replacement:** `GAME_DESIGN.md:60` says a new ritual replaces the active one; the code has no restart path (`ritual.hpp:55-64`). + +--- + +## 6. Findings register + +Severity: **C**ritical (blocks the designed experience), **H**igh (major promised content missing/broken), **M**edium (quality/consistency), **L**ow (polish). + +### C-01 — Intended route leg 3 → 4 is physically blocked +**Evidence:** SVG arrow `M796 414 L796 330` (`floor_01_security.svg:80`); corridor slab `floor.cpp:52`; Office bottom gap `floor.cpp:82`; **Projector top wall sealed** `floor.cpp:81`. +**Impact:** A player following the documented route must backtrack through the Plaza to reach the Office Suite; the "short crossing" design intent fails. +**Fix:** Add gap `{{116,132}}` to the Projector top wall in `room_walls(116,30,142,72, …)` at `floor.cpp:81`. Re-verify with `--floor-overview` and a walkthrough from Projector to Office. + +### C-02 — Ritual rewards do not grant skills; Projector ritual missing +**Evidence:** `ritual.hpp:27`, `ritual.cpp:30-43,60-66`, `presenter.cpp:601-608`; `MAP_FLOW.md:100-102`; SVG status line 135. +**Impact:** The game's "signature mechanic" (README:10-11) and L1's defining beat are absent. Rituals are buffs only. +**Fix:** Add a Projector ritual type with a room anchor in the Projector Room, and wire ritual completion into `weapons_` grant/upgrade so the OoP becomes a permanent run skill. + +### H-01 — Only 1 of 7 floors exists; floor jumps reuse the same geometry +**Evidence:** `floor.hpp:44-52`, `game.cpp:218-229`, `MAP_FLOW.md:117-128`, `oldest_house_flow.svg:65-134`. +**Impact:** No distinct Maintenance/Research/Communications/Containment/Astral/Executive spaces, no bosses, no motel, no finale. +**Fix:** Introduce a floor template table keyed by `floor_number` and swap room/wall/prop sets on `floor_cleared()`; at minimum, re-theme and re-layout L2 before adding more. + +### H-02 — 7 bosses, Oceanview Motel, and the Jesse-arrival ending have no code +**Evidence:** `game.hpp:19` (no win state), `enemies.hpp:10` (no boss), `models.cpp:197` aspirational comment, `MAP_FLOW.md:126`, `oldest_house_flow.svg:43-61,138-139`. +**Impact:** The run has no climax or between-floor decision point. +**Fix:** Schedule bosses and the motel reroll as a dedicated milestone; stub a `GameState::Victory` and a motel state first. + +### H-03 — Enemy roster gaps and undocumented enemy +**Evidence:** `GAME_DESIGN.md:285-305` vs `enemies.hpp:10`, `enemies.cpp:19-22`, `director.cpp:10-13`. HissGhost exists in code but in no doc; Hiss Elevated, Hiss Cluster, Mold Host, Threshold Creature, Taken-as-enemy, all 5 elite affixes and all 4 bosses are missing. +**Impact:** Combat variety and difficulty scaling fall far short of the design. +**Fix:** Update the docs to match the shipped roster, then prioritize Hiss Elevated and one elite affix; remove or document `guard.glb`. + +### H-04 — Gate clearance gating and side-room payoff absent +**Evidence:** `MAP_FLOW.md:48-51,90-91,85-87` vs `floor.cpp:78,118-123`. +**Impact:** The "one lit exit / greed vs. clock" decisions do not exist; side rooms are empty shelving with no key, loot, or lore logic. +**Fix:** Gate the Gate↔Booth/Janitor and Plaza↔Locker openings behind clearance/keys; attach a shard cache, lore pickup, or key chance to each side room. + +### H-05 — Enemy spawns are room-local; no cross-room pathfinding +**Evidence:** `floor.cpp:186-207`, `MAP_FLOW.md:126-128`, `enemies.cpp:68-69`. +**Impact:** Hordes cannot funnel through the designed corridors and doorways; the arena connections are decorative for AI. +**Fix:** Add a nav graph over `rooms_`/`corridors_` wall gaps and allow spawns in adjacent rooms once pathfinding exists. + +### H-06 — Key and hazard door are non-colliding; door is a proximity trigger +**Evidence:** `floor.cpp:105-125`, `game.cpp:213-216`, `presenter.cpp:610-619`. +**Impact:** The threshold door reads as set dressing rather than a locked exit; the key has no physical interaction. +**Fix:** Make the stairwell door a real collision barrier removed on key possession, and give the key a pickup animation/inspect beat. + +### M-01 — Dead-end stubs and missing corridor slabs +**Evidence:** `floor.cpp:52` (one-sided Office↔Projector corridor); `floor.cpp:81` (Projector bottom gap dead end); `corridors_` omits Gate↔Booth, Gate↔Janitor, Plaza↔Locker (`floor.cpp:46-55`). +**Impact:** Bare-floor passages and visual dead ends read as unfinished. +**Fix:** After C-01, either seal the Projector bottom gap or connect it; add the three missing 4 m corridor slabs. + +### M-02 — Ritual anchor placement/comment wrong and inconsistent with map +**Evidence:** `ritual.hpp:30,34` → map (93,43)/(80,68) in Plaza; `presenter.cpp:601` says Offices; SVG marks Projector as the ritual room. +**Impact:** Misleading comment and a map/level mismatch that obscures where OoPs actually are. +**Fix:** Move anchors to match the final OoP layout (C-02) and delete/correct the comment. + +### M-03 — Legacy 260 m arena coexists with the 160 × 120 m floor +**Evidence:** `game.hpp:31` (`arena_half=130`), `layout.hpp:3-55`, `presenter.cpp:623,761-775`, README:30-41. +**Impact:** Two live coordinate systems; `--room-test` shows a room not on the playable floor; extra geometry under the floor. +**Fix:** Retire the fallback paths or scope them explicitly behind a non-floor dev flag. + +### M-04 — PropKind Desk / MeetingTable unused in floor data +**Evidence:** `floor.hpp:34` defines them; presenter cases `presenter.cpp:549-557`; no `add(...)` call in `floor.cpp`. +**Impact:** Dead rendering code; offices rely on dressing instead of authored prop data. +**Fix:** Either place them in the Office Suite via `floor.cpp` or remove the cases. + +### M-05 — Audio, fonts, and env asset directories are empty +**Evidence:** `assets/audio|fonts|env/.gitkeep`; `ART_DIRECTION.md:81-92`; `ENV_ENHANCEMENT.md:143-148,544-545`; `ui_font.cpp:16-23`. +**Impact:** No soundscape or intended typography; HUD styling is blocked on fonts. +**Fix:** Bundle the OFL fonts and a minimal SFX set; switch `ui_font.cpp` to project-relative paths. + +### M-06 — Orphan assets +**Evidence:** `guard.glb`, 8 sprite PNGs, `.blend` authoring files (the latter expected). +**Impact:** Repo clutter and false impressions about implement-ability (e.g. standees for missing enemies). +**Fix:** Remove or move to an `assets/legacy/` folder; keep `.blend` sources documented as authoring-only. + +### M-07 — Documentation drift +**Evidence:** §5.6; README stale pointers; GAME_DESIGN_PASS stale claims; ROADMAP blank statuses. +**Impact:** Reviewers and new contributors cannot trust the docs as a spec. +**Fix:** Reconcile floor count, camera values, arena claim, and mark M3 as "partial — Floor 01 prototype". + +### L-01 — Ritual system "replaces active ritual" documented but not implemented +**Evidence:** `GAME_DESIGN.md:60` vs `ritual.hpp:55-64` (single start, no restart path). +**Fix:** Implement restart or revise the doc. + +### L-02 — Map SVG authoring pipeline claim not verifiable from repo alone +**Evidence:** `MAP_FLOW.md:122-124` says the SVG/PNG and Blender blockout are regenerated from the same room table, but no generator script for the SVG is present in `tools/blender/` (the builder there is `build_scene.py`; the only source reference to the SVG is the comment at `src/game/floor.hpp:44`; the SVG itself is hand-authored markup). +**Fix:** Add and document the map generator, or soften the claim to "kept in sync manually" (the current bounds do match). + +### L-03 — Side rooms lack on-screen labels +**Evidence:** `flow = 0` for all side rooms (`floor.cpp:40-43`); `presenter.cpp:1192` skips them. +**Fix:** Give side rooms short labels once they have gameplay payoff (H-04). + +--- + +## 7. Recommended fix order + +1. **Unblock 3 → 4** (C-01) and add the three missing corridor slabs + resolve stubs (M-01). One-line wall change plus a short verification pass. +2. **Make the signature mechanic real** (C-02): Projector ritual in the Projector Room + ritual→skill grant. This aligns the map, the README, and the core loop. +3. **Decide the floor strategy** (H-01/H-02): either commit to distinct L2 geometry or formally relabel the current build as a single-floor vertical slice; update MAP_FLOW/ROADMAP accordingly. +4. **Close the design-vs-client gaps** (H-03–H-06): roster/affixes, gate gating and side-room payoff, enemy pathing, physical door. +5. **Asset/doc hygiene** (M-05–M-07, L-01–L-03): bundle fonts/audio, prune orphans, reconcile docs, generator script. + +**Verification gates for any level change:** `--floor-overview` overhead capture; walk the full 1→2→3→4→5→6 route with collision on; confirm key pickup in Silos and door trigger in Stairwell; re-run the asset-path existence check; build with `cmake --build build -j6`. + +--- + +## 8. Appendix — Reference data + +### 8.1 Code ↔ map coordinate check (worked examples) + +- Security Gate SVG rect `x=376,y=654,w=288,h=156` → map x (376−40)/6=56 … (664−40)/6=104; map y (810−810)/6=0 … (810−654)/6=26 → code `(56,0,104,26)` ✅ +- Office Suite SVG `x=460,y=138,w=456,h=216` → map (70,76,146,112) ✅ +- Stairwell SVG `x=136,y=90,w=156,h=36` → map (16,114,42,120) ✅ +- All 10 rooms verified; full table in §4.1. + +### 8.2 Key world positions + +| Item | Map | World | Source | +|---|---|---|---| +| Player spawn | (80,13) | (0,47) | `floor.hpp:60` | +| Threshold Key | (55,106) | (−25,−46) | `floor.hpp:61`, `floor.cpp:125` | +| Hazard door / trigger | (29,117) | (−51,−57) | `floor.hpp:62`, `game.cpp:216` | +| TV ritual anchor | (93,43) | (13,17) | `ritual.hpp:30` | +| Light Switch ritual anchor | (80,68) | (0,−8) | `ritual.hpp:34` | + +### 8.3 Asset path audit summary + +- Referenced and present: 40/40 unique paths (25 GLB, 9 shaders, 5 images/textures, 1 controller DB + fallbacks). +- Present but unreferenced: `guard.glb` + 8 sprites (+ authoring `.blend` files). +- Promised in docs but absent: audio files, OFL fonts, Oceanview/Maintence variants, boss models, Floppy Disk/Jukebox/X-Ray/Projector models. +- Shader set is complete and fully used (vertex shaders intentionally absent for fragment-only post/bloom passes). + +### 8.4 Review limitations + +This is a static review of source, docs and assets at the current git HEAD. It did not run the game or render `--floor-overview`/`--plaza-test` captures; the connectivity conclusions were derived from the wall-gap data in `floor.cpp` and the arrows in the SVG. A short in-engine walkthrough is recommended to confirm C-01 before changing wall data. diff --git a/docs/MAP_FLOW.md b/docs/MAP_FLOW.md index e6fdb2c..ee55a1e 100644 --- a/docs/MAP_FLOW.md +++ b/docs/MAP_FLOW.md @@ -120,12 +120,31 @@ player respawns at the gate and `floor_number` increments (same layout reused with higher corruption, as an M3 prototype of the 7-floor climb). Run with `--floor-overview` for an overhead capture of the whole floor or `--plaza-test` to start in the central hub scene. The Blender blockout -(`assets/blender/fbc_floor01_blockout.blend`) and the SVG/PNG map are regenerated -from the same room table, so all three stay in sync. +(`assets/blender/fbc_floor01_blockout.blend`) and the SVG/PNG map are derived from +the same room schedule and are kept in sync by hand; there is currently no +generator script that regenerates the SVG from `src/game/floor.cpp`. -Still to do for the full vision: the other six floors, Oceanview shop, OoP -ritual rewards feeding the key/door flow, and proper pathfinding for enemies -that spawn outside the player's room (currently spawns are room-local). +Still to do for the full vision: the other six floors, Oceanview shop, and +proper pathfinding for enemies that spawn outside the player's room (currently +spawns are room-local). + +**Level-design follow-up (2026-11-24).** The route and progression gaps found +in `docs/LEVEL_DESIGN_REVIEW.md` are now closed for Floor 01: + +- The intended 3 -> 4 route is open: the Projector's north wall now has the + x116-132 gap that aligns with the existing corridor and the Office Suite's + south opening. The old dead-end stub at the Projector's south wall is sealed, + and the three walkable links that had no slab (Gate -> Booth, Gate -> Janitor, + Plaza -> Locker) now draw their corridor floors. +- The Projector ritual is implemented: standing at the briefing reel for 20 s + claims the Projector as a permanent OoP (`WeaponType::Projector`). Rituals can + be replaced after completion and each can be claimed once per run. +- The Gate's sealed side exits now obey the diegetic clearance rule from §2: + Clearance 01 opens only the Plaza concourse; claiming the Projector raises + clearance to 02 and opens the Locker Room, Janitor Closet and Security Booth. + A floor jump raises clearance again. Each side room grants a one-time reward + (intel/+XP, stashed shards, Ahti's first-aid kit, or a world-object cache), + which gives the greed-vs-clock detour an actual payoff. ## 6. Files - `docs/maps/oldest_house_flow.svg` / `.png` — the whole 7-floor ascent. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 7192872..55d4fb5 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -7,7 +7,7 @@ | M0 | Scaffold: CMake + raylib 6.2, window, states, input, fixed tick | Builds; window opens; quits clean | **DONE** | | M1 | Grey-box vertical slice: move, dash, 1 auto-weapon, 3 enemy types, XP -> level-up (offers roll at thresholds, no pick, §2.2), corruption clock, death screen | *Fun for 60 seconds with placeholder art* | **DONE** | | M2 | Horde foundation: pooling, spatial hash, credit-based Director (+ too-cheap rule), OoP weapons (4), evolutions, damage numbers | 250+ enemies at 60 fps; RoR2 spawn feel | **DONE** - 250 enemies @ 60 fps verified via --bot --no-damage stress capture; 4 OoPs with levels 1-4 + Altered Forms, director bank + burst behavior in HUD | -| M3 | Floors & OoP rituals: room-template assembly, keys/threshold doors, ritual quest flow (reach -> complete -> claim skill), simple TV ritual MVP (reach TV -> wait 60 s -> TV live), complex lightswitch ritual (§2.3 of GAME_DESIGN.md: magnet-catch bait near the switch -> revival + Fluorescent Light reward), Oceanview shop, 1 boss + boss door | Full 3-floor run start -> finish | | +| M3 | Floors & OoP rituals: room-template assembly, keys/threshold doors, ritual quest flow (reach -> complete -> claim skill), simple TV ritual MVP (reach TV -> wait 60 s -> TV live), complex lightswitch ritual (§2.3 of GAME_DESIGN.md: magnet-catch bait near the switch -> revival + Fluorescent Light reward), Oceanview shop, 1 boss + boss door | Full 3-floor run start -> finish | **PARTIAL** — Floor 01 blockout, room collision, key -> door loop and the Projector ritual -> permanent skill are playable; other six floors, Oceanview shop and bosses outstanding | | M4 | Debuffs & Buffs — scene-wide ECS-like system (components, durations, duration bars); player buff examples (damage amp, speed, regen, armor); elite debuff batteries (Resonant, Phasing, Shielded, Mending, Volatile); **world objects of power — SCP-like items on the scene (spawn: enemy deaths + scatter, magnet catch applies — player or nearest enemy, player+enemy channel debuffs — Unidentified)** | Distinct debuff/buff identities per enemy class | | | M5 | Enemy components & elites: T1/T2 affixs, Taken/Elevated/Cluster/Host variants | Soft groups of elites; elite reads distinct | | | M6 | Art/audio pass: brutalist floor kit, standee art, corruption-driven shaders/audio/env decay, OFL fonts (Archivo, IBM Plex Mono), SFX | Looks like Control; plays 20 min without repetition | | diff --git a/src/game/floor.cpp b/src/game/floor.cpp index dd493c3..62878a9 100644 --- a/src/game/floor.cpp +++ b/src/game/floor.cpp @@ -37,10 +37,10 @@ Floor::Floor() { {"OFFICE SUITE", rect_from_map(70, 76, 146, 112), RoomKind::OfficeSuite, 4}, {"SILOS", rect_from_map(14, 76, 66, 112), RoomKind::Silos, 5}, {"THRESHOLD STAIRWELL", rect_from_map(16, 114, 42, 120), RoomKind::Stairwell, 6}, - {"RECORDS ARCHIVE", rect_from_map(146, 34, 160, 68), RoomKind::Side, 0}, - {"LOCKER ROOM", rect_from_map(0, 36, 16, 68), RoomKind::Side, 0}, - {"JANITOR CLOSET", rect_from_map(6, 4, 46, 22), RoomKind::Side, 0}, - {"SECURITY BOOTH", rect_from_map(110, 0, 156, 26), RoomKind::Side, 0}, + {"RECORDS ARCHIVE", rect_from_map(146, 34, 160, 68), RoomKind::Side, 0, 0}, + {"LOCKER ROOM", rect_from_map(0, 36, 16, 68), RoomKind::Side, 0, 1}, + {"JANITOR CLOSET", rect_from_map(6, 4, 46, 22), RoomKind::Side, 0, 2}, + {"SECURITY BOOTH", rect_from_map(110, 0, 156, 26), RoomKind::Side, 0, 3}, }; corridors_ = { @@ -52,6 +52,9 @@ Floor::Floor() { rect_from_map(116, 72, 132, 76), rect_from_map(142, 46, 146, 54), rect_from_map(24, 112, 36, 114), + rect_from_map(104, 14, 110, 18), + rect_from_map(46, 14, 56, 18), + rect_from_map(16, 46, 18, 54), }; auto hwall = [&](float y, float x0, float x1, std::vector gaps, @@ -78,7 +81,7 @@ Floor::Floor() { room_walls(56, 0, 104, 26, {{76, 84}}, {{72, 88}}, {{14, 18}}, {{14, 18}}); room_walls(18, 30, 112, 72, {{72, 88}}, {{34, 50}, {76, 100}}, {{46, 54}}, {{44, 56}}); - room_walls(116, 30, 142, 72, {{116, 132}}, {}, {{44, 56}}, {{46, 54}}); + room_walls(116, 30, 142, 72, {}, {{116, 132}}, {{44, 56}}, {{46, 54}}); room_walls(70, 76, 146, 112, {{76, 100}, {116, 132}}, {}, {{92, 104}}, {}); room_walls(14, 76, 66, 112, {{34, 50}}, {{24, 36}}, {}, {{92, 104}}); room_walls(16, 114, 42, 120, {{24, 36}}, {}, {}, {}); @@ -92,6 +95,17 @@ Floor::Floor() { vwall(0, 0, 120, {}, 4.2f); vwall(160, 0, 120, {}, 4.2f); + // Clearance-gated openings. Each door fills an existing wall gap; the + // wall is solid until the matching clearance stamp is earned, then the + // collision check skips it and the presenter draws the door as open. + auto door_wall = [&](DoorId id, float x0, float y0, float x1, float y1) { + walls_.push_back({rect_from_map(x0, y0, x1, y1), 3.2f, + static_cast(id)}); + }; + door_wall(DoorId::Janitor, 46, 14, 56, 18); + door_wall(DoorId::Booth, 104, 14, 110, 18); + door_wall(DoorId::Locker, 16, 46, 18, 54); + // The central plaza keeps the original hub's pillar grid: real collision, // not just set dressing. const float pillars[][2] = { @@ -135,6 +149,7 @@ Vec2 Floor::clamp(Vec2 p) const { bool Floor::blocked(Vec2 p, float radius) const { for (const FloorWall& w : walls_) { + if (w.door >= 0 && door_open(w.door)) continue; const FloorRect& r = w.rect; if (p.x > r.x0 - radius && p.x < r.x1 + radius && p.y > r.z0 - radius && p.y < r.z1 + radius) return true; @@ -153,6 +168,7 @@ Vec2 Floor::resolve(Vec2 p, float radius) const { for (int iter = 0; iter < 4; ++iter) { bool moved = false; for (const FloorWall& w : walls_) { + if (w.door >= 0 && door_open(w.door)) continue; const FloorRect& r = w.rect; const float x0 = r.x0 - radius, x1 = r.x1 + radius; const float z0 = r.z0 - radius, z1 = r.z1 + radius; @@ -183,6 +199,23 @@ const char* Floor::room_name(Vec2 p) const { return r != nullptr ? r->name : "CORRIDOR"; } +int Floor::side_room_at(Vec2 p) const { + const FloorRoom* r = room_at(p); + return r != nullptr ? r->side_index : -1; +} + +void Floor::unlock_door(int id) { + if (id >= 0 && id < static_cast(DoorId::Count)) doors_[id] = true; +} + +void Floor::unlock_all_doors() { + for (int i = 0; i < static_cast(DoorId::Count); ++i) doors_[i] = true; +} + +void Floor::reset_doors() { + for (int i = 0; i < static_cast(DoorId::Count); ++i) doors_[i] = false; +} + Vec2 Floor::spawn_near(Vec2 around, Rng& rng, float min_dist, float max_dist) const { const FloorRoom* room = room_at(around); for (int i = 0; i < 32; ++i) { diff --git a/src/game/floor.hpp b/src/game/floor.hpp index 6b73ae7..18d9dd4 100644 --- a/src/game/floor.hpp +++ b/src/game/floor.hpp @@ -17,9 +17,12 @@ struct FloorRect { } }; +enum class DoorId { Janitor = 0, Booth = 1, Locker = 2, Count = 3 }; + struct FloorWall { FloorRect rect; float height = 3.2f; + int door = -1; // >= 0 = gated opening, solid until clearance unlocks it }; enum class RoomKind { Gate, Plaza, Projector, OfficeSuite, Silos, Stairwell, Side }; @@ -29,6 +32,7 @@ struct FloorRoom { FloorRect rect; RoomKind kind = RoomKind::Side; int flow = 0; + int side_index = -1; // 0..3 for the four side rooms }; enum class PropKind { Turnstile, Desk, MeetingTable, Screen, Seat, Silo, Shelf, HazardDoor, Key, Pillar }; @@ -50,6 +54,7 @@ public: static constexpr float kWidth = 160.0f; static constexpr float kHeight = 120.0f; + static constexpr int kSideRoomCount = 4; static Vec2 to_world(float map_x, float map_y) { return {map_x - kWidth * 0.5f, kHeight * 0.5f - map_y}; } @@ -70,6 +75,14 @@ public: const FloorRoom* room_at(Vec2 p) const; const char* room_name(Vec2 p) const; + int side_room_at(Vec2 p) const; + + bool door_open(int id) const { + return id >= 0 && id < static_cast(DoorId::Count) && doors_[id]; + } + void unlock_door(int id); + void unlock_all_doors(); + void reset_doors(); Vec2 spawn_near(Vec2 around, Rng& rng, float min_dist, float max_dist) const; @@ -83,4 +96,5 @@ private: std::vector walls_; std::vector props_; std::vector corridors_; + bool doors_[static_cast(DoorId::Count)] = {}; }; diff --git a/src/game/game.cpp b/src/game/game.cpp index 2306336..ef4821d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -10,6 +10,7 @@ std::vector roll_offers(Game& g) { // New weapons for (int i = 0; i < kWeaponTypeCount; ++i) { WeaponType wt = static_cast(i); + if (wt == WeaponType::Projector) continue; // ritual-only reward bool owned = false; for (const WeaponInstance& w : g.weapon_system.weapons) if (w.type == wt) owned = true; if (!owned && static_cast(g.weapon_system.weapons.size()) < g.config.max_weapons) { @@ -116,7 +117,12 @@ void Game::reset() { has_key = false; floor_number = 1; floor_clears = 0; + clearance = 1; + floor.reset_doors(); floor_banner = 0.0f; + side_banner = 0.0f; + side_banner_text = ""; + for (bool& claimed : side_reward_claimed_) claimed = false; enemy_system.clear(); weapon_system.reset(); pickup_system.clear(); @@ -148,6 +154,7 @@ void Game::update(const InputState& in, float dt) { // --- Playing --- run_time += dt; floor_banner = std::max(0.0f, floor_banner - dt); + side_banner = std::max(0.0f, side_banner - dt); corruption.update(dt); buff_system.update(dt); player.mods = buff_system.player_mods(); @@ -158,7 +165,14 @@ void Game::update(const InputState& in, float dt) { } player_update(player, in, dt, floor); + const bool projector_skill_claimed = + ritual_system.type() == RitualType::Projector && ritual_system.complete(); ritual_system.update(dt, player, buff_system, enemy_system); + if (!projector_skill_claimed && ritual_system.type() == RitualType::Projector + && ritual_system.complete()) { + grant_ritual_skill(); + floor_banner = std::max(floor_banner, 3.0f); + } director.update(dt, corruption, run_time, player, enemy_system, rng, config.max_enemies, floor); enemy_system.update(dt, player, buff_system, events, floor); @@ -185,6 +199,7 @@ void Game::update(const InputState& in, float dt) { pickup_system.update(dt, player, events, xp_gained, buff_system, enemy_system); xp += xp_gained; floor_pass(); + side_room_pass(); while (xp >= xp_to_next) { xp -= xp_to_next; @@ -218,6 +233,9 @@ void Game::floor_pass() { corruption.floor_cleared(); ++floor_number; ++floor_clears; + ++clearance; + floor.unlock_all_doors(); + for (bool& claimed : side_reward_claimed_) claimed = false; floor_banner = 4.0f; has_key = false; events.push(EventType::FloorCleared, floor.door_pos(), @@ -229,6 +247,59 @@ void Game::floor_pass() { player.pos = floor.spawn(); } +void Game::grant_ritual_skill() { + // Mega Man reward (GAME_DESIGN.md §2.4): claiming the briefing reel makes + // the Projector a permanent OoP for the rest of the run. Reclaiming it on a + // later floor levels the skill instead of duplicating it. + for (WeaponInstance& w : weapon_system.weapons) { + if (w.type == WeaponType::Projector) { + if (w.level < 4) ++w.level; + return; + } + } + // A ritual reward is not limited by the normal level-up offer cap. + weapon_system.weapons.push_back({WeaponType::Projector, 1, false, 0.0f}); + // The briefing stamp is also the side-quest reward that opens the sealed + // side doors — the greed-vs-clock detours now have a reason to exist. + clearance = std::max(clearance, 2); + floor.unlock_all_doors(); +} + +void Game::side_room_pass() { + const int idx = floor.side_room_at(player.pos); + if (idx < 0 || idx >= Floor::kSideRoomCount || side_reward_claimed_[idx]) return; + side_reward_claimed_[idx] = true; + side_banner = 3.0f; + switch (idx) { + case 0: // Records Archive — lore and a filed XP stipend + xp += 8.0f; + side_banner_text = "RECORDS ARCHIVE — recovered intel (+XP)"; + break; + case 1: // Locker Room — shard greed + for (int i = 0; i < 8; ++i) { + const float a = rng.range(0.0f, 6.2831853f); + pickup_system.spawn(player.pos + Vec2{std::cos(a) * 2.0f, + std::sin(a) * 2.0f}, + 2.0f, rng); + } + side_banner_text = "LOCKER ROOM — stashed resonance shards"; + break; + case 2: // Janitor Closet — Ahti's chore pays in first aid + player.hp = std::min(player.stats.max_hp, player.hp + 25.0f); + side_banner_text = "JANITOR CLOSET — Ahti left a first-aid kit (+HP)"; + break; + case 3: // Security Booth — contained world objects + for (int i = 0; i < 2; ++i) { + buff_system.spawn_world_object(player.pos + Vec2{static_cast(i) * 1.5f, 0.0f}, + rng, corruption.value()); + } + side_banner_text = "SECURITY BOOTH — world-object cache"; + break; + default: break; + } + events.push(EventType::ShardCollected, player.pos, 1.0f); +} + void Game::death_pass() { for (std::size_t i = 0; i < enemy_system.enemies.size();) { Enemy& e = enemy_system.enemies[i]; diff --git a/src/game/game.hpp b/src/game/game.hpp index 401dc67..5007305 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -62,7 +62,10 @@ public: bool has_key = false; int floor_number = 1; int floor_clears = 0; + int clearance = 1; // diegetic stamp; gates the three side-room doors float floor_banner = 0.0f; + float side_banner = 0.0f; + const char* side_banner_text = ""; int kills = 0; int level = 1; float xp = 0.0f; @@ -75,7 +78,10 @@ public: private: void death_pass(); void floor_pass(); + void side_room_pass(); + void grant_ritual_skill(); std::uint64_t seed_ = 0; int last_tier_ = 0; + bool side_reward_claimed_[Floor::kSideRoomCount] = {}; }; diff --git a/src/game/ritual.cpp b/src/game/ritual.cpp index c5bcd75..1765b76 100644 --- a/src/game/ritual.cpp +++ b/src/game/ritual.cpp @@ -14,6 +14,7 @@ void RitualSystem::start_lightswitch(BuffSystem& buff_system) { elapsed_ = 0.0f; caught_ = 0; required_ = 0; + claimed_[static_cast(RitualType::Lightswitch)] = true; // Drop the bait ring around the switch — the House leaves objects near // its broken switches as bait (GAME_DESIGN.md §2.3). for (int i = 0; i < kSwitchObjectsRequired; ++i) { @@ -42,18 +43,47 @@ void RitualSystem::activate_lightswitch(BuffSystem& buff_system, EnemySystem& en } } +void RitualSystem::start_projector() { + type_ = RitualType::Projector; + state_ = State::InProgress; + elapsed_ = 0.0f; + claimed_[static_cast(RitualType::Projector)] = true; +} + +void RitualSystem::complete_projector() { + state_ = State::Complete; + elapsed_ = 0.0f; + // The reward is a permanent OoP skill. Game watches the Complete state + // and grants it through WeaponSystem, which this system does not own. +} + void RitualSystem::update(float dt, const Player& player, BuffSystem& buff_system, EnemySystem& enemies) { - if (state_ == State::Idle) { - if (type_ == RitualType::TV && distance(player.pos, kTVPos) <= kTVRadius) { + if (state_ == State::Idle || state_ == State::Complete) { + // A completed ritual can be replaced by walking into another one, but + // each ritual can only be claimed once per run (GAME_DESIGN.md §2.4). + if (!claimed(RitualType::Projector) + && distance(player.pos, kProjectorPos) <= kProjectorRadius) { + start_projector(); + } else if (!claimed(RitualType::TV) + && distance(player.pos, kTVPos) <= kTVRadius) { + type_ = RitualType::TV; state_ = State::InProgress; elapsed_ = 0.0f; - } else if (distance(player.pos, kLightSwitchPos) <= kSwitchRadius) { + claimed_[static_cast(RitualType::TV)] = true; + } else if (!claimed(RitualType::Lightswitch) + && distance(player.pos, kLightSwitchPos) <= kSwitchRadius) { start_lightswitch(buff_system); } return; } + if (state_ == State::InProgress && type_ == RitualType::Projector) { + elapsed_ += dt; + if (elapsed_ >= kProjectorDuration - 0.01f) complete_projector(); + return; + } + if (state_ == State::InProgress && type_ == RitualType::TV) { elapsed_ += dt; // Epsilon so float accumulation of the 60 s budget can't stall it. diff --git a/src/game/ritual.hpp b/src/game/ritual.hpp index a462208..43c91da 100644 --- a/src/game/ritual.hpp +++ b/src/game/ritual.hpp @@ -23,14 +23,22 @@ // damage for 12 s (§4.5 "Fluorescent Light"). The ritual completes and the OoP // becomes claimable via the §2.3 ritual-offer channel. // -// The ritual system is singular: one active ritual per run. -enum class RitualType { TV, Lightswitch }; +// One ritual is active at a time; a completed ritual can be replaced by +// starting another one, but each ritual can only be claimed once per run. +enum class RitualType { TV, Lightswitch, Projector }; +constexpr int kRitualTypeCount = 3; struct RitualSystem { static constexpr Vec2 kTVPos = {13.0f, 17.0f}; static constexpr float kTVRadius = 5.0f; static constexpr float kTVDuration = 60.0f; + // L1's signature beat: the briefing reel in the Projector Room. Map + // (129, 60) -> world (49, -2), in front of the projection screen. + static constexpr Vec2 kProjectorPos = {49.0f, -2.0f}; + static constexpr float kProjectorRadius = 4.0f; + static constexpr float kProjectorDuration = 20.0f; + static constexpr Vec2 kLightSwitchPos = {0.0f, -8.0f}; static constexpr float kSwitchRadius = 3.0f; static constexpr float kSwitchObjectsRingRadius = 2.5f; @@ -44,10 +52,14 @@ struct RitualSystem { bool active() const { return state_ == State::InProgress; } bool complete() const { return state_ == State::Complete; } + float duration() const { + return type_ == RitualType::Projector ? kProjectorDuration : kTVDuration; + } float remaining() const { - return state_ == State::Idle ? 0.0f : kTVDuration - elapsed_; + return state_ == State::Idle ? 0.0f : duration() - elapsed_; } RitualType type() const { return type_; } + bool claimed(RitualType t) const { return claimed_[static_cast(t)]; } int lightswitch_caught() const { return caught_; } int lightswitch_required() const { return required_; } @@ -56,10 +68,13 @@ private: void start_lightswitch(BuffSystem& buff_system); void activate_lightswitch(BuffSystem& buff_system, EnemySystem& enemies); + void start_projector(); + void complete_projector(); State state_ = State::Idle; float elapsed_ = 0.0f; RitualType type_ = RitualType::TV; int caught_ = 0; // lightswitch: bait caught so far int required_ = 0; // lightswitch: bait objects successfully spawned + bool claimed_[kRitualTypeCount] = {}; }; diff --git a/src/game/weapons.cpp b/src/game/weapons.cpp index 9d7d91c..2aeb519 100644 --- a/src/game/weapons.cpp +++ b/src/game/weapons.cpp @@ -28,6 +28,10 @@ const WeaponDef kDefs[kWeaponTypeCount] = { "telekinetic debris pelts random targets", 18.0f, 1.1f, 30.0f, 1, 0.0f, 5.0f, 0.0f, 1.2f, 0.30f, Directive::LaunchTraining, "LAUNCH - MASS DRIVER"}, + {WeaponType::Projector, "PROJECTOR", + "briefing reel: slow homing projections that burst on impact", + 26.0f, 3.0f, 16.0f, 1, 0.0f, 1.8f, 3.0f, 3.2f, 0.65f, + Directive::ResonanceAttunement, "PROJECTOR - BRIEFING REEL"}, }; // Level scaling: level 4 ~= +105% damage, -24% cooldown. diff --git a/src/game/weapons.hpp b/src/game/weapons.hpp index 9624f17..d3067c1 100644 --- a/src/game/weapons.hpp +++ b/src/game/weapons.hpp @@ -11,8 +11,8 @@ // Objects of Power as auto-cast weapons (see docs/GAME_DESIGN.md section 4). // Levels 1-4; level 4 + the required Directive unlocks the Altered Form. -enum class WeaponType { Spin, Shatter, Charge, Launch }; -constexpr int kWeaponTypeCount = 4; +enum class WeaponType { Spin, Shatter, Charge, Launch, Projector }; +constexpr int kWeaponTypeCount = 5; struct WeaponDef { WeaponType type; diff --git a/src/render/presenter.cpp b/src/render/presenter.cpp index 0921967..5b5c240 100644 --- a/src/render/presenter.cpp +++ b/src/render/presenter.cpp @@ -19,12 +19,15 @@ Color projectile_color(WeaponType type) { case WeaponType::Shatter: return Color{255, 170, 90, 255}; case WeaponType::Charge: return Color{255, 70, 60, 255}; case WeaponType::Launch: return Color{140, 220, 200, 255}; + case WeaponType::Projector: return Color{190, 150, 255, 255}; } return WHITE; } float projectile_size(WeaponType type) { - return type == WeaponType::Charge ? 1.1f : 0.45f; + if (type == WeaponType::Charge) return 1.1f; + if (type == WeaponType::Projector) return 0.7f; + return 0.45f; } Texture2D load_glow_sprite() { @@ -598,7 +601,35 @@ void Presenter::draw_floor_environment(const Game& game) { } } - // Ritual anchors still live in the Offices on this floor. + // Clearance-gated doors. Locked openings are solid slabs with a red + // stripe; once stamped they read as open frames with a green threshold. + struct DoorVisual { DoorId id; Vec2 a, b; }; + const DoorVisual door_visuals[] = { + {DoorId::Janitor, Floor::to_world(46, 14), Floor::to_world(56, 18)}, + {DoorId::Booth, Floor::to_world(104, 14), Floor::to_world(110, 18)}, + {DoorId::Locker, Floor::to_world(16, 46), Floor::to_world(18, 54)}, + }; + for (const DoorVisual& d : door_visuals) { + const float cx = (d.a.x + d.b.x) * 0.5f; + const float cz = (d.a.y + d.b.y) * 0.5f; + const float w = std::fabs(d.b.x - d.a.x); + const float depth = std::fabs(d.b.y - d.a.y); + if (floor.door_open(static_cast(d.id))) { + DrawCube({cx, 0.07f, cz}, w, 0.06f, depth, + Color{70, 210, 120, 255}); + for (const float sx : {-w * 0.5f, w * 0.5f}) { + DrawCube({cx + sx, 1.6f, cz}, 0.18f, 3.2f, 0.18f, + Color{120, 130, 124, 255}); + } + } else { + DrawCube({cx, 1.6f, cz}, w, 3.2f, depth, Color{96, 26, 32, 255}); + DrawCube({cx, 2.4f, cz}, w, 0.14f, depth + 0.2f, + Color{200, 40, 50, 255}); + } + } + + // Ritual anchors: TV and Light Switch are in the Plaza; the Projector is + // in the Projector Room (Floor 01's signature OoP ritual). models_.draw(ActorModel::TV, {RitualSystem::kTVPos.x, 0.0f, RitualSystem::kTVPos.y}, 0.0f, 1.0f, WHITE); @@ -606,6 +637,21 @@ void Presenter::draw_floor_environment(const Game& game) { {RitualSystem::kLightSwitchPos.x, 0.0f, RitualSystem::kLightSwitchPos.y}, 0.0f, 1.0f, WHITE); + { + const Vec2 p = RitualSystem::kProjectorPos; + const bool projector_ritual = + game.ritual_system.type() == RitualType::Projector; + const Color projector_color = + projector_ritual && game.ritual_system.complete() + ? Color{255, 245, 200, 255} + : projector_ritual && game.ritual_system.active() + ? Color{245, 197, 24, 255} + : Color{165, 130, 220, 255}; + DrawCube({p.x, 1.0f, p.y}, 2.4f, 1.6f, 1.8f, projector_color); + DrawCylinder({p.x, 0.09f, p.y}, RitualSystem::kProjectorRadius, + RitualSystem::kProjectorRadius, 0.02f, 18, + Color{190, 150, 255, 60}); + } const Vec2 door = floor.door_pos(); DrawCylinder({door.x, 0.09f, door.y}, 5.5f, 5.5f, 0.02f, 18, @@ -1189,14 +1235,18 @@ void Presenter::draw_scene(Game& game) { if (floor_mode_) { for (const FloorRoom& r : game.floor.rooms()) { - if (r.flow == 0) continue; + if (r.flow == 0 && r.side_index < 0) continue; const Vec2 c{(r.rect.x0 + r.rect.x1) * 0.5f, (r.rect.z0 + r.rect.z1) * 0.5f}; const Vector2 s = GetWorldToScreen({c.x, 1.0f, c.y}, camera_); if (s.x < 0.0f || s.y < 0.0f || s.x > GetScreenWidth() || s.y > GetScreenHeight()) continue; char buf[96]; - std::snprintf(buf, sizeof(buf), "%d %s", r.flow, r.name); + if (r.flow > 0) { + std::snprintf(buf, sizeof(buf), "%d %s", r.flow, r.name); + } else { + std::snprintf(buf, sizeof(buf), "%c %s", 'A' + r.side_index, r.name); + } const int w = MeasureText(buf, 12); DrawRectangle(static_cast(s.x) - w / 2 - 7, static_cast(s.y) - 15, w + 14, 19, diff --git a/src/render/ui.cpp b/src/render/ui.cpp index 963d9b5..9fe7d8e 100644 --- a/src/render/ui.cpp +++ b/src/render/ui.cpp @@ -73,10 +73,16 @@ void draw_hud(const Game& game) { Color{245, 197, 24, 250}); } } + if (game.side_banner > 0.0f && game.side_banner_text != nullptr) { + const int bw = ui_font::measure_text(game.side_banner_text, 16); + ui_font::draw_text(game.side_banner_text, GetScreenWidth() / 2 - bw / 2, 132, 16, + Color{160, 220, 200, 250}); + } - // Kills + clearance level. - char misc[64]; - std::snprintf(misc, sizeof(misc), "KILLS %d CLEARANCE LV %d", game.kills, game.level); + // Kills, XP level and the diegetic clearance stamp (which opens doors). + char misc[80]; + std::snprintf(misc, sizeof(misc), "KILLS %d LV %d CLEARANCE %02d", + game.kills, game.level, game.clearance); ui_font::draw_text(misc, 20, 52, 18, Color{200, 198, 192, 235}); // Ritual in progress — mini-game indicator (the player understands the @@ -89,6 +95,10 @@ void draw_hud(const Game& game) { "RITUAL IN PROGRESS — LIGHT SWITCH — CATCHING (%d/%d)", game.ritual_system.lightswitch_caught(), game.ritual_system.lightswitch_required()); + } else if (game.ritual_system.type() == RitualType::Projector) { + std::snprintf(rit, sizeof(rit), + "RITUAL IN PROGRESS — PROJECTOR / BRIEFING REEL (%.0f s)", + std::max(0.0f, game.ritual_system.remaining())); } else { std::snprintf(rit, sizeof(rit), "RITUAL IN PROGRESS — The TV must flash (%.0f s)", @@ -97,10 +107,13 @@ void draw_hud(const Game& game) { ui_font::draw_text(rit, 20, 70.0f, 16, Color{245, 197, 24, 255}); } if (game.ritual_system.complete()) { - ui_font::draw_text(game.ritual_system.type() == RitualType::Lightswitch - ? "RITUAL COMPLETE — Fluorescents revived" - : "RITUAL COMPLETE — The TV is live", - 20, 70.0f, 16, Color{245, 197, 24, 255}); + const char* done = + game.ritual_system.type() == RitualType::Lightswitch + ? "RITUAL COMPLETE — Fluorescents revived" + : game.ritual_system.type() == RitualType::Projector + ? "RITUAL COMPLETE — PROJECTOR CLAIMED: briefing reel acquired" + : "RITUAL COMPLETE — The TV is live"; + ui_font::draw_text(done, 20, 70.0f, 16, Color{245, 197, 24, 255}); } // Owned OoP loadout (left column).