# TECHNICAL GUIDE: TERRAIN GENERATION, WAR-FOG & ANTI-BOT LABYRINTH
# PROJECT FREEEXILE: GRIMDARK SAVAGE EXILE 2.5D ARPG

Map generation in **FreeExile** embraces a brutal, atmospheric survival aesthetic inherited from Path of Exile 2: raw bone drifts, rotting miasma, and server-authoritative exploration.

---

## 1. TERRAIN DESIGN PRINCIPLES

- **Grimdark Grounding**: Zero floating palaces or celestial pavilions. The entire landscape consists of foul bogs, toxic roots, fractured galleon hulls, and desolate cliffs piled with exile remains.
- **5 Savage Primal Biomes**:
  1. **Mangrove Deadmarsh (`SAVAGE_MANGROVE_SWAMP`)**: Brackish mud, mangled root barriers, 60% movement speed penalty.
  2. **Crimson Blood Forest (`CRIMSON_BLOOD_FOREST`)**: Deep scarlet thorny vines rooted in sacrificial corpses and hidden bone spike snares.
  3. **Bleached Bone Canyon (`BLEACHED_BONE_CANYON`)**: Sheer jagged rock corridors, piercing winds, and sudden rockfalls.
  4. **Outcast Mine Shafts (`OUTCAST_MINE_SHAFTS`)**: Subterranean timber corridors, rusted minecarts, and combustible methane pockets.
  5. **Corrupted Fiend Ruins (`CORRUPTED_FIEND_RUINS`)**: Fractured monolithic stone pillars and deceptive ambush dead-ends.

---

## 2. WAR-FOG SENSORY PIPELINE & ANTI-MAPHACK SECURITY

- **3 Fog Visibility States**:
  - **Unexplored (`UNEXPLORED` - 0)**: Pitch black. Server **NEVER** dispatches entity coordinates, chest states, or boss metadata inside this zone. Client-side memory scanners (Maphack) are 100% neutralized.
  - **Explored & Obscured (`EXPLORED_FOGGED` - 1)**: Players see static greyed-out topography (walls, obstacles, dry ground). All dynamic monsters, incoming projectiles, and peer exiles are culled.
  - **Direct Line-of-Sight (`VISIBLE` - 2)**: Within dynamic line-of-sight ($7 - 12\text{ tiles}$). Renders full entity animation state, interactive hazards, and real-time VFX.
- **Occlusion-Based Line-of-Sight**: Sheer cliffs, stone masonry, and fortified bone fences cast occlusion rays, preventing wallhack sightlines.

---

## 3. ANTI-BOT & SCRIPT COUNTERMEASURE ARRAYS

- **Anti-Linear Sinuosity ($\ge 1.25$)**:
  - Corridors deliberately alternate crumbled debris piles (`CRUMBLED_DEBRIS`) and bone clusters (`BONE_CLUSTER`), forcing S-curve and zigzag pathing.
  - Linear vector interpolation bots $(\Delta x, \Delta y)$ immediately get wedged against geometry.
- **Destructible Barricades**:
  - Fortified barriers ($80 - 150\text{ HP}$) blocking narrow corridor choke points.
  - Players must expend an active attack swing to shatter barriers; auto-click-to-move scripts stall indefinitely.
- **Quagmire Sludge Patches**:
  - Movement cost doubled (50-60% speed reduction). Players navigate via **Phantom Evasion (i-frame)** dashes; bots moving linearly desynchronize from server movement ticks.
- **Deceptive Dead-Ends**:
  - 3 to 6 procedural cul-de-sacs terminating in monster ambushes. Bots lacking real-time spatial intelligence get encircled.

---

## 4. WEBAPP SIMULATOR VERIFICATION WORKFLOW

1. Open WebApp client [`client/webapp/index.html`](file:///c:/Projects/FreeExile/client/webapp/index.html).
2. Press shortcut **`W`** or click **`👁️ Fog & Maze`** on the HUD action bar.
3. In the diagnostic panel:
   - **Canvas Viewport**: Inspect player (green dot), boss (purple dot), clear vision circle, and greyed-out explored fog.
   - **Step Player**: Trace procedural movement along zigzag routes to confirm real-time fog revelation.
   - **Attack Barricade**: Trigger weapon strikes to break obstructing bone barricades.
   - **New Seed**: Re-generate a fresh labyrinth featuring randomized biomes and obstacle arrays.
