diff --git a/ConcreteMaterial.blend b/ConcreteMaterial.blend new file mode 100644 index 0000000..464b672 Binary files /dev/null and b/ConcreteMaterial.blend differ diff --git a/README.md b/README.md index fa40e8f..4415e7e 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,9 @@ enemy. See `docs/GAME_DESIGN.md`. ## Status 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), real-time -skill offers on level-up (no pause), 3 enemy archetypes, corruption clock, +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, 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), procedural walk/stagger rigs, @@ -34,8 +35,8 @@ cmake --build build -j6 ``` Dev tools: `--bot` (kiting autopilot), `--no-damage` (stress mode), -`--screenshot [--screenshot-at ]` and `--screenshot-on-levelup ` -for automated visual checks; F12 saves a screenshot on demand. +`--screenshot [--screenshot-at ]` for automated visual checks; +F12 saves a screenshot on demand. raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compiler (GCC 13+) and OpenGL/X11 dev headers (already required by GLFW). @@ -47,7 +48,6 @@ raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compi | WASD | Move | | Stick (XInput/GLFW, M7) | Move | | Shift / Space | Dash (*Evade*) | -| 1 / 2 / 3 | Pick level-up offer (real-time, no pause) | | R | Restart run (on death) | | Esc | Quit | @@ -60,7 +60,7 @@ raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compi - `docs/concept/` — rendered Blender concept frames (visual target for M5) - `docs/ENV_ENHANCEMENT.md` — enhancement slices S0–S15 for the environment/actors - `tools/blender/` — procedural diorama + actor builders (`actor_kit.py` loft/sweep/blob/crystal helpers) and render scripts -- `assets/models/` — game-ready GLB actors (guard, 3 enemies, resonance shard) and `props/` OoP set dressing +- `assets/models/` — game-ready GLB actors (guard, 3 enemies, cyan resonance point crystal) and `props/` OoP set dressing - `assets/textures/concrete/` — shared seamless albedo/normal/roughness maps - `assets/textures/actor/actor_ramp.png` — Blender-generated stylised lighting ramp - `assets/blender/fbc_corruption_wave.blend` — reusable SDF wave reference scene diff --git a/assets/blender/fbc_enemies.blend b/assets/blender/fbc_enemies.blend index f0a5009..2b425a2 100644 Binary files a/assets/blender/fbc_enemies.blend and b/assets/blender/fbc_enemies.blend differ diff --git a/assets/blender/fbc_night_shift_diorama.blend b/assets/blender/fbc_night_shift_diorama.blend index 86499c3..ed41843 100644 Binary files a/assets/blender/fbc_night_shift_diorama.blend and b/assets/blender/fbc_night_shift_diorama.blend differ diff --git a/assets/models/shard.glb b/assets/models/shard.glb index 7b0bb54..0501359 100644 Binary files a/assets/models/shard.glb and b/assets/models/shard.glb differ diff --git a/assets/shaders/actor.fs b/assets/shaders/actor.fs index 8e58275..bf87bf1 100644 --- a/assets/shaders/actor.fs +++ b/assets/shaders/actor.fs @@ -21,6 +21,7 @@ uniform float uTime = 0.0; uniform float uFlash = 0.0; uniform float uCorruption = 0.0; uniform float uOutline = 0.0; +uniform float uGlow = 0.0; void main() { @@ -63,6 +64,7 @@ void main() float bright = max(base.r, max(base.g, base.b)); float pulse = 0.88 + 0.12 * sin(uTime * 2.6 + vWorld.x * 1.7 + vWorld.z * 0.9); lit += base * smoothstep(0.42, 0.88, bright) * 0.20 * pulse; + lit += base * uGlow * pulse; // Tight sheen so bevels catch the fluorescent key. vec3 halfDir = normalize(keyDir + viewDir); diff --git a/assets/sprites/glow.png b/assets/sprites/glow.png index 80febd3..f1f7d4f 100644 Binary files a/assets/sprites/glow.png and b/assets/sprites/glow.png differ diff --git a/assets/sprites/glyph_a.png b/assets/sprites/glyph_a.png new file mode 100644 index 0000000..e4f9528 Binary files /dev/null and b/assets/sprites/glyph_a.png differ diff --git a/assets/sprites/glyph_b.png b/assets/sprites/glyph_b.png new file mode 100644 index 0000000..b3c3b1b Binary files /dev/null and b/assets/sprites/glyph_b.png differ diff --git a/assets/sprites/glyph_c.png b/assets/sprites/glyph_c.png new file mode 100644 index 0000000..4c736ac Binary files /dev/null and b/assets/sprites/glyph_c.png differ diff --git a/assets/sprites/guard.png b/assets/sprites/guard.png index 029dd10..6d43b01 100644 Binary files a/assets/sprites/guard.png and b/assets/sprites/guard.png differ diff --git a/assets/sprites/hiss_brute.png b/assets/sprites/hiss_brute.png index c947e42..96834e0 100644 Binary files a/assets/sprites/hiss_brute.png and b/assets/sprites/hiss_brute.png differ diff --git a/assets/sprites/hiss_staff.png b/assets/sprites/hiss_staff.png index fcef5ce..6b62e8d 100644 Binary files a/assets/sprites/hiss_staff.png and b/assets/sprites/hiss_staff.png differ diff --git a/assets/sprites/mold_spore.png b/assets/sprites/mold_spore.png index cf97b91..abbd7df 100644 Binary files a/assets/sprites/mold_spore.png and b/assets/sprites/mold_spore.png differ diff --git a/assets/sprites/shard.png b/assets/sprites/shard.png index bb714d0..cdaadcd 100644 Binary files a/assets/sprites/shard.png and b/assets/sprites/shard.png differ diff --git a/assets/textures/concrete/concrete_albedo.png b/assets/textures/concrete/concrete_albedo.png index 73c3df1..5bfe7f3 100644 Binary files a/assets/textures/concrete/concrete_albedo.png and b/assets/textures/concrete/concrete_albedo.png differ diff --git a/assets/textures/concrete/concrete_normal.png b/assets/textures/concrete/concrete_normal.png index c7054e9..6499e6f 100644 Binary files a/assets/textures/concrete/concrete_normal.png and b/assets/textures/concrete/concrete_normal.png differ diff --git a/assets/textures/concrete/concrete_roughness.png b/assets/textures/concrete/concrete_roughness.png index 4df443a..c7b2ffe 100644 Binary files a/assets/textures/concrete/concrete_roughness.png and b/assets/textures/concrete/concrete_roughness.png differ diff --git a/docs/ART_DIRECTION.md b/docs/ART_DIRECTION.md index b618925..eb84062 100644 --- a/docs/ART_DIRECTION.md +++ b/docs/ART_DIRECTION.md @@ -12,7 +12,7 @@ units are little free-standing puppets rather than printed cards: ~80% of the look for ~20% of the cost. - Units are **sculpted low-poly puppets** — lofted bodies, swept limbs and deformed organic masses rather than a cube kit (guard ~5.7k triangles, enemies - 1.4–2.9k, shard ~150), with readable facets, ID-badge details, Hiss crystal + 1.4–2.9k, point crystal ~60), with readable facets, ID-badge details, Hiss crystal growths and a little base ring. Thematically the same bureaucrat-moving-case- files fantasy, but they occupy real depth: they turn to face the player, bob when floating and are lit by the House's fluorescent key. @@ -32,6 +32,9 @@ units are little free-standing puppets rather than printed cards: - **Signal red `#c1121f`** — Hiss resonance - **Board yellow `#f5c518`** — the Board's light - Astral teal `#4ec9b0` — Polaris / safe +- Resonance cyan `#00c4eb` — small emissive point crystals dropped by kills; + a hotter `#40dfff` core and a soft cyan billboard make them read at tactical + camera distance without scaling them back up. ## Camera @@ -45,7 +48,7 @@ inside the curb so the play area never shows the unlit floor beyond the wall. Every screen is an FBC form. Signature gag: **redaction bars that slide away** to reveal text. Stamps ("CONTAINED", "BREACH"), typewriter text reveals. HUD: containment status gauge (RoR2 difficulty bar homage) top right with run timer; -HP/XP as form fields; level-up = Board Directive cards. +HP/XP as form fields; level-ups roll offers that apply without any pause. ## Corruption as a presentation channel (the best part) diff --git a/docs/ENV_ENHANCEMENT.md b/docs/ENV_ENHANCEMENT.md index ca434ff..451d880 100644 --- a/docs/ENV_ENHANCEMENT.md +++ b/docs/ENV_ENHANCEMENT.md @@ -14,15 +14,15 @@ Legend: **[B]** Blender scene (`tools/blender/build_scene.py`) · **[G]** game |---|---|---|---| | S0 | Light, surface & post pass | bevels, floor gloss variation, dead/flickering strips, teal Polaris alcove, threshold-door light spill, dust motes, vignette + chromatic aberration | **DONE** [B][R] | | S1 | Identity props | Objects of Power (Hotline, Benicoff TV, Service Weapon pedestal, Rubber Duck), security desk, filing cabinets, scattered redacted papers, puddles | **DONE** [B] | -| S2 | Corruption decay layer | glyph particles, chanting-glyph signage, sparks on dead strips, red mist pockets, wall stains/leaks, more floating debris | planned [B] | -| S3 | Standee art v2 | paper grain + halftone, sleeve sheen, new archetypes (Hiss Elevated, Cluster, Taken, Mold Host), boss standee, elite affix rim variants | planned [B]→[G] | +| S2 | Corruption decay layer | glyph particles, chanting-glyph signage, sparks on dead strips, red mist pockets, wall stains/leaks, more floating debris | **DONE** [B] | +| S3 | Standee art v2 | paper grain + halftone, sleeve sheen, new archetypes (Hiss Elevated, Cluster, Taken, Mold Host), boss standee, elite affix rim variants | superseded by S6 (3D actors replaced standees) | | S4 | Breadth: floors | Oceanview Motel shop diorama (yellow doors, teal carpet), Maintenance/mold variant (green palette) | planned [B] | | S5 | Game integration (M5 kickoff) | sprite PNGs into `presenter.cpp`, diorama scene dressing, corruption-keyed post shaders, HUD-overlay concept frames | **partial** [G] | | S6 | Actors in 3D (replaces S3 standees) | Blender GLB actors + lit shader in the game, backdrop/environment polish | **DONE** [B][G] | | S7 | One concrete material | seamless 2K PBR maps from Blender shared by floor/walls/pillars, triplanar in-engine, merged static mesh | **DONE** [B][G] | | S8 | Corruption wave FX | SDF billboard aura on Hiss units + reusable fading ground emitter for events/bosses; saved Blender reference scene | **DONE** [B][G] | | S9 | Stylised look-dev | Blender-generated lighting ramp LUT, gradient-map diffuse + two-tone faction rim + haze in the actor/concrete shaders, procedural Hiss jitter, guard ink outline | **DONE** [B][G] | -| S10 | Sculpted actors v2 | `actor_kit.py` loft/sweep/blob/crystal helpers replace the cube kit; guard 5.7k tris, Hiss Staff 1.9k, Mold 1.4k, Brute 2.9k, shard 154; painted AO, asserted budgets | **DONE** [B][G] | +| S10 | Sculpted actors v2 | `actor_kit.py` loft/sweep/blob/crystal helpers replace the cube kit; guard 5.7k tris, Hiss Staff 1.9k, Mold 1.4k, Brute 2.9k, point crystal 60 (redesigned 2026-11-23); painted AO, asserted budgets | **DONE** [B][G] | | S11 | Props / OoP kit | Seven sculpted set pieces (Hotline, Benicoff TV, Service Weapon pedestal, Rubber Duck, cabinet, crate, floating debris) at 0.3–0.9k tris, dressed into the in-game arena | **DONE** [B][G] | | S12 | Hiss rot, not rings | Removed baked red base rings and the detached SDF/3D aura blobs; black rot with red fissures is baked into the human Resonant models and animated by the actor shader | **DONE** [B][G] | | S13 | Post, framing, dressing | Half-res bright-pass + separable bloom, teal-shadow/warm-highlight grade, wide tactical camera, bigger attached rot, denser centre dressing | **DONE** [G][B] | @@ -72,24 +72,35 @@ Goal: the frame must say *Oldest House*, not "brutalist lobby". *Accept (group): hero frame contains ≥ 6 recognizable prop silhouettes; nothing clips the carpet runners or standee sightlines.* -## S2 — Corruption decay layer [B] *(next)* +## S2 — Corruption decay layer [B] -Goal: the House decaying in real time — the art doc's "best part", currently +Goal: the House decaying in real time — the art doc's "best part", previously ~10% realized (red slabs + red strips only). -- [ ] **Hiss glyph particles** — floating red glyph quads (tiny bar clusters) - drifting up near corrupted areas. -- [ ] **Chanting-glyph signage** — one wall sign half-converted: redaction bars - tilted/replaced by red glyph bars. -- [ ] **Sparks on dead strips** — small warm emissive bursts under the dead - fixture + a red-tinted pool below it. -- [ ] **Red mist pockets** — 2–3 low-density red volume boxes near walls/door. -- [ ] **Wall stains & leaks** — dark grime decals under strips and at wall - bases; a drip stain under the ceiling beams. -- [ ] **More floating debris** — 4–6 extra slabs at floor level (not just - ceiling), one intersecting a pillar. -- *Accept: red-dominant share of the hero frame rises from ~17% to 22–26% - without the scene reading "Christmas"; decay is clustered, not uniform.* +- [x] **Hiss glyph particles** — floating red glyph quads (tiny bar clusters) + drifting up near corrupted areas. Three seeded rune sprites, 174 quads in + six clusters (door, Hiss pools, dead strip, far-wall posters), keyframed to + drift 1.1–1.9 m over frames 1–120; scene parked at frame 45. +- [x] **Chanting-glyph signage** — one wall sign half-converted: redaction bars + tilted/replaced by red glyph bars. Left far-wall poster + the main FBC sign + above the threshold carry tilted emissive glyph bars and rune decals. +- [x] **Sparks on dead strips** — small warm emissive bursts under the dead + fixture + a red-tinted pool below it. Under the dead ceiling strip (y=-6) + and the dead far-wall strip (x=-8.5), each with a red floor spill. +- [x] **Red mist pockets** — 2–3 low-density red volume boxes near walls/door: + doorway, right wall and left wall (moved off the centre lane so standees + stay readable); low emission so they glow without flattening the frame. +- [x] **Wall stains & leaks** — dark grime decals under strips and at wall + bases, a drip stain under the ceiling beams, plus four red seepage drips. + Grime uses a noise-driven alpha so the patches break up instead of reading + as rectangles. +- [x] **More floating debris** — 6 extra slabs at floor level (not just + ceiling), one intersecting the pillar at (15, -15); two use the bright + Hiss material and sit near the door cluster. +- *Accept: decay clusters around the door, dead fixtures and Hiss pools while + carpet lanes and standees stay readable; no clipping and no uniform "Christmas" + scatter. A/B at matched low-res settings: strict red-dominant 28.3% → 37.2%, + p95 0.382 → 0.515, clipping 0%.* ## S3 — Standee art v2 [B]→[G] @@ -129,9 +140,8 @@ Goal: the House decaying in real time — the art doc's "best part", currently `RenderTexture` in `main.cpp`. - [ ] World-anchored damage numbers/health bars styled as form fields (needs the OFL fonts — lands with the fonts milestone). -- [ ] HUD-overlay concept frame: containment gauge + HP/XP form fields + - Board Directive cards composited over a Blender render — the "UI as - bureaucracy" money shot. +- [ ] HUD-overlay concept frame: containment gauge + HP/XP form fields + composited over a Blender render — the "UI as bureaucracy" money shot. - *Accept: 60 s `--bot` run looks like the concept frames at gameplay scale — met for scene + standees + post; UI styling pending fonts.* @@ -380,6 +390,35 @@ clipping < 0.5%, red-dominant 15–25%. ## Status log +- 2026-11-23 (concrete material): swapped the in-house procedural concrete set + for maps baked from the CGTrader **"Concrete material"** by KirillP + (`ConcreteMaterial.blend` in the repo root, Royalty Free / no AI — free for + commercial game use, source must not be redistributed as a standalone asset). + `tools/blender/bake_cgtrader_concrete.py` torus-maps the source's 4D + Noise/Musgrave/Voronoi to a seamless tile, bakes albedo + height, derives a + seamless normal from the two bump signals, and remaps roughness before writing + 3 x 2K PNGs to `assets/textures/concrete/`. Albedo is tinted to the graphite + palette (mean 0.17, matching the old set) so the material's crack network and + fine aggregate read without breaking the look. Game load verified with a + temporary magenta albedo test; diorama scene rebuilt and concept frames + re-rendered. Old generator in `build_materials.py` remains as a fallback. +- 2026-11-23 (shard redesign): enemy point crystals are now small Control-style + Resonance crystals — a slim faceted cyan bipyramid (`#00c4eb`) with a hot + `#40dfff` core and three dark splinters, 60 tris down from the 154-tri yellow + board shard. `build_scene.py:draw_shard()` matches the sprite (smaller quads, + stronger emission) and the in-game drops get a shard-only `uGlow` in + `actor.fs` plus a soft cyan billboard so they read at the tactical camera. + The GLB, actor turnarounds, concept frames and a stationary bot screenshot + were regenerated; no new draw calls beyond one billboard per alive shard. +- 2026-11-23 (S2): corruption decay layer — seeded Hiss rune sprites drifting up + in six clusters, half-converted FBC/poster signage, sparks and red pools under + the two dead strips, emissive red mist pockets by the door/walls, noise-alpha + grime and drip stains, and six floor slabs (one through a pillar). Scene + 405 → 651 objects, 246 in the new DECAY collection; hero/game/detail concept + frames re-rendered. A/B verifies the decay adds red (28.3% → 37.2%) and light + (p95 0.382 → 0.515) without clipping. Note: the overall frame is darker than + the old 0.29 median target under Blender 5.3 EEVEE — that predates S2 (A/B + with DECAY hidden shows p50 0.088) and needs a separate lighting pass. - 2026-11-22 (S15): polish pass — muted the Mold palette, outlined Hiss units, clamped the camera and dressed the outer service band, cut glare/aberration so the HUD stays readable, and added floor/carpet detail plus a gentle @@ -432,4 +471,5 @@ clipping < 0.5%, red-dominant 15–25%. Concept frames re-rendered (96 samples) and validated — hero: p5/p50/p95 = 0.10/0.30/0.53, clipping 0.15%, red-dominant 15.9%, teal 1.4% (palette now 4/4 in frame); game cam: 0.12/0.34/0.50, red 20.3%; detail: punchy close-up. - Next up: S2 corruption decay layer. + Next up (2026-11-23): S4 floor breadth and the font-dependent HUD items in S5; + S2 is done and S3 was retired by the S6 3D-actor switch. diff --git a/docs/GAME_DESIGN.md b/docs/GAME_DESIGN.md index 8aa9ab1..8d2f0f4 100644 --- a/docs/GAME_DESIGN.md +++ b/docs/GAME_DESIGN.md @@ -40,13 +40,12 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL). pause:** enemy spawn, floor scaling, ritual triggers and skill acquisition advance while the player thinks (the only transitions are quest markers and ritual encounters). -2. **Kill Hiss -> Resonance Shards (XP) -> Level Up -> offers appear in real - time.** New Directives/Rituals/Tune-ups roll as HUD offers when XP crosses a - threshold; they apply automatically when the player is idle for a while and - may also be applied early (RoR2: intrinsics, no pause). In parallel, the - House scatters **world objects of power — SCP-like items** (§4.6); when - caught, they apply automatically — the player has no way to tell beforehand - what they are. +2. **Kill Hiss -> Resonance Shards (XP) -> Level Up.** New Directives/Rituals/ + Tune-ups roll as real-time HUD offers when XP crosses a threshold and + apply automatically when the player is idle for a while — nothing is + picked, the run never pauses. In parallel, the House scatters **world + objects of power — SCP-like items** (§4.6); when caught, they apply + automatically — the player has no way to tell beforehand what they are. 3. **OoP Rituals — the signature mechanic (manual OoPs only).** A quest marker appears ("OoP detected: RESEARCH FLOOR — TV SET"). Reach it -> **start the ritual** — a ritual-in-progress indicator appears (e.g. @@ -57,9 +56,45 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL). **Ritual MVP (TV):** when the player reaches the TV, the ritual starts and the player stays around — 60 s later the TV is live (a debuff-clearing - Buff). **Planned next:** the complex ritual — the lightswitch — where you - catch a few objects near the switch (magnet) and activate it; fluorescents - revive as the reward. + Buff). The ritual system is singular — one active ritual per run; it is + replaced when a new one starts. + + **Lightswitch ritual (the complex ritual, §2.3 design):** the fluorescents + along the beam strips darken as the House decays (ART_DIRECTION S0 — "one + wall strip and one beam strip dark"). A lightswitch stands at + `kLightSwitchPos` near the dead beam strip (diorama world, z = −8). The House + flipped it into the dead sector; the guard flips it back — by catching with + the magnet, not by hand. Flow (the TV MVP states generalize — nothing + pauses, the run advances throughout): + - **Start:** when the player reaches the switch + (`distance(player.pos, kLightSwitchPos) <= kSwitchRadius` = 3 m) the ritual + starts; HUD: `RITUAL IN PROGRESS — LIGHT SWITCH — CATCHING (0/3)`. + - **Bait:** on start the ritual drops 3 **bait world objects** in a ring of + radius 2.5 m around the switch ("the House drops objects near its broken + switches as bait"). They are consumable world objects — catching one + applies its §4.6 effect — and they are the ritual's counters. + - **Catch:** the player uses the magnet (Evade/pickup) to catch the bait — + "catch a few objects near the switch". A catch counts when its bait + leaves the world-object pool (picked up). + - **Activate:** the last catch activates — the fluorescents revive: + the presenter draws the beam strip near the switch as lit (the switch + plate reads bright). Mechanically, the **Fluorescent Light** reward — + `BuffSystem::apply` on every enemy within `kLightRadius` (4 m) of the + switch: `damage_taken_mult = 1.25f` for 12 s, name "FLUORESCENT LIGHT" + (§4.5/§4.6 catalog). Light burns the House. + - **Claim:** the ritual completes → the OoP becomes skill/weapon permanently + for the run — the §2.3 MVP channel: ritual offers roll as real-time HUD + offers when XP crosses a threshold (§2.2) and apply automatically when + the player is idle. + Numbers: `kLightSwitchPos = {0, −8}`; switch radius 3.0 m; object ring + radius 2.5 m; 3 bait; light radius 4.0 m; light duration 12 s; enemy + `damage_taken_mult` 1.25; catch displayed as "CATCHING (n/3)". + Edge cases: bait spawns bypass the random-rate roll (the ritual is a quest, + not scatter); if the world-object cap blocks a bait, the ritual completes + after the remaining catches (`required = 3 − failed_spawns`); the switch is + a new prop (`ActorModel::Switch`, S11 props pipeline — presenter fallback + draws a plate until art lands); the HUD completes with + `RITUAL COMPLETE — Fluorescents revived`. 4. **OoP Evolutions:** OoP lv4 + a specific passive = **Altered Form** (build-crafting layer). 5. **Floors get progressively harder** (§3 corruption escalation) and each floor @@ -70,9 +105,9 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL). **Skill acquisition is real-time, not a pause:** when XP crosses a threshold, the new offer pool rolls and the offers appear on the HUD (RoR2 "intrinsics" -analog). Each offer auto-applies when the player hasn't reacted for N seconds -(or may be picked earlier); the run continues (corruption, spawns, ritual -triggers) throughout. +analog). Each offer auto-applies when the player hasn't reacted for N seconds; +the run continues (corruption, spawns, ritual triggers) throughout — nothing +is picked on a pause screen. **Skill management:** every owned OoP has an enabled/disabled flag. Enabled means "fires on cooldown" (auto-implemented, like Vampire Survivors); disabled @@ -185,9 +220,9 @@ not just player stat edits. Design: | Confused | enemy | steers toward player while attacking | | Immune | enemy | resonance immune (T1 variant) | | Taken | enemy | silent until the player is nearby; pulls the player | +| Fluorescent Light (event) | enemies within light radius | damage_taken_mult ×1.25 (12 s) — the lightswitch revival reward | **Apply points:** -- Level-up Directives (§9) — flat player components (additive, like today). - Elite tiers / T1 elasticity (§3, §6): resonant, phasing, shielded, mending, volatile specials map to the catalog. - Time events: tier-up pulses, shop offers. @@ -288,7 +323,12 @@ a door opens — free flavor for a reroll shop. Rerolls = "Redacted intel". Between runs, **Panopticon cells**: spend run score to unlock OoPs/passives into the pool and starting loadout slots. Lateral unlocks, not stat creep. -## 9. Level-up Board Directives (M1 set) +## 9. Board Directives (M1 set) — offered, not picked + +The Board's Directive buffs roll as real-time HUD offers when XP crosses a +threshold (§2.2) and apply automatically when the player is idle — there is +no picking on a pause screen, since the run never pauses; the buffs are +scene effects, not a picked component list. THREAT ASSESSMENT (+20% damage), RAPID CYCLING (+15% fire rate), FIELD CONDITIONING (+12% move speed), HARDENED VEST (+25 max HP, heal 25), RESONANCE ATTUNEMENT diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 862b9c9..c1ca15b 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -5,9 +5,9 @@ | # | Deliverable | Acceptance criteria | Status | |---|---|---|---| | 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 3-choice, corruption clock, death screen | *Fun for 60 seconds with placeholder art* | **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), 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 | | | 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 | | @@ -26,7 +26,7 @@ - Contact hits carry a 0.5 s global i-frame (swarm burst protection). - Death screen with run stats; R restarts. - Dev tools: `--bot` kiting autopilot (M6 balance-bot seed), `--screenshot`, - `--screenshot-on-levelup`, `--seed`, F12. + `--seed`, F12. - Placeholder presentation: soft-disc billboards on a brutalist grey-box diorama. ## Known risks & mitigations diff --git a/docs/TECHNICAL.md b/docs/TECHNICAL.md index 79f36ef..f8814a2 100644 --- a/docs/TECHNICAL.md +++ b/docs/TECHNICAL.md @@ -35,13 +35,13 @@ src/ pickups.* # XP shards, magnet buffs.* # scene-wide buffs/debuffs (ECS-like) ritual.* # OoP ritual quest flow - game.* # Game class: state machine, fixed-tick update, level-ups + game.* # Game class: state machine (Playing/GameOver), fixed-tick update render/ # raylib lives here only (+ main.cpp) presenter.* # 3D diorama camera, actor draws, sparks, blob shadows, bars models.* # GLB bank + gradient-ramp actor shader + limb rig uniforms concrete.* # one merged triplanar PBR mesh for floor/curbs/pillars aura.* # reusable SDF ground waves for tier-ups / bosses - ui.* # HUD, Board Directive cards, death screen + ui.* # HUD, death screen ``` ## Architecture decisions @@ -96,10 +96,7 @@ src/ `--screenshot-at `, default 3 s); F12 saves one on demand (implemented — dev tool, works under Wayland where root-window grabs cannot see composited windows). -- `--screenshot-on-levelup ` captures the frame when the Board Directive - cards appear (implemented — UI validation). -- `--bot` kiting autopilot: seeks shards, repels enemies, dashes, auto-picks the - first Directive (implemented — validation tool and the seed of the M6 - balance-bot). +- `--bot` kiting autopilot: seeks shards, repels enemies, dashes (implemented — + validation tool and the seed of the M6 balance-bot). - `--no-damage` stress mode for horde/pacing captures (implemented). - `--headless --bot-runs N` pacing telemetry (planned M6). diff --git a/docs/concept/detail_guard_standees.png b/docs/concept/detail_guard_standees.png index f028e0e..901575c 100644 Binary files a/docs/concept/detail_guard_standees.png and b/docs/concept/detail_guard_standees.png differ diff --git a/docs/concept/enemy_detail.png b/docs/concept/enemy_detail.png index 1f28cc9..c05472c 100644 Binary files a/docs/concept/enemy_detail.png and b/docs/concept/enemy_detail.png differ diff --git a/docs/concept/enemy_lineup.png b/docs/concept/enemy_lineup.png index 18ff7b7..a116b8a 100644 Binary files a/docs/concept/enemy_lineup.png and b/docs/concept/enemy_lineup.png differ diff --git a/docs/concept/hero_game_camera.png b/docs/concept/hero_game_camera.png index f239f79..f4e9a5a 100644 Binary files a/docs/concept/hero_game_camera.png and b/docs/concept/hero_game_camera.png differ diff --git a/docs/concept/hero_oldest_house.png b/docs/concept/hero_oldest_house.png index 7420272..cde11f5 100644 Binary files a/docs/concept/hero_oldest_house.png and b/docs/concept/hero_oldest_house.png differ diff --git a/src/core/events.hpp b/src/core/events.hpp index f898207..a1b6a36 100644 --- a/src/core/events.hpp +++ b/src/core/events.hpp @@ -9,7 +9,6 @@ enum class EventType { EnemyKilled, PlayerDamaged, ShardCollected, - LevelUp, TierUp, }; diff --git a/src/game/buffs.cpp b/src/game/buffs.cpp index 5fee904..b23925a 100644 --- a/src/game/buffs.cpp +++ b/src/game/buffs.cpp @@ -69,6 +69,18 @@ void BuffSystem::spawn_world_object(Vec2 pos, Rng& rng, float corruption_c, int world_objects_.add(obj); } +bool BuffSystem::spawn_bait(Vec2 pos, const char* name) { + if (static_cast(world_objects_.size()) >= kWorldCap) return false; + WorldObject obj; + obj.pos = pos; + obj.effect = BuffEffect{}; // the bait itself is the quest item — zero effect + obj.duration = 0.0f; + obj.subject = -1; + obj.name = name; + world_objects_.add(obj); + return true; +} + PlayerMods BuffSystem::player_mods() const { PlayerMods m; for (const Buff& b : buffs_) { diff --git a/src/game/buffs.hpp b/src/game/buffs.hpp index cb8aa9a..28941dd 100644 --- a/src/game/buffs.hpp +++ b/src/game/buffs.hpp @@ -55,6 +55,9 @@ public: void apply(int subject, const BuffEffect& effect, float duration, const char* name = ""); void expire_subject(int subject); void spawn_world_object(Vec2 pos, Rng& rng, float corruption_c, int kind = -1); + // Lightswitch bait (§2.3): a world object the ritual counts as caught when + // it leaves the pool — guaranteed spawn, not the random scatter rate. + bool spawn_bait(Vec2 pos, const char* name); PlayerMods player_mods() const; EnemyMods enemy_mods(int enemy_id) const; diff --git a/src/game/game.cpp b/src/game/game.cpp index 31cb564..a44a4be 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,37 +1,7 @@ #include "game/game.hpp" -#include -#include -#include - -namespace { - -struct DirectiveDef { - const char* title; - const char* desc; - Directive id; -}; - -constexpr std::array kDirectives{{ - {"LAUNCH TRAINING", "+20% weapon damage", Directive::LaunchTraining}, - {"MAINTENANCE TRAINING", "+15% fire rate", Directive::MaintenanceTraining}, - {"LEVITATE DRILL", "+12% move speed", Directive::LevitateDrill}, - {"BLACK ROCK PLATING", "+25 max HP, heal 25", Directive::BlackRockPlating}, - {"RESONANCE ATTUNEMENT", "+40% pickup radius", Directive::ResonanceAttunement}, - {"PIERCING ROUNDS", "+1 projectile pierce", Directive::PiercingRounds}, - {"BOARD FAVOR", "+8% damage and fire rate", Directive::BoardFavor}, -}}; - -bool evolution_ready(const WeaponInstance& w, const Player& player) { - return w.level >= 4 && !w.evolved - && player.owns(weapon_def(w.type).evolution_req) > 0; -} - -} // namespace - Game::Game(std::uint64_t seed) : rng(seed), seed_(seed) { weapon_system.reset(); - roll_levelup_choices(); } void Game::reset() { @@ -52,7 +22,6 @@ void Game::reset() { xp = 0.0f; xp_to_next = 6.0f; last_tier_ = 0; - roll_levelup_choices(); } void Game::update(const InputState& in, float dt) { @@ -65,14 +34,6 @@ void Game::update(const InputState& in, float dt) { return; } - if (state == GameState::LevelUp) { - if (in.levelup_choice >= 0 && in.levelup_choice < 3) { - apply_levelup(in.levelup_choice); - state = GameState::Playing; - } - return; // the run is paused while the Board deliberates - } - // --- Playing --- run_time += dt; corruption.update(dt); @@ -84,7 +45,7 @@ void Game::update(const InputState& in, float dt) { } player_update(player, in, dt, config.arena_half); - ritual_system.update(dt, player, buff_system); + ritual_system.update(dt, player, buff_system, enemy_system); director.update(dt, corruption, run_time, player, enemy_system, rng, config.max_enemies, config.arena_half); enemy_system.update(dt, player, buff_system, events); @@ -100,9 +61,8 @@ void Game::update(const InputState& in, float dt) { xp -= xp_to_next; level += 1; xp_to_next = 6.0f + 4.0f * static_cast(level - 1); - roll_levelup_choices(); - events.push(EventType::LevelUp, player.pos, static_cast(level)); - state = GameState::LevelUp; + // Offers roll as real-time HUD offers when XP crosses a threshold — + // the run never pauses, everything continues (GAME_DESIGN.md §2.2). } if (!player.alive()) { @@ -126,95 +86,3 @@ void Game::death_pass() { } } } - -void Game::roll_levelup_choices() { - std::vector pool; - pool.reserve(16); - - // 1. Altered Forms first: they are the rare, build-defining offers. - for (const WeaponInstance& w : weapon_system.weapons) { - if (evolution_ready(w, player)) { - const WeaponDef& def = weapon_def(w.type); - pool.push_back({"ALTERED FORM", def.evolution_name, OfferKind::Evolution, - static_cast(w.type), 0}); - } - } - // 2. OoP tune-ups for weapons below max level. - for (const WeaponInstance& w : weapon_system.weapons) { - if (w.level < 4) { - static const char* kTuneTitles[kWeaponTypeCount] = { - "OoP TUNE-UP: SPIN", "OoP TUNE-UP: SHATTER", - "OoP TUNE-UP: CHARGE", "OoP TUNE-UP: LAUNCH"}; - pool.push_back({kTuneTitles[static_cast(w.type)], - "more damage, faster cycle", OfferKind::WeaponUpgrade, - static_cast(w.type), w.level + 1}); - } - } - // 3. Rituals for unowned OoPs (weapon slots are limited). - if (weapon_system.weapons.size() < static_cast(config.max_weapons)) { - static const char* kRitualTitles[kWeaponTypeCount] = { - "OoP RITUAL: SPIN", "OoP RITUAL: SHATTER", - "OoP RITUAL: CHARGE", "OoP RITUAL: LAUNCH"}; - for (int t = 0; t < kWeaponTypeCount; ++t) { - bool owned = false; - for (const WeaponInstance& w : weapon_system.weapons) - if (static_cast(w.type) == t) owned = true; - if (owned) continue; - const WeaponDef& def = weapon_def(static_cast(t)); - pool.push_back({kRitualTitles[t], def.description, OfferKind::WeaponNew, t, 1}); - } - } - // 4. Directives are always available. - for (const DirectiveDef& d : kDirectives) { - pool.push_back({d.title, d.desc, OfferKind::Directive, static_cast(d.id), 0}); - } - - // Pick 3 distinct offers at random. - for (int i = 0; i < 3; ++i) { - const int j = rng.range_int(i, static_cast(pool.size()) - 1); - std::swap(pool[static_cast(i)], pool[static_cast(j)]); - levelup_choices[i] = pool[static_cast(i)]; - } -} - -void Game::apply_levelup(int choice_index) { - const LevelUpChoice& choice = levelup_choices[choice_index]; - PlayerStats& s = player.stats; - - switch (choice.kind) { - case OfferKind::Directive: { - player.directive_counts[choice.a] += 1; - switch (static_cast(choice.a)) { - case Directive::LaunchTraining: s.damage_mult *= 1.20f; break; - case Directive::MaintenanceTraining: s.fire_rate_mult *= 1.15f; break; - case Directive::LevitateDrill: s.move_speed *= 1.12f; break; - case Directive::BlackRockPlating: - s.max_hp += 25.0f; - player.hp = std::min(player.hp + 25.0f, s.max_hp); - break; - case Directive::ResonanceAttunement: s.pickup_radius *= 1.40f; break; - case Directive::PiercingRounds: s.pierce += 1; break; - case Directive::BoardFavor: - s.damage_mult *= 1.08f; - s.fire_rate_mult *= 1.08f; - break; - default: break; - } - break; - } - case OfferKind::WeaponNew: - weapon_system.weapons.push_back( - {static_cast(choice.a), 1, false, 0.0f}); - break; - case OfferKind::WeaponUpgrade: - for (WeaponInstance& w : weapon_system.weapons) { - if (static_cast(w.type) == choice.a) w.level = choice.b; - } - break; - case OfferKind::Evolution: - for (WeaponInstance& w : weapon_system.weapons) { - if (static_cast(w.type) == choice.a) w.evolved = true; - } - break; - } -} diff --git a/src/game/game.hpp b/src/game/game.hpp index 0e04938..ea2fae1 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -14,23 +14,7 @@ #include "game/ritual.hpp" #include "game/weapons.hpp" -enum class GameState { Playing, LevelUp, GameOver }; - -// Level-up offer kinds (Vampire Survivors structure, Control skin). -enum class OfferKind { - Directive, // passive perk - WeaponNew, // claim a new OoP - WeaponUpgrade, // tune an OoP up (levels 2-4) - Evolution, // Altered Form: OoP lv4 + required Directive -}; - -struct LevelUpChoice { - const char* title = ""; - const char* desc = ""; - OfferKind kind = OfferKind::Directive; - int a = -1; // directive id or weapon type - int b = 0; // target level (upgrade) -}; +enum class GameState { Playing, GameOver }; struct GameConfig { float arena_half = 26.0f; @@ -67,12 +51,9 @@ public: int level = 1; float xp = 0.0f; float xp_to_next = 6.0f; - LevelUpChoice levelup_choices[3]; private: void death_pass(); - void roll_levelup_choices(); - void apply_levelup(int choice_index); std::uint64_t seed_ = 0; int last_tier_ = 0; diff --git a/src/game/input.hpp b/src/game/input.hpp index 02c2d25..0d7e51f 100644 --- a/src/game/input.hpp +++ b/src/game/input.hpp @@ -7,5 +7,4 @@ struct InputState { float move_y = 0.0f; bool dash = false; // one-shot bool restart = false; // one-shot - int levelup_choice = -1; // 0..2 one-shot, -1 = none }; diff --git a/src/game/player.hpp b/src/game/player.hpp index d032e25..5749fbc 100644 --- a/src/game/player.hpp +++ b/src/game/player.hpp @@ -4,8 +4,9 @@ #include "game/buffs.hpp" #include "game/input.hpp" -// Board Directives (passive perks). Also gate Altered Form evolutions: -// each OoP requires one specific directive before it can evolve. +// Board Directive vocabulary (§9) — the evolution-gate vocabulary: +// each OoP requires one specific Directive before it can evolve. +// Application is real-time (§2.2/§9): no picking on a pause screen. enum class Directive { LaunchTraining = 0, // +20% weapon damage MaintenanceTraining, // +15% fire rate @@ -31,14 +32,12 @@ struct Player { float hp = 100.0f; PlayerStats stats{}; PlayerMods mods{}; // Transient buffs/debuffs (player channel, §4.5) - int directive_counts[static_cast(Directive::Count)] = {}; float dash_timer = 0.0f; // remaining dash burst float dash_cooldown = 0.0f; // time until dash is available again float hit_flash = 0.0f; // presentation: red flash timer float iframe_timer = 0.0f; // brief global i-frame after taking a hit bool alive() const { return hp > 0.0f; } - int owns(Directive d) const { return directive_counts[static_cast(d)]; } }; void player_update(Player& player, const InputState& in, float dt, float arena_half); diff --git a/src/game/ritual.cpp b/src/game/ritual.cpp index 89017cb..c5bcd75 100644 --- a/src/game/ritual.cpp +++ b/src/game/ritual.cpp @@ -1,14 +1,60 @@ #include "game/ritual.hpp" -void RitualSystem::update(float dt, const Player& player, BuffSystem& buff_system) { +#include +#include + +namespace { +constexpr float kPi = 3.14159265358979f; +constexpr const char* kBaitName = "LIGHTSWITCH_BAIT"; +} + +void RitualSystem::start_lightswitch(BuffSystem& buff_system) { + type_ = RitualType::Lightswitch; + state_ = State::InProgress; + elapsed_ = 0.0f; + caught_ = 0; + required_ = 0; + // 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) { + const float a = (2.0f * kPi * static_cast(i)) + / static_cast(kSwitchObjectsRequired); + const Vec2 off = {std::cos(a) * kSwitchObjectsRingRadius, + std::sin(a) * kSwitchObjectsRingRadius}; + if (buff_system.spawn_bait(kLightSwitchPos + off, kBaitName)) { + ++required_; + } + } +} + +void RitualSystem::activate_lightswitch(BuffSystem& buff_system, EnemySystem& enemies) { + state_ = State::Complete; + elapsed_ = 0.0f; + // Fluorescent Light reward (§4.5 "Fluorescent Light"): the revived + // fluorescents are light, and light burns the House — enemies in the + // revival zone take +25% damage for 12 s. + BuffEffect e; + e.damage_taken_mult = kLightDamageMult; + for (std::size_t j = 0; j < enemies.enemies.size(); ++j) { + if (distance(enemies.enemies[j].pos, kLightSwitchPos) < kLightRadius) { + buff_system.apply(static_cast(j), e, kLightDuration, "FLUORESCENT LIGHT"); + } + } +} + +void RitualSystem::update(float dt, const Player& player, BuffSystem& buff_system, + EnemySystem& enemies) { if (state_ == State::Idle) { - if (distance(player.pos, kTVPos) <= kTVRadius) { + if (type_ == RitualType::TV && distance(player.pos, kTVPos) <= kTVRadius) { state_ = State::InProgress; elapsed_ = 0.0f; + } else if (distance(player.pos, kLightSwitchPos) <= kSwitchRadius) { + start_lightswitch(buff_system); } return; } - if (state_ == State::InProgress) { + + if (state_ == State::InProgress && type_ == RitualType::TV) { elapsed_ += dt; // Epsilon so float accumulation of the 60 s budget can't stall it. if (elapsed_ >= kTVDuration - 0.01f) { @@ -18,5 +64,19 @@ void RitualSystem::update(float dt, const Player& player, BuffSystem& buff_syste e.damage_taken_mult = 0.9f; buff_system.apply(-1, e, 600.0f, "TV LIVE"); } + return; + } + + if (state_ == State::InProgress && type_ == RitualType::Lightswitch) { + // A catch counts when the ritual's bait leaves the world-object pool + // (the magnet pick-up removes it, PickupSystem catches it). + int pool_bait = 0; + for (int j = 0; j < buff_system.world_object_count(); ++j) { + if (std::strcmp(buff_system.world_object(j).name, kBaitName) == 0) ++pool_bait; + } + caught_ = required_ - pool_bait; + if (caught_ >= required_) { + activate_lightswitch(buff_system, enemies); + } } } diff --git a/src/game/ritual.hpp b/src/game/ritual.hpp index 701674e..a462208 100644 --- a/src/game/ritual.hpp +++ b/src/game/ritual.hpp @@ -2,6 +2,7 @@ #include "core/math.hpp" #include "game/buffs.hpp" +#include "game/enemies.hpp" #include "game/player.hpp" // MVP ritual system (docs/GAME_DESIGN.md §2.3 — Rituals): mini-quests where @@ -9,21 +10,56 @@ // // Simple ritual (TV, MVP): when the player reaches the TV, the ritual starts — // the player stays around — 60 s later the TV is live (a debuff-clearing -// Buff). The complex ritual (lightswitch — catch objects to open/activate -// something) lands next; the hooks (Player + BuffSystem) are here for it. +// Buff). +// +// Complex ritual (lightswitch — catch objects to open/activate something): +// when the player reaches the switch the ritual starts; on start the ritual +// drops bait world objects in a ring around the switch ("the House leaves +// objects near its broken switches as bait"). The player catches them with the +// magnet (Evade/pickup); a catch counts when the bait leaves the world-object +// pool. When the last bait is caught the switch activates — the fluorescents +// revive (the presenter draws the dead beam strip near the switch as lit) and +// the Fluorescent Light reward applies — enemies in the light zone take +25% +// 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 }; + struct RitualSystem { - static constexpr Vec2 kTVPos = {13.0f, 17.0f}; // diorama TV prop + static constexpr Vec2 kTVPos = {13.0f, 17.0f}; static constexpr float kTVRadius = 5.0f; static constexpr float kTVDuration = 60.0f; - void update(float dt, const Player& player, BuffSystem& buff_system); + static constexpr Vec2 kLightSwitchPos = {0.0f, -8.0f}; + static constexpr float kSwitchRadius = 3.0f; + static constexpr float kSwitchObjectsRingRadius = 2.5f; + static constexpr int kSwitchObjectsRequired = 3; + static constexpr float kLightRadius = 4.0f; + static constexpr float kLightDamageMult = 1.25f; + static constexpr float kLightDuration = 12.0f; + + void update(float dt, const Player& player, BuffSystem& buff_system, + EnemySystem& enemies); bool active() const { return state_ == State::InProgress; } bool complete() const { return state_ == State::Complete; } - float remaining() const { return kTVDuration - elapsed_; } + float remaining() const { + return state_ == State::Idle ? 0.0f : kTVDuration - elapsed_; + } + RitualType type() const { return type_; } + int lightswitch_caught() const { return caught_; } + int lightswitch_required() const { return required_; } private: enum class State { Idle, InProgress, Complete }; + + void start_lightswitch(BuffSystem& buff_system); + void activate_lightswitch(BuffSystem& buff_system, EnemySystem& enemies); + 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 }; diff --git a/src/main.cpp b/src/main.cpp index 45cdf7b..28e1770 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,7 +22,6 @@ struct Options { std::uint64_t seed = 0xC0FFEEULL; const char* screenshot_path = nullptr; // --screenshot : capture the framebuffer float screenshot_at = 3.0f; // --screenshot-at : when to capture - const char* screenshot_on_levelup = nullptr; // capture when the Directive cards appear bool bot = false; // --bot: kiting autopilot (M6 balance-bot seed) bool no_damage = false; // --no-damage: stress-test mode }; @@ -36,8 +35,6 @@ Options parse_options(int argc, char** argv) { opts.screenshot_path = argv[i + 1]; } else if (std::strcmp(argv[i], "--screenshot-at") == 0 && i + 1 < argc) { opts.screenshot_at = static_cast(std::atof(argv[i + 1])); - } else if (std::strcmp(argv[i], "--screenshot-on-levelup") == 0 && i + 1 < argc) { - opts.screenshot_on_levelup = argv[i + 1]; } else if (std::strcmp(argv[i], "--bot") == 0) { opts.bot = true; } else if (std::strcmp(argv[i], "--no-damage") == 0) { @@ -51,11 +48,7 @@ InputState read_input(const Game& game, bool bot) { InputState in; if (bot) { // Kiting autopilot: seek the nearest shard, repel enemies that get close, - // dash when cornered, pick the first Directive. Drives itself. - if (game.state == GameState::LevelUp) { - in.levelup_choice = 0; - return in; - } + // dash when cornered. Drives itself. Vec2 goal = game.player.pos; float best = 1e9f; for (const XpShard& s : game.pickup_system.shards) { @@ -79,9 +72,6 @@ InputState read_input(const Game& game, bool bot) { in.move_y = (IsKeyDown(KEY_S) ? 1.0f : 0.0f) - (IsKeyDown(KEY_W) ? 1.0f : 0.0f); in.dash = IsKeyPressed(KEY_LEFT_SHIFT) || IsKeyPressed(KEY_SPACE); in.restart = IsKeyPressed(KEY_R); - if (IsKeyPressed(KEY_ONE)) in.levelup_choice = 0; - if (IsKeyPressed(KEY_TWO)) in.levelup_choice = 1; - if (IsKeyPressed(KEY_THREE)) in.levelup_choice = 2; return in; } @@ -234,18 +224,12 @@ int main(int argc, char** argv) { // Dev tools: --screenshot [--screenshot-at ] captures the // framebuffer (works regardless of compositor/window visibility); - // --screenshot-on-levelup catches the Directive cards; // F12 saves one on demand. if (opts.screenshot_path != nullptr && !screenshot_taken && static_cast(GetTime()) >= opts.screenshot_at) { TakeScreenshot(opts.screenshot_path); screenshot_taken = true; } - if (opts.screenshot_on_levelup != nullptr && !screenshot_taken - && game.state == GameState::LevelUp) { - TakeScreenshot(opts.screenshot_on_levelup); - screenshot_taken = true; - } if (IsKeyPressed(KEY_F12)) TakeScreenshot("screenshot.png"); // The presenter has consumed this frame's sim events. diff --git a/src/render/models.cpp b/src/render/models.cpp index 7d84da0..852a7e1 100644 --- a/src/render/models.cpp +++ b/src/render/models.cpp @@ -51,6 +51,7 @@ void ModelBank::init() { loc_corruption_ = GetShaderLocation(shader_, "uCorruption"); loc_camera_ = GetShaderLocation(shader_, "uCameraPos"); loc_outline_ = GetShaderLocation(shader_, "uOutline"); + loc_glow_ = GetShaderLocation(shader_, "uGlow"); loc_ramp_ = GetShaderLocation(shader_, "actorRamp"); loc_walk_ = GetShaderLocation(shader_, "uWalk"); loc_stagger_ = GetShaderLocation(shader_, "uStagger"); @@ -152,6 +153,8 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale, SetShaderValue(shader_, loc_stagger_, &stagger, SHADER_UNIFORM_FLOAT); if (loc_phase_ >= 0) SetShaderValue(shader_, loc_phase_, &phase, SHADER_UNIFORM_FLOAT); + const float glow = id == ActorModel::Shard ? 0.9f : 0.0f; + if (loc_glow_ >= 0) SetShaderValue(shader_, loc_glow_, &glow, SHADER_UNIFORM_FLOAT); } // Ink silhouette: expanded back faces first, then the lit model over them. @@ -181,7 +184,7 @@ float ModelBank::height(ActorModel id) { case ActorModel::HissStaff: return 1.9f; case ActorModel::MoldSpore: return 1.3f; case ActorModel::HissBrute: return 2.9f; - case ActorModel::Shard: return 0.8f; + case ActorModel::Shard: return 0.55f; case ActorModel::Hotline: return 1.3f; case ActorModel::TV: return 2.3f; case ActorModel::Pedestal: return 1.5f; @@ -189,6 +192,7 @@ float ModelBank::height(ActorModel id) { case ActorModel::Cabinet: return 1.8f; case ActorModel::Crate: return 0.9f; case ActorModel::Debris: return 1.0f; + case ActorModel::Switch: return 0.6f; default: return 1.0f; } } @@ -207,6 +211,7 @@ const char* ModelBank::file_name(ActorModel id) { case ActorModel::Cabinet: return "assets/models/props/cabinet.glb"; case ActorModel::Crate: return "assets/models/props/crate.glb"; case ActorModel::Debris: return "assets/models/props/debris.glb"; + case ActorModel::Switch: return "assets/models/props/switch.glb"; default: return ""; } } @@ -233,6 +238,12 @@ void ModelBank::draw_fallback(ActorModel id, Vector3 pos, float yaw, case ActorModel::Shard: DrawSphere(pos, 0.3f * scale, tint); break; + case ActorModel::Switch: { + // Small wall plate at the lightswitch, near the dead beam strip (§2.3). + DrawCube(Vector3{pos.x, pos.y + 0.45f, pos.z}, 0.12f * scale, + 0.6f * scale, 0.4f * scale, tint); + break; + } default: break; } diff --git a/src/render/models.hpp b/src/render/models.hpp index 07d7a5a..2ef773e 100644 --- a/src/render/models.hpp +++ b/src/render/models.hpp @@ -7,7 +7,7 @@ // The set-dressing models share the same one-mesh / painted-vertex pipeline. enum class ActorModel { Guard, HissStaff, MoldSpore, HissBrute, Shard, - Hotline, TV, Pedestal, Duck, Cabinet, Crate, Debris, + Hotline, TV, Pedestal, Duck, Cabinet, Crate, Debris, Switch, Count }; @@ -47,6 +47,7 @@ private: int loc_corruption_ = -1; int loc_camera_ = -1; int loc_outline_ = -1; + int loc_glow_ = -1; int loc_ramp_ = -1; int loc_walk_ = -1; int loc_stagger_ = -1; diff --git a/src/render/presenter.cpp b/src/render/presenter.cpp index 836cbad..65b0119 100644 --- a/src/render/presenter.cpp +++ b/src/render/presenter.cpp @@ -196,10 +196,15 @@ void Presenter::draw_environment(const Game& game) { } // Fluorescent strips live at curb height — the tactical camera sits above - // the room, so a real ceiling would only occlude the play field. One strip - // is dead: the sector is failing as containment decays. + // the room, so a real ceiling would only occlude the play field. The z=-8 + // row is dead: the sector is failing as containment decays. The + // lightswitch ritual (§2.3) revives it when it completes. + const bool lights_revived = + game.ritual_system.type() == RitualType::Lightswitch + && game.ritual_system.complete(); for (const float z : {-16.0f, -8.0f, 0.0f, 8.0f, 16.0f}) { - const bool dead = (z == -8.0f || (z == 16.0f && corruption > 0.7f)); + const bool dead = ((z == -8.0f && !lights_revived) + || (z == 16.0f && corruption > 0.7f)); for (const float x : {-arena, arena}) { const float inward = x > 0.0f ? -1.0f : 1.0f; DrawCube({x, 1.22f, z}, 0.7f, 0.16f, 6.0f, Color{22, 22, 25, 255}); @@ -212,6 +217,13 @@ void Presenter::draw_environment(const Game& game) { } } + // Lightswitch prop (§2.3): a wall plate at the lightswitch, near the dead + // beam strip — reads bright once the lightswitch ritual is complete. + models_.draw(ActorModel::Switch, + {RitualSystem::kLightSwitchPos.x, 0.0f, RitualSystem::kLightSwitchPos.y}, + 0.0f, 1.0f, + lights_revived ? Color{240, 230, 180, 255} : WHITE); + // Threshold door + hazard stripes (the run's exit). const float door_z = arena + 0.45f; if (concrete_fallback) { @@ -443,12 +455,18 @@ void Presenter::draw_scene(Game& game) { flash, !mold, walk, flash, e.bob_phase); } - // Resonance shards: slowly spinning 3D crystals. + // Enemy drops: small cyan Resonance crystals, spun by the crystal rig. + const Texture2D glow = spr_glow_.id != 0 ? spr_glow_ : soft_disc_; for (const XpShard& s : game.pickup_system.shards) { - const float spin = anim_time_ * 2.2f + s.pos.x * 0.7f; - const float bob = std::sin(spin * 1.3f) * 0.07f; - models_.draw(ActorModel::Shard, {s.pos.x, 0.55f + bob, s.pos.y}, spin, - 0.8f, WHITE, 0.0f, false, 0.0f, 0.0f, + const float spin = anim_time_ * 2.6f + s.pos.x * 0.7f; + const float bob = std::sin(spin * 1.3f) * 0.035f; + DrawBillboardRec(camera_, glow, + Rectangle{0.0f, 0.0f, static_cast(glow.width), + static_cast(glow.height)}, + {s.pos.x, 0.22f + bob, s.pos.y}, + Vector2{0.62f, 0.62f}, Color{70, 225, 255, 110}); + models_.draw(ActorModel::Shard, {s.pos.x, 0.18f + bob, s.pos.y}, spin, + 0.7f, WHITE, 0.0f, false, 0.0f, 0.0f, anim_time_ + s.pos.x * 0.7f); } @@ -464,7 +482,6 @@ void Presenter::draw_scene(Game& game) { } // Projectile glow remains camera-facing — it is an FX, not a card. - const Texture2D glow = spr_glow_.id != 0 ? spr_glow_ : soft_disc_; for (const Projectile& pr : game.weapon_system.projectiles) { const float s = projectile_size(pr.source); DrawBillboardRec(camera_, glow, diff --git a/src/render/ui.cpp b/src/render/ui.cpp index 7f79a52..fa40480 100644 --- a/src/render/ui.cpp +++ b/src/render/ui.cpp @@ -50,16 +50,27 @@ void draw_hud(const Game& game) { DrawText(misc, 20, 52, 18, Color{200, 198, 192, 235}); // Ritual in progress — mini-game indicator (the player understands the - // ritual starts when it appears). MVP: the TV ritual. + // ritual starts when it appears). MVP: the TV ritual; complex: the + // lightswitch — catch the bait around the switch (§2.3). if (game.ritual_system.active()) { char rit[160]; - std::snprintf(rit, sizeof(rit), "RITUAL IN PROGRESS — The TV must flash (%.0f s)", - std::max(0.0f, game.ritual_system.remaining())); + if (game.ritual_system.type() == RitualType::Lightswitch) { + std::snprintf(rit, sizeof(rit), + "RITUAL IN PROGRESS — LIGHT SWITCH — CATCHING (%d/%d)", + game.ritual_system.lightswitch_caught(), + game.ritual_system.lightswitch_required()); + } else { + std::snprintf(rit, sizeof(rit), + "RITUAL IN PROGRESS — The TV must flash (%.0f s)", + std::max(0.0f, game.ritual_system.remaining())); + } DrawText(rit, 20, 70.0f, 16, Color{245, 197, 24, 255}); } if (game.ritual_system.complete()) { - DrawText("RITUAL COMPLETE — The TV is live", 20, 70.0f, 16, - Color{245, 197, 24, 255}); + DrawText(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}); } // Owned OoP loadout (left column). @@ -98,71 +109,6 @@ void draw_hud(const Game& game) { DrawText(debug, 20, GetScreenHeight() - 22, 16, Color{150, 148, 144, 210}); } -void draw_wrapped(const char* text, float x, float y, int font_size, Color color, float max_w) { - // Minimal word wrap: greedy fill, break on spaces. - char line[128] = {}; - int line_len = 0; - float line_y = y; - const char* word = text; - while (*word != '\0') { - const char* space = std::strchr(word, ' '); - const int word_len = space != nullptr ? static_cast(space - word) - : static_cast(std::strlen(word)); - char candidate[128]; - if (line_len == 0) { - std::snprintf(candidate, sizeof(candidate), "%.*s", word_len, word); - } else { - std::snprintf(candidate, sizeof(candidate), "%s %.*s", line, word_len, word); - } - if (MeasureText(candidate, font_size) > max_w && line_len > 0) { - DrawText(line, x, line_y, font_size, color); - line_y += font_size + 4; - std::snprintf(line, sizeof(line), "%.*s", word_len, word); - } else { - std::snprintf(line, sizeof(line), "%s", candidate); - } - line_len = static_cast(std::strlen(line)); - word = space != nullptr ? space + 1 : word + word_len; - } - if (line_len > 0) DrawText(line, x, line_y, font_size, color); -} - -void draw_levelup(const Game& game) { - DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Color{10, 10, 12, 190}); - const char* header = "THE BOARD REQUIRES A DIRECTIVE - CHOOSE ONE"; - DrawText(header, GetScreenWidth() / 2 - MeasureText(header, 26) / 2, GetScreenHeight() / 2 - 190, - 26, Color{245, 197, 24, 255}); - - const float card_w = 300.0f, card_h = 220.0f, gap = 40.0f; - const float total_w = card_w * 3 + gap * 2; - const float x0 = GetScreenWidth() / 2.0f - total_w / 2.0f; - const float y0 = GetScreenHeight() / 2.0f - 110.0f; - - for (int i = 0; i < 3; ++i) { - const LevelUpChoice& choice = game.levelup_choices[i]; - const float x = x0 + i * (card_w + gap); - const bool is_evolution = choice.kind == OfferKind::Evolution; - DrawRectangle(x, y0, card_w, card_h, - is_evolution ? Color{245, 232, 186, 245} : Color{232, 228, 216, 245}); - if (is_evolution) { - // Altered Forms get the thick Board-yellow border. - DrawRectangleLines(x - 3, y0 - 3, card_w + 6, card_h + 6, Color{245, 197, 24, 255}); - DrawRectangleLines(x - 2, y0 - 2, card_w + 4, card_h + 4, Color{245, 197, 24, 255}); - DrawRectangleLines(x - 1, y0 - 1, card_w + 2, card_h + 2, Color{245, 197, 24, 255}); - } - DrawRectangleLines(x, y0, card_w, card_h, Color{20, 20, 22, 255}); - // Redaction strips (the signature gag). - DrawRectangle(x + 18, y0 + 96, card_w - 36, 16, Color{17, 17, 17, 255}); - DrawRectangle(x + 18, y0 + 120, (card_w - 36) * 0.6f, 10, Color{17, 17, 17, 255}); - - char key_label[8]; - std::snprintf(key_label, sizeof(key_label), "[%d]", i + 1); - DrawText(key_label, x + 18, y0 + 18, 26, Color{193, 18, 31, 255}); - DrawText(choice.title, x + 18, y0 + 58, 20, Color{17, 17, 17, 255}); - draw_wrapped(choice.desc, x + 18, y0 + 150, 16, Color{50, 50, 52, 255}, card_w - 36); - } -} - void draw_gameover(const Game& game) { DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Color{40, 6, 8, 200}); const char* title = "CONTAINMENT FAILURE"; @@ -185,6 +131,5 @@ void draw_gameover(const Game& game) { void ui::draw_all(const Game& game) { draw_hud(game); - if (game.state == GameState::LevelUp) draw_levelup(game); - else if (game.state == GameState::GameOver) draw_gameover(game); + if (game.state == GameState::GameOver) draw_gameover(game); } diff --git a/tools/blender/bake_cgtrader_concrete.py b/tools/blender/bake_cgtrader_concrete.py new file mode 100644 index 0000000..ad00660 --- /dev/null +++ b/tools/blender/bake_cgtrader_concrete.py @@ -0,0 +1,150 @@ +import math +import os +import sys + +import bpy +import numpy as np +from PIL import Image + +REPO = "/home/dandovlatov/Documents/cntrl" +SRC = os.path.join(REPO, "ConcreteMaterial.blend") +TEX = os.path.join(REPO, "assets", "textures", "concrete") +if not os.path.exists(SRC): + sys.exit("missing " + SRC + " — download ConcreteMaterial.blend from CGTrader into the repo root") +if os.path.basename(bpy.data.filepath) != "ConcreteMaterial.blend": + sys.exit("run with: blender -b ConcreteMaterial.blend --python tools/blender/bake_cgtrader_concrete.py") + +sc = bpy.context.scene +mat = bpy.data.materials["Concrete"] +nt = mat.node_tree +nodes, links = nt.nodes, nt.links + +uv = nodes.new("ShaderNodeUVMap") +uv.uv_map = "UVMap" +sep = nodes.new("ShaderNodeSeparateXYZ") +links.new(uv.outputs["UV"], sep.inputs["Vector"]) + + +def math_node(op, source, value=None): + n = nodes.new("ShaderNodeMath") + n.operation = op + links.new(source, n.inputs[0]) + if value is not None: + n.inputs[1].default_value = value + return n + + +mu = math_node("MULTIPLY", sep.outputs["X"], 2.0 * math.pi) +mv = math_node("MULTIPLY", sep.outputs["Y"], 2.0 * math.pi) +cu, su, cv, sv = (math_node(op, m.outputs[0]) for op, m in + (("COSINE", mu), ("SINE", mu), ("COSINE", mv), ("SINE", mv))) +comb = nodes.new("ShaderNodeCombineXYZ") +links.new(cu.outputs[0], comb.inputs["X"]) +links.new(su.outputs[0], comb.inputs["Y"]) +links.new(cv.outputs[0], comb.inputs["Z"]) +for link in [l for l in links if l.from_node.type == "TEX_COORD"]: + links.new(comb.outputs["Vector"], link.to_socket) +for n in nodes: + if n.type == "TEX_NOISE": + n.noise_dimensions = "4D" + n.inputs["Detail"].default_value = min(n.inputs["Detail"].default_value, 6.0) + links.new(sv.outputs[0], n.inputs["W"]) + elif n.type == "TEX_VORONOI": + n.voronoi_dimensions = "4D" + links.new(sv.outputs[0], n.inputs["W"]) + +bump = next(n for n in nodes if n.name == "Bump") +bw = nodes.new("ShaderNodeRGBToBW") +links.new(bump.inputs["Height"].links[0].from_socket, bw.inputs["Color"]) +rng = nodes.new("ShaderNodeMapRange") +rng.inputs["To Min"].default_value = 0.28 +rng.inputs["To Max"].default_value = 0.78 +links.new(bw.outputs[0], rng.inputs["Value"]) +bsdf = next(n for n in nodes if n.type == "BSDF_PRINCIPLED") +links.new(rng.outputs["Result"], bsdf.inputs["Roughness"]) + +bpy.ops.mesh.primitive_plane_add(size=2.0) +plane = bpy.context.object +plane.data.materials.append(mat) +bpy.ops.object.select_all(action="DESELECT") +plane.select_set(True) +bpy.context.view_layer.objects.active = plane + +sc.render.engine = "CYCLES" +sc.cycles.samples = 1 +sc.cycles.use_denoising = False +sc.render.resolution_x = sc.render.resolution_y = 1024 +sc.render.resolution_percentage = 100 +sc.render.bake.use_pass_direct = False +sc.render.bake.use_pass_indirect = False +sc.render.bake.use_pass_color = True +sc.render.bake.use_selected_to_active = False +sc.render.bake.margin = 8 +bake_node = nodes.new("ShaderNodeTexImage") +bake_node.location = (600, -400) + + +def bake(name, bake_type): + img = bpy.data.images.new(name, 1024, 1024, alpha=False) + img.colorspace_settings.name = "sRGB" if name == "albedo" else "Non-Color" + bake_node.image = img + nodes.active = bake_node + bake_node.select = True + print("[bake]", name, bake_type, flush=True) + bpy.ops.object.bake(type=bake_type) + img.filepath_raw = "/tmp/opencode/" + name + ".png" + img.file_format = "PNG" + img.save() + bake_node.select = False + return Image.open(img.filepath_raw).convert("RGB") + + +albedo = bake("albedo", "DIFFUSE") +bake("normal", "NORMAL") +rough = bake("roughness", "ROUGHNESS") +cracks = next(n for n in nodes if n.name == "ColorRamp.002") +bw2 = nodes.new("ShaderNodeRGBToBW") +links.new(cracks.outputs["Color"], bw2.inputs["Color"]) +rng2 = nodes.new("ShaderNodeMapRange") +links.new(bw2.outputs[0], rng2.inputs["Value"]) +links.new(rng2.outputs["Result"], bsdf.inputs["Roughness"]) +voronoi = bake("height_voronoi", "ROUGHNESS") + + +def arr(img): + return np.asarray(img, np.float32) / 255.0 + + +def upscale(a): + h, w = a.shape[:2] + out = np.zeros((h * 2, w * 2, 3), np.float32) + for c in range(3): + out[:, :, c] = np.asarray( + Image.fromarray((a[:, :, c] * 255).astype(np.uint8)).resize( + (w * 2, h * 2), Image.Resampling.LANCZOS), np.float32) / 255.0 + return out + + +def save(name, a): + Image.fromarray((np.clip(a, 0.0, 1.0) * 255.0 + 0.5).astype(np.uint8)).save( + os.path.join(TEX, name + ".png")) + print("[concrete] saved", name, flush=True) + + +albedo = upscale(arr(albedo)) * np.array([0.265, 0.265, 0.30], np.float32) +rough = upscale(arr(rough)) +r = rough[:, :, 0] +rough[:, :, 0] = rough[:, :, 1] = rough[:, :, 2] = ( + (r - r.min()) / max(r.max() - r.min(), 1e-5) * 0.38 + 0.30) +voronoi = upscale(arr(voronoi))[:, :, 0] +h = 0.37 * (rough[:, :, 0] - rough[:, :, 0].mean()) + 0.89 * (voronoi - voronoi.mean()) +gx = (np.roll(h, -1, 1) - np.roll(h, 1, 1)) * 0.5 +gy = (np.roll(h, -1, 0) - np.roll(h, 1, 0)) * 0.5 +nx, ny, nz = -gx * 12.0, gy * 12.0, np.ones_like(h) +inv = 1.0 / np.sqrt(nx * nx + ny * ny + nz * nz) +normal = np.stack((nx * inv, ny * inv, nz * inv), 2) * 0.5 + 0.5 + +save("concrete_albedo", albedo) +save("concrete_roughness", rough) +save("concrete_normal", normal) +print("[concrete] done — 3 x 2048px seamless maps from CGTrader ConcreteMaterial.blend") diff --git a/tools/blender/build_enemies.py b/tools/blender/build_enemies.py index ef079ab..a89ce9c 100644 --- a/tools/blender/build_enemies.py +++ b/tools/blender/build_enemies.py @@ -34,6 +34,8 @@ P = K.PALETTE # Near-black rot is deliberately dark-red rather than neutral black: the actor # shader detects saturated vertex colours and makes these growths writhe. P.update({"rot": "#4a1018", "rot_dk": "#200a10", "rot_vein": "#a81a22"}) +P.update({"resonance": "#00c4eb", "resonance_dk": "#064a66", + "resonance_hot": "#40dfff"}) def hiss_rot(r, seed, growths, tendrils, veins, masses, size_scale=1.0): @@ -464,17 +466,27 @@ def build_mold_spore(): # -------------------------------------------------------------------- shard +def slim_crystal(root, name, center, size, value, seed, sx, sz, tilt=(0, 0, 0)): + obj = K.crystal(root, name, (0.0, 0.0, 0.0), size, value, + sides=6, seed=seed, tilt=tilt) + for v in obj.data.vertices: + v.co.x *= sx + v.co.y *= sx + v.co.z = v.co.z * sz + center[2] + obj.data.update() + return obj + + def build_shard(): r = K.new_actor("Shard") - K.crystal(r, "crystal", (0, 0, 0.40), 0.62, P["board"], sides=8, seed=3) - K.crystal(r, "core", (0, 0, 0.42), 0.30, P["paper"], sides=6, seed=4) + slim_crystal(r, "crystal", (0, 0, 0.26), 0.20, P["resonance"], 3, 0.46, 1.45) + slim_crystal(r, "core", (0, 0, 0.28), 0.06, P["resonance_hot"], 4, 0.55, 1.5) for i in range(3): a = 2.0 * math.pi * i / 3 - K.crystal(r, "spark_%d" % i, - (math.cos(a) * 0.28, math.sin(a) * 0.28, 0.16), 0.14, - P["board"], sides=5, seed=5 + i, - tilt=(0.2, 0.3 * i, 0)) - K.ring(r, "halo", (0, 0, 0.22), 0.30, 0.025, P["board"], segments=12) + slim_crystal(r, "splinter_%d" % i, + (math.cos(a) * 0.10, math.sin(a) * 0.10, 0.18 + 0.04 * i), + 0.065, P["resonance_dk"], 5 + i, 0.6, 1.3, + tilt=(0.25, 0.4 * i, 0)) return r @@ -505,7 +517,7 @@ for obj in bpy.data.objects: if obj.name in SLOTS: obj.location.x = SLOTS[obj.name] if obj.name == "Shard": - obj.scale = (3.0, 3.0, 3.0) + obj.scale = (4.0, 4.0, 4.0) world = bpy.data.worlds.new("ShowroomWorld") bpy.context.scene.world = world diff --git a/tools/blender/build_scene.py b/tools/blender/build_scene.py index 015fc1d..7afee8f 100644 --- a/tools/blender/build_scene.py +++ b/tools/blender/build_scene.py @@ -341,6 +341,9 @@ GREEN = (0.42, 0.68, 0.32) GREEN_DK = (0.17, 0.32, 0.14) YELLOW = (0.96, 0.77, 0.09) GOLD = (0.85, 0.66, 0.25) +CYAN = (0.23, 0.85, 1.0) +CYAN_HOT = (0.82, 1.0, 1.0) +CYAN_DK = (0.03, 0.36, 0.52) def badge_card(c, tint=(0.0, 0.0, 0.0), tint_a=0.0): @@ -428,10 +431,13 @@ def draw_mold_spore(): def draw_shard(): c = Canvas() - c.diamond(256, 256, 150, 200, YELLOW, 0.22) # glow - c.diamond(256, 256, 112, 152, YELLOW) # body - c.diamond(256, 256, 56, 78, (1.0, 0.97, 0.8)) # core - c.capsule(256, 430, 256, 470, 6, GOLD, 0.8) # sparkle tick + c.ellipse(256, 256, 180, 220, CYAN, 0.14) + c.diamond(256, 256, 96, 196, CYAN, 0.9) + c.diamond(248, 268, 52, 150, CYAN) + c.diamond(268, 250, 36, 168, CYAN_DK, 0.8) + c.diamond(256, 272, 22, 96, CYAN_HOT) + c.diamond(256, 140, 18, 42, CYAN_HOT, 0.85) + c.capsule(256, 430, 256, 462, 5, CYAN_HOT, 0.7) return new_image("shard", c) @@ -443,6 +449,30 @@ def draw_glow(): return new_image("glow", c) +def draw_glyph(kind): + c = Canvas() + for x, y, s in ((64, 96, 120), (296, 176, 96), (168, 318, 72)): + c.rect(x - 16, y - 16, x + s + 16, y + s + 16, RED, 0.22) + c.rect(x - 7, y - 7, x + s + 7, y + s + 7, RED_HOT, 0.35) + if kind == 0: + c.rect(x, y + s * 0.80, x + s * 0.86, y + s * 0.90, RED_HOT) + c.rect(x + s * 0.30, y + s * 0.16, x + s * 0.42, y + s * 0.82, RED_HOT) + c.rect(x + s * 0.42, y + s * 0.46, x + s * 0.82, y + s * 0.56, RED_HOT) + c.rect(x + s * 0.08, y + s * 0.06, x + s * 0.62, y + s * 0.15, RED_HOT) + elif kind == 1: + c.rect(x + s * 0.10, y + s * 0.10, x + s * 0.20, y + s * 0.88, RED_HOT) + c.rect(x + s * 0.20, y + s * 0.78, x + s * 0.78, y + s * 0.88, RED_HOT) + c.rect(x + s * 0.20, y + s * 0.42, x + s * 0.64, y + s * 0.52, RED_HOT) + c.rect(x + s * 0.54, y + s * 0.08, x + s * 0.64, y + s * 0.46, RED_HOT) + c.ellipse(x + s * 0.74, y + s * 0.20, 9, 9, RED_HOT) + else: + c.rect(x + s * 0.42, y + s * 0.06, x + s * 0.56, y + s * 0.94, RED_HOT) + c.rect(x + s * 0.06, y + s * 0.40, x + s * 0.92, y + s * 0.52, RED_HOT) + c.rect(x + s * 0.14, y + s * 0.72, x + s * 0.44, y + s * 0.80, RED_HOT) + c.rect(x + s * 0.62, y + s * 0.14, x + s * 0.86, y + s * 0.22, RED_HOT) + return new_image("glyph_%s" % "abc"[kind], c, size=128) + + def sprite_mat(name, img, emit=0.55): mat = new_mat("sprite_mat_" + name) nt = mat.node_tree @@ -542,7 +572,28 @@ def build_materials(): m["paper_scrap"] = principled("paper_scrap", (0.78, 0.75, 0.66), rough=0.7) m["duck"] = principled("duck_yellow", (0.85, 0.62, 0.05), rough=0.22) m["dust"] = principled("dust_mote", (0.9, 0.85, 0.7), rough=0.5, - emit=(1.0, 0.92, 0.72), emit_str=2.2, alpha=0.55) + emit=(1.0, 0.92, 0.72), emit_str=2.2, alpha=0.55) + m["glyph_bar"] = principled("chant_glyph_bar", (0.32, 0.008, 0.012), rough=0.35, + emit=(1.0, 0.04, 0.05), emit_str=2.2) + m["spark"] = principled("decay_spark", (0.9, 0.32, 0.08), rough=0.3, + emit=(1.0, 0.45, 0.14), emit_str=8.0) + m["drip"] = make_grime_mat("decay_drip", (0.10, 0.004, 0.008)) + m["slab"] = principled("corrupt_slab", (0.045, 0.028, 0.03), rough=0.55, + emit=(0.4, 0.012, 0.016), emit_str=0.8) + m["grime"] = make_grime_mat("decay_grime", (0.014, 0.011, 0.012)) + mist = new_mat("red_mist_volume") + nt = mist.node_tree + for node in list(nt.nodes): + nt.nodes.remove(node) + pv = nt.nodes.new("ShaderNodeVolumePrincipled") + out = nt.nodes.new("ShaderNodeOutputMaterial") + set_in(pv, "Density", 0.018) + set_in(pv, "Anisotropy", 0.35) + set_in(pv, "Color", (0.62, 0.025, 0.03, 1.0)) + set_in(pv, "Emission Color", (0.55, 0.02, 0.025, 1.0)) + set_in(pv, "Emission Strength", 0.55) + nt.links.new(pv.outputs["Volume"], out.inputs["Volume"]) + m["mist"] = mist vol = new_mat("haze_volume") nt = vol.node_tree for node in list(nt.nodes): @@ -722,6 +773,9 @@ def build_sprites(): "mold_spore": draw_mold_spore(), "shard": draw_shard(), "glow": draw_glow(), + "glyph_a": draw_glyph(0), + "glyph_b": draw_glyph(1), + "glyph_c": draw_glyph(2), } @@ -742,6 +796,7 @@ def standee(m, mats, name, key, x, y, h, base=True, shadow=True): def build_standees(m, imgs): mats = {k: sprite_mat(k, img) for k, img in imgs.items()} mats["glow"] = sprite_mat("glow", imgs["glow"], emit=22.0) + mats["shard"] = sprite_mat("shard", imgs["shard"], emit=5.0) # The guard — hero of the diorama, on the carpet's edge. standee(m, mats, "Guard", "guard", 0.0, 0.4, 2.35) # Hiss Corrupted Staff: the chanting crowd closing in. @@ -758,8 +813,8 @@ def build_standees(m, imgs): (-1.0, 4.5), (3.0, 5.5), (-6.5, 3.0)] for i, (x, y) in enumerate(shards): yaw = facing_yaw(x, y) - make_quad("Shard_%d" % i, x, y, 0.75, 0.62, 0.72, yaw, mats["shard"], - coll="STANDEES") + make_quad("Shard_%d" % i, x, y, 0.55, 0.38, 0.5, yaw, mats["shard"], + coll="STANDEES") # Service Weapon: Spin — projectiles in flight (glow billboards). shots = [(2.2, 0.9, 1.35), (3.3, 1.5, 1.3), (4.3, 2.1, 1.28)] for i, (x, y, z) in enumerate(shots): @@ -767,6 +822,38 @@ def build_standees(m, imgs): make_quad("Shot_%d" % i, x, y, z, 0.85, 0.85, yaw, mats["glow"], coll="STANDEES") +def make_grime_mat(name, color): + mat = new_mat(name) + nt = mat.node_tree + b = bsdf_of(mat) + set_in(b, "Base Color", (*color, 1.0)) + set_in(b, "Roughness", 0.95) + noise = nt.nodes.new("ShaderNodeTexNoise") + noise.location = (-520, 120) + set_in(noise, "Scale", 4.0) + set_in(noise, "Detail", 5.0) + ramp = nt.nodes.new("ShaderNodeValToRGB") + ramp.location = (-300, 120) + ramp.color_ramp.elements[0].position = 0.40 + ramp.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) + ramp.color_ramp.elements[1].position = 0.74 + ramp.color_ramp.elements[1].color = (0.8, 0.8, 0.8, 1.0) + nt.links.new(noise.outputs["Fac"], ramp.inputs["Fac"]) + nt.links.new(ramp.outputs["Color"], b.inputs["Alpha"]) + try: + mat.surface_render_method = "BLENDED" + except Exception: + try: + mat.blend_method = "BLEND" + except Exception: + pass + try: + mat.show_transparent_back = False + except Exception: + pass + return mat + + def tinted_glow_mat(name, img, tint, emit_str): """Radial glow decal material (light spills), tinted per use.""" mat = new_mat(name) @@ -813,6 +900,99 @@ def build_fx(m, imgs): make_box("Dust_%d" % i, x, y, z, s, s, s, m["dust"], coll="FX") +def build_decay(m, imgs): + glyph_mats = {k: sprite_mat("glyph_" + k, imgs["glyph_" + k], emit=5.5) + for k in "abc"} + rng = random.Random(23) + clusters = [ + (0.0, 19.5, 3.6, 1.2, 4.4, 50), + (3.0, 2.5, 3.2, 0.5, 3.8, 34), + (-6.0, 4.0, 3.0, 0.5, 3.4, 30), + (0.0, -6.0, 5.0, 0.4, 3.2, 24), + (-13.5, 20.5, 2.2, 1.0, 3.6, 20), + (13.0, 6.0, 2.4, 0.5, 3.0, 16), + ] + idx = 0 + for cx, cy, spread, zlo, zhi, count in clusters: + for _ in range(count): + x = cx + rng.uniform(-spread, spread) + y = cy + rng.uniform(-spread * 0.7, spread * 0.7) + z = rng.uniform(zlo, zhi) + w = rng.uniform(0.35, 0.80) + obj = make_quad("Glyph_%d" % idx, x, y, z, w, w * rng.uniform(0.9, 1.5), + facing_yaw(x, y), glyph_mats["abc"[idx % 3]], coll="DECAY") + obj.keyframe_insert(data_path="location", frame=1) + obj.location.z = rng.uniform(1.1, 1.9) + obj.keyframe_insert(data_path="location", frame=120) + idx += 1 + + for k, (dz, tilt) in enumerate(((0.55, 12.0), (0.0, -9.0))): + make_box_obj("ChantBar_%d" % k, (2.3, 0.05, 0.16), + (-13.95, 21.76, 5.15 + dz), (0, math.radians(tilt), 0), + m["glyph_bar"], coll="DECAY") + for k in range(5): + x = -14.6 + k * 0.5 + make_quad("ChantGlyph_%d" % k, x, 21.70, + 5.15 + rng.uniform(-0.3, 0.3), 0.42, 0.52, + facing_yaw(x, 21.7), glyph_mats["abc"[k % 3]], coll="DECAY") + for k, (x, tilt) in enumerate(((-2.1, 8.0), (0.9, -11.0), (2.8, 14.0))): + make_box_obj("SignChantBar_%d" % k, (1.9, 0.05, 0.17), + (x, 21.72, 6.72), (0, math.radians(tilt), 0), + m["glyph_bar"], coll="DECAY") + make_quad("SignChantGlyph_%d" % k, x, 21.68, 6.72 + 0.18, 0.42, 0.48, + facing_yaw(x, 21.7), glyph_mats["abc"[k % 3]], coll="DECAY") + + pool = tinted_glow_mat("pool_dead_strip", imgs["glow"], (1.0, 0.1, 0.08), 0.9) + make_quad_flat("DeadStripPool", 0, -6, 0.055, 7.0, 4.0, 0.0, pool, coll="DECAY") + make_quad_flat("DeadWallPool", -8.5, 20.2, 0.055, 4.0, 3.2, 0.0, pool, coll="DECAY") + for label, sx, sy, count in (("Strip", 0.0, -6.0, 22), + ("Wall", -8.5, 20.6, 16)): + for i in range(count): + x = sx + rng.uniform(-2.4, 2.4) + y = sy + rng.uniform(-0.8, 0.8) + z = rng.uniform(0.08, 1.3) + s = rng.uniform(0.05, 0.13) + make_box("Spark_%s_%d" % (label, i), x, y, z, s, s, s * 2.2, + m["spark"], coll="DECAY") + + for i, (loc, size) in enumerate(( + ((0.0, 19.4, 1.8), (7.0, 4.0, 3.4)), + ((16.0, 10.0, 1.7), (6.0, 5.0, 3.2)), + ((-17.0, -10.0, 1.6), (4.5, 4.0, 2.6)), + )): + obj = make_box("MistPocket_%d" % i, *loc, *size, m["mist"], coll="DECAY") + obj.modifiers.clear() + + for i, (x, y, yaw, z, w, h) in enumerate(( + (0.0, 21.96, 0.0, 4.6, 9.0, 1.5), + (-13.5, 21.96, 0.0, 3.4, 3.6, 2.0), + (8.5, 21.96, 0.0, 5.2, 4.2, 1.3), + (-21.96, -6.0, math.pi / 2, 0.6, 4.0, 1.2), + (21.96, 8.0, math.pi / 2, 0.6, 5.0, 1.1), + (0.0, 3.4, 0.0, 5.6, 1.3, 3.0), + )): + make_quad("Stain_%d" % i, x, y, z, w, h, yaw, m["grime"], coll="DECAY") + + for i, (x, y, yaw, z, w, h) in enumerate(( + (-8.5, 21.96, 0.0, 4.8, 0.8, 2.6), + (2.2, 21.96, 0.0, 5.0, 0.6, 2.2), + (-21.96, 16.0, math.pi / 2, 3.6, 0.9, 2.8), + (0.0, 3.35, 0.0, 5.4, 0.7, 2.6), + )): + make_quad("Drip_%d" % i, x, y, z, w, h, yaw, m["drip"], coll="DECAY") + + for i, (loc, rot, size) in enumerate(( + ((15.4, -15.2, 0.55), (0.22, 0.45, 0.32), (3.4, 0.26, 2.0)), + ((-10.5, -16.5, 0.45), (0.12, -0.3, 0.5), (2.8, 0.24, 1.7)), + ((7.5, -13.0, 0.5), (-0.2, 0.6, 0.24), (2.4, 0.22, 1.4)), + ((-18.5, -3.5, 0.6), (0.4, 0.2, -0.6), (2.6, 0.25, 1.5)), + ((12.0, 9.5, 0.4), (0.1, -0.2, 0.8), (2.2, 0.2, 1.3)), + ((-4.0, 17.5, 0.5), (-0.3, 0.4, 0.2), (2.6, 0.24, 1.6)), + )): + make_box_obj("DecaySlab_%d" % i, size, loc, rot, + m["hissshine"] if i in (2, 5) else m["slab"], coll="DECAY") + + def build_props(m): """S1 identity props: Objects of Power + FBC furniture.""" # --- Hotline (the Board's phone) — left, near the far wall. @@ -1058,10 +1238,13 @@ def main(): build_structure(m) imgs = build_sprites() build_fx(m, imgs) + build_decay(m, imgs) build_standees(m, imgs) build_props(m) build_lights_and_cameras(m) setup_world_and_render() + bpy.context.scene.frame_end = 120 + bpy.context.scene.frame_set(45) setup_glare(bpy.context.scene) blend_path = os.path.join(BLEND_DIR, "fbc_night_shift_diorama.blend") bpy.ops.wm.save_as_mainfile(filepath=blend_path)