# The Jade Crypt Β· Shadow of the Blade A 2.5D cinematic Wuxia action-platformer with Metroidvania RPG progression, built with **Godot 4.7**. > πŸ“– **Game Design Document**: See [docs/GAME_DESIGN.md](docs/GAME_DESIGN.md) for lore, verbs and ability gating, combat, the Dragon Shrine economy, and the full chamber roster. > πŸ—οΈ **Technical Architecture**: See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the 2.5D setup, ASCII chamber pipeline, validator rules and solver, and the runtime. > 🏺 **Asset Catalog**: See [docs/ASSET_CATALOG.md](docs/ASSET_CATALOG.md) for every model with its generation prompt, and the SFX, music and voice-over catalog. > πŸ“Œ **Project Memory & Context**: See [.agents/rules/project_context.md](file:///f:/github-proj/the-jade-crypt/.agents/rules/project_context.md) for technical architecture, git conventions, PBR materials, and session continuity. ## Overview Play as **Lin Yue**, an elite royal shadow blade descending into the Ancestral Crypt beneath Mount Qingcheng to reclaim its Sacred Relics and the Emperor's Tiger Tally from General Meng Tian. Surmount clockwork death traps, leap bottomless abysses, master ledge agility, and unlock ancient martial techniques. ### Core Inspirations & Mechanics - **Cinematic Platforming**: Precise run-ups, cautious tiptoeing (`Shift`), running long leaps, and two-stage ledge grabs. - **Low-Profile Traversal**: Low-tunnel crawling (`S` / `Down`), kinetic **Martial Slide** sprint dashes (`S` while sprinting), and slide-jumping under 1-block hazards. - **Fluid Aquatic Locomotion**: 4-way swimming (`W A S D` / `Arrow Keys`), deep diving (`S`), surface breaching (`Space`), and dock ledge mantling in subterranean pools. - **Underwater Breath & Survival**: Radial HUD lung arc overlay with warning pulses (<28%), turtle respiration endurance charms, and dragon lung expansion cultivation. - **Clockwork Tomb Traps**: Retractable floor spikes with tiptoe safe mechanic, pressure plates, timed iron portcullises, dart launchers, and swinging pendulum blades. - **Dragon Shrine Progression**: Spend Ancient Coins on talisman charms (`turtle_breath`, `golden_cicada`, `chi_magnet`, `silken_feathers`, `iron_bell`, `cinnabar_oculi`), outfits and map blueprints, and Jade Shards on extra Chi flasks, Dragon Lung Expansion (+30s breath), and Trap-Breaker Talismans (`Q`). - **Wuxia Swordplay**: Jian sword slashes (`J` / `F`), timed parries (`K`), and duels with ancient tomb sentinels and General Meng Tian. --- ## Controls Reference ### On Solid Ground & Airborne Traversal | Action | Keyboard / Mouse | Description | | :--- | :--- | :--- | | **Move / Run** | `A` / `D` or `←` / `β†’` | Smooth lateral movement; builds sprint momentum | | **Jump / Ledge Mantle** | `Space` / `W` / `↑` | Vertical leap; mantles up when grabbing a ledge | | **Air Jump (Qinggong)** | `Space` (in mid-air) | Second mid-air leap; required for 3-cell rises | | **Tiptoe / Sneak** | `Shift` + `A` / `D` or `←` / `β†’` | Cautious slow steps; safely bypasses ground spikes | | **Crouch / Crawl** | `S` / `↓` (+ `A` / `D`) | Lowers profile to crawl through 1-cell passages | | **Martial Slide (Roll)** | `S` / `↓` (while running) | Low dodge carrying sprint momentum under hazards | | **Push / Pull Block** | Hold `E` + `A` / `D` or `←` / `β†’` | Grabs adjacent stone block to push or pull | | **Sword Attack** | `J` / `F` or Left-Click | Melee slash (chains into 2-hit combo in recovery window) | | **Guard / Parry** | `K` or Right-Click | Wuxia guard stance; parries darts and enemy thrusts | | **Use Trap-Breaker** | `Q` | Disarms adjacent floor spikes or dart trap for the attempt | ### Subterranean Aquatic Swimming & Diving | Action | Keyboard | Description | | :--- | :--- | :--- | | **Swim Left / Right** | `A` / `D` or `←` / `β†’` | Lateral breaststroke swimming with dynamic pitch tilt | | **Swim Up / Surface** | `W` or `↑` | Rises toward the waterline; transitions to surface treading | | **Dive Down** | `S` or `↓` | Dives deeper underwater into flooded passages | | **Surface Breach / Mantle** | `Space` (near surface) | Breaches waterline; grabs and mantles onto adjacent dock platforms | --- ## Project Structure ```text the-jade-crypt/ β”œβ”€β”€ project.godot # Godot 4 project configuration β”œβ”€β”€ .gitignore # Standard Godot engine ignores β”œβ”€β”€ README.md # Project documentation & context β”œβ”€β”€ assets/ β”‚ β”œβ”€β”€ sprites/ # Character, dungeon tiles, traps β”‚ └── audio/ # Sound effects & dungeon ambiance β”œβ”€β”€ chambers/ # ASCII chamber maps (c01..c05, 30 campaign chambers + dojo_hub, dojo_01..06) β”œβ”€β”€ docs/ # Game design, architecture and asset catalog β”œβ”€β”€ domain/ # Chamber model shared by game and validator (level IR, solver actions, pendulum rig) β”œβ”€β”€ scenes/ β”‚ β”œβ”€β”€ characters/ # Player, guards, sentinels, General Meng Tian β”‚ β”œβ”€β”€ levels/ # Level maps, room layouts, chamber_stage β”‚ β”œβ”€β”€ objects/ # Spikes, gates, levers, water volumes, chests β”‚ └── ui/ # HUD, vitality sphere, breath arc, menus β”œβ”€β”€ scripts/ β”‚ β”œβ”€β”€ characters/ # Player state machine; components/ for her look and effects β”‚ β”œβ”€β”€ core/ # Game manager, chamber loader, camera, model loader β”‚ β”œβ”€β”€ objects/ # Interactive triggers, water volume & hazards β”‚ └── ui/ # HUD, vitality sphere, Dragon Shrine, Codex β”œβ”€β”€ tools/ # Command-line tools, never loaded by the game: validators └── validator/ # Chamber validation rules and pipeline, run by tools/validate_chambers.gd ``` --- ## Technical Stack & Configuration - **Engine**: Godot Engine 4.x (GDScript) - **Visual Style**: True 2.5D (3D environment, models, and dynamic lighting with locked side-scrolling plane) - **Viewport**: 960 Γ— 540 (stretched with `viewport` mode and `keep` aspect ratio) - **Renderer**: Forward+ (real-time shadows, volumetric lighting, ACES tonemap, bloom) --- ## Quick Start in Godot 1. Open **Godot 4.x**. 2. Click **Import** and select `f:/github-proj/the-jade-crypt/project.godot`. 3. Press **`F5`** to play the full game starting from the Main Menu (`res://scenes/ui/main_menu.tscn`). --- ## Resetting Game Progress & Testing Features ### How to Reset Saved Progress & Start as a Fresh Player 1. **In-Game New Game**: - On the Main Menu, click **`SETTINGS`**, then the red **`Start a New Game`** button under **Save Data**. - Confirm with **`Erase & Start Over`**. Escape, Enter and **`Keep My Progress`** all back out without erasing. - The game clears all cleared chambers, coins and jade, charms, outfits, relics and records, and the main button returns to **`β—† ENTER THE CRYPT`**. 2. **First-Run Prologue Flow**: - Once reset, clicking **`ENTER THE CRYPT`** on the Main Menu will automatically launch the **Cinematic Prologue** cutscene before loading Chamber 1. 3. **Replay Prologue Anytime**: - Open **`EXPEDITIONS`** and click **`Watch the Prologue`** to watch the story slides, typewriter calligraphy, and visual novel artwork anytime without resetting progress. 4. **Direct Cutscene Scene Run in Godot**: - Open [`scenes/ui/story_cutscene.tscn`](file:///f:/github-proj/the-jade-crypt/scenes/ui/story_cutscene.tscn) in Godot and press **`F6`** (Run Current Scene). ### In-Game HUD & Map Controls - **Objective Briefing Card**: Stays on screen upon entering any chamber. Dismiss manually via **`Enter`**, **`Esc`**, **`Space`**, **`Tab`**, or by clicking the card. - **On-Demand Briefing**: Press **`Tab`** at any time during gameplay to peek/reopen the chamber briefing. - **Cartographer's 2D Map**: Press **`M`** (or open from Main Menu) to view the illustrated silk parchment map with unlocked landmark nodes and fog-of-war. - **Organic Vitality Gauge & Breath Arc**: The bottom-left emerald sphere dynamically reflects remaining health/Qi with fluid waves, flanked by a cyan-to-jade radial breath arc that activates during submerged diving. --- ## Chamber Playability & Validation Suite All ASCII chamber maps (`chambers/**/*.txt`) are rigorously audited using a mathematical BFS pathfinding solver, 2-cell headroom audit, and hazard-timing analyzer. ### Validate All Chambers (Headless Static CLI) Run the static validation suite across all chambers: ```bash godot --headless --script tools/validate_chambers.gd ``` *(On Windows with standard Godot installation, use `godot.cmd` or `godot`)*. ### Validate a Specific Chamber or Training Folder To audit a single chamber map: ```bash godot --headless --script tools/validate_chambers.gd res://chambers/chapter_01/c01_ch01.txt ``` To audit an entire chapter or the training grounds directory: ```bash godot --headless --script tools/validate_chambers.gd res://chambers/training ``` ### What the Validator Checks - **Mathematical Solvability**: Two-phase BFS solver verifies: 1. Phase 1: Player can reach the Pressure Plate `_` from Spawn `S` while gates are closed. 2. Phase 2: Player can sprint from Plate `_` to the Imperial Chalice Goal `E` before timed gate `g` closes. - **Headroom Clearance**: Verifies that Lin Yue has at least 2 vertical cells (>= 1.8m) of unobstructed clearance above all platforms, stairs, and floors (with crawlway awareness). - **Light Placement**: A floor brazier `T` needs `#` or `=` directly beneath (PROP-002); a hanging lantern `t` needs `#` or `=` within 8 cells above it with open cells for its chain (PROP-003). Push blocks, crumbling slabs, gates and doors never count as anchors. - **Dart Launchers**: A dart launcher `<` or `>` needs `#` or `=` directly beneath it, so its pedestal stands on a ledge rather than floating against the wall (PROP-004). - **Stacked Platform Spacing**: Platforms (`=`, `C`) exactly one row apart must have an empty column between them. A slab sits mid-cell, so one a single row up is at the lower platform's chest height: it cuts through a player standing below and catches false ledge grabs (HEAD-005). - **Point of No Return & Hard Exit**: No place the player can fall into may strand them. Falls count up to what the player survives (6 cells stepping off, 5 jumping), since a heavy landing does no damage. A place with no way on to the exit is critical (PUZZLE-006). A side pit whose only way back onto the solved route is the apex-timed 3-cell double jump is a warning (PUZZLE-007): that is how the dojo hub's floor east of its gate caught players. - **Sprint Feasibility**: Asserts that `[GATE_TIMER]` is mathematically long enough for the player's physical traversal across the proven BFS platforming path between plate and gate. - **Hazard Timing**: Verifies pendulum blades and traps provide >= 0.35s human transit windows. - **Waterline Banks & Objects in Water**: A pool's surface must meet stone or a dock `=` at each edge; open floor at the waterline sits too low to climb out onto, so the swimmer is stuck against it (HEAD-011). No prop may stand in the water itself: its cell is not water, so it punches a dry hole in the pool. Stand it on a stone island reached by docks. - **Pendulum Sweep & Arm Length**: A pendulum's pivot hangs 3.45m above its `P` cell, or from the stone or slab above if that is lower, and its arm is as long as it takes for the blade to reach what it guards. A **floor pendulum** has a floor within 3 rows below `P` (her jump), in its own column or the next. Over a gap it guards the highest walkway within 2 columns, the ledge she is heading for, so the blade clears her while she hangs from its lip and waits. At the bottom of its swing the blade's lower edge passes 1.0m above that floor: through her standing (1.38m) but over her crouched (0.9m), so she ducks it or times her run. An **air pendulum** has no floor that close; it guards a jump and its blade sweeps the `P` cell itself. Stone and slabs in the arc get a slot cut for the blade; a crumbling slab cannot, so one in the arc fails (HAZ-002), as does an arm under 0.8m or over 7m (HAZ-004). The loader and the validator share one calculation (`domain/collision/pendulum_rig.gd`), so they always agree. - **Visual Solution Breadcrumbs**: Prints an ASCII map showing breadcrumbs (`*`) along the critical path to victory. The full run covers the four chapter folders and `training/`, including the dojo hub. The hub is marked `[PRACTICE: true]`: its block, plate and gate are practice equipment, so the puzzle-bypass check (PUZZLE-004) doesn't require them, and as a sandbox it is left off the difficulty curve. ### Validate Models, Relic Placement & Grid Footprints Models and relics have no runtime fallback, so check them after adding or re-exporting any `.glb`, moving an altar (`A`), or resizing an object's collider: ```bash godot --headless --import godot --headless --script tools/validate_models.gd ``` - **Models**: every prop and relic `.glb` loads and has geometry; prints raw and fitted sizes. - **Relic Placement**: every altar has exactly one relic assigned through `ARTIFACT_CATALOG`'s `chamber` field (`scripts/core/game_manager.gd`), and every relic has an altar. - **Grid Footprint**: no solid collider in a `scenes/objects/*.tscn` scene may reach more than half a cell (0.5m, plus 0.03m slack) from the object's centre. An overhang narrows the neighbouring cell below the player's 0.68m width, so a one-cell gap that the chamber validator passes becomes a slot the player wedges in. ### Validate Placed Objects Fit Their Cells (Headless) The map is a uniform grid of 1m cells, but the chamber validator only reads the text, so it cannot see an object drawn wider than its cell. This builds every chamber with the real loader and measures what it placed: ```bash godot --headless --script tools/validate_footprints.gd ``` To check a single chamber or a folder, pass it after `--`: ```bash godot --headless --script tools/validate_footprints.gd -- res://chambers/chapter_02/c02_ch03.txt godot --headless --script tools/validate_footprints.gd -- res://chambers/training ``` - **Visible Mesh (FOOT-001)**: every placed prop, including models spawned at runtime, stays within Β±0.5m of its cell centre horizontally (0.03m slack). A wider prop hangs over a neighbour's gap, like a gate post standing on nothing at the end of a floor, or sinks into its stone. Height may span several cells: a gate fills a 2-row doorway. - **Kill Zone (FOOT-002)**: a spike or blade trigger is no wider than its cell, so the player never dies beside a hazard where nothing visible touches her. Pickup triggers may reach further and are not checked. - Sentinels and the boss move and carry weapons, and pendulums swing, so they are exempt; the pendulum's arc is checked by HAZ-002 above. Failures name the chamber, the file line and column, and the widest part, in the chamber validator's coordinates: ``` FAIL c02_ch03.txt 63 objects, 1 outside their cell FOOT-001 line 7, col 12 'g': mesh 0.30m past the west edge and 0.30m past the east edge (widest part FrameTop 1.60m) ``` Run it after resizing or re-exporting any prop, alongside `validate_models.gd`. --- ## Packaging & Exporting An export preset for **Web** is configured in [`export_presets.cfg`](export_presets.cfg) (export outputs go to `build/`, which is git-ignored). Before exporting, install the matching **Godot 4.7 Export Templates** via **Editor β†’ Manage Export Templates…**. ### Web Export (Preconfigured) - **From Godot Editor**: Open **Project β†’ Export…**, select the **Web** preset, and click **Export Project…** (outputs `build/web/index.html`). - **Headless CLI**: ```bash mkdir -p build/web godot --headless --export-release "Web" build/web/index.html ``` ### Desktop Export (Windows / Linux) & Filter Requirements Only the **Web** preset is checked into [`export_presets.cfg`](export_presets.cfg). To package a standalone desktop build, open **Project β†’ Export… β†’ Add…** (**Windows Desktop** or **Linux**) and copy these two filters from the Web preset before exporting: - **Resources β†’ Filters to export non-resource files/folders (`include_filter`)**: ```text *.txt, *.ogv, *.json ``` Required so raw ASCII chamber maps (`chambers/**/*.txt`), `.ogv` cutscenes, and `.json` data are packed into the `.pck`. - **Resources β†’ Filters to exclude files/folders from project (`exclude_filter`)**: ```text tools/*, tools_internal/*, validator/*, scratch/* ``` Strips CLI validators and internal showcase scripts from the shipped build. --- ## Player Animation Clips Lin Yue's clips are embedded in her model, `assets/models/seahill_characters/lin_yue_lowres.glb`. It has 27 clips: `idle`, `sword_idle`, `walk`, `sneak`, `run`, `crouch_idle`, `crouch_fwd`, `jump`, `jump_land`, `air_jump`, `roll`, `sword_attack`, `sword_guard`, `push`, `pull`, `hit`, `die`, `ledge_grab`, `ledge_climb`, `swim_idle`, `swim_under_idle`, `swim_fwd`, `swim_dive`, `swim_rise`, `swim_under`, `tpose` and `apose`. `scripts/characters/player.gd` names each clip with an `ANIM_*` constant at the top of the file. Every constant matches a clip in the model. Five clips are in the model but the player never plays them: `swim_dive`, `swim_rise` and `swim_under`, plus the reference poses `tpose` and `apose`. A ledge grab plays `ledge_grab`, and the climb plays `ledge_climb`, whose pelvis track lifts her from the hang onto the deck.