$npx -y skills add thedivergentai/GD-Agentic-Skills --skill godot-genre-stealthExpert blueprint for stealth games (Splinter Cell, Hitman, Dishonored, Thief) covering AI detection systems, vision cones, sound propagation, alert states, light/shadow mechanics, and systemic design. Use when building stealth-action, tactical infiltration, or immersive sim games
| 1 | ## Godot 4.7 Baseline |
| 2 | |
| 3 | - Expert patterns in this skill target **Godot 4.7+** (stable, 2026-06-18). |
| 4 | - Consult the [Godot 4.7 migration guide](https://docs.godotengine.org/en/4.7/tutorials/migrating/upgrading_to_godot_4.7.html) when upgrading projects from 4.6. |
| 5 | - **NEVER** assume 4.6 defaults (stretch mode, audio area_mask, RichTextLabel percent flags) without checking 4.7 migration notes. |
| 6 | |
| 7 | # Genre: Stealth |
| 8 | |
| 9 | Player choice, systemic AI, and clear communication define stealth games. |
| 10 | |
| 11 | ## NEVER Do (Expert Anti-Patterns) |
| 12 | |
| 13 | ### Detection & Awareness |
| 14 | - NEVER use binary "Seen/Not Seen" detection; strictly use a **Gradual Detection Meter** (0-100%) that builds based on distance, light level, and speed. |
| 15 | - NEVER use standard `RayCast3D` nodes for massive amounts of vision checks; strictly use **`PhysicsDirectSpaceState3D.intersect_ray()`** to query the PhysicsServer instantly and nodelessly. |
| 16 | - NEVER allow AI to see through solid geometry; strictly use raycasts between AI eyes and player sample points (Head/Torso/Feet). |
| 17 | - NEVER use a single sample point for visibility; strictly sample **at least 3 points** (Head, Torso, Feet) to prevent detection bugs when partially in cover. |
| 18 | - NEVER use static "Guard Paths"; strictly implement **Dynamic Investigating** where guards leave their route to check on suspicious sounds/activities. |
| 19 | - NEVER trigger "Detection" immediately upon line-of-sight; strictly use a **Detection Meter** with a decay rate to provide a "forgiveness window" for the player to recover. |
| 20 | - NEVER assume a random navmesh point is safe; strictly verify cover points by **Raycasting toward the Threat** to ensure geometry successfully breaks the line of sight. |
| 21 | - NEVER forget to pass the guard's own **RID** into the raycast exclude array; if omitted, the ray will hit the guard's own body, causing false blocking. |
| 22 | - NEVER run complex AI detection for off-screen guards; strictly use `VisibleOnScreenNotifier3D` to pause heavy logic for distant enemies. |
| 23 | |
| 24 | ### Systemic & World Logic |
| 25 | - NEVER use a simple `distance_to()` check for hearing; strictly calculate sound travel along the **Navigation Path** to determine if a wall blocks noise. |
| 26 | - NEVER make combat as viable as stealth; strictly ensure "going loud" triggers intense reinforcements or high-lethality states to preserve the stealth loop. |
| 27 | - NEVER hide the "Why" of detection; strictly provide immediate feedback via **UI icons (?, !)** or audio barks ("What was that?"). |
| 28 | - NEVER ignore the return value of `intersect_ray()`; strictly check `is_empty()` first to prevent runtime crashes. |
| 29 | - NEVER assume a raycast won't hit the guard itself; strictly **exclude the guard's RID** from Query Parameters. |
| 30 | |
| 31 | ### Optimization & Performance |
| 32 | - NEVER tightly couple AI to player scripts; strictly use **duck-typing** (e.g., `if body.has_method("get_detected")`) so guards can spot decoys or dead bodies without brittle dependencies. |
| 33 | - NEVER maintain hardcoded arrays to trigger base-wide alarms; strictly add guards to a **"guards" group** and use `get_tree().call_group()` for dynamic notification. |
| 34 | - NEVER use standard Strings for AI state; strictly use `StringName` (&"alert") for O(1) pointer-level comparisons in high-frequency loops. |
| 35 | - NEVER bake massive NavigationMeshes synchronously; strictly use `use_async_iterations` to prevent main thread stalls during runtime bakes. |
| 36 | - NEVER rely on `Node.find_child()` during gameplay; strictly use **Groups** or exported references for O(1) player tracking. |
| 37 | - NEVER leave CollisionShapes enabled on incapacitated bodies; strictly disable them or move them to a "corpse" layer to prevent pathing interference. |
| 38 | |
| 39 | --- |
| 40 | |
| 41 | ## 🛠 Expert Components (scripts/) |
| 42 | |
| 43 | ### Original Expert Patterns |
| 44 | - [stealth_ai_controller.gd](scripts/stealth_ai_controller.gd) - Professional-grade NPC controller with composite vision, sound paths, and alert state logic. |
| 45 | |
| 46 | ### Modular Components |
| 47 | - [stealth_patterns.gd](scripts/stealth_patterns.gd) - Collection of patterns for PhysicsServer raycasting, noise bus routing, and avoidance masking. |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | ## Design Principles |
| 52 | |
| 53 | From industry experts (Splinter Cell, Dishonored, Hitman developers): |
| 54 | |
| 55 | 1. **Player Choice**: Multiple valid approaches to every scenario |
| 56 | 2. **Systemic Design**: Rules-based AI that players can learn and exploit |
| 57 | 3. **Clear Communication**: Player always understands game state and threats |
| 58 | 4. **Fair Detection**: No "gotcha" moments - threats visible before dangerous |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## AI Detection System |
| 63 | |
| 64 | ### Vision Cone Implementation |
| 65 | |
| 66 | Based on Splinter Cell Blacklist GDC talk - rea |