# Implement Fog Of War

Implement, tune, debug, or validate soft wall-aware fog of war and gameplay perception...

- Repository: https://github.com/MengTo/Skills (7170 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add MengTo/Skills --skill implement-fog-of-war -g -a claude-code -y`
Codex: `npx skills add MengTo/Skills --skill implement-fog-of-war -g -a codex -y`
Cursor: `npx skills add MengTo/Skills --skill implement-fog-of-war -g -a cursor -y`
Gemini CLI: `npx skills add MengTo/Skills --skill implement-fog-of-war -g -a gemini-cli -y`

## Description

Implement, tune, debug, or validate soft wall-aware fog of war and gameplay perception in Three.js action games. Use for orthographic or isometric visibility masks, obstacle-aware line of sight, player and enemy vision ranges, hidden-enemy targeting rules, fog shader artifacts such as spokes or seams, mobile ray budgets, lifecycle and menu-state integration, and deterministic fog-of-war tests.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Implement Fog of War

Build fog of war as a shared perception system with a restrained presentation layer.

## Preserve the architecture

Keep these responsibilities separate:

1. Let deterministic CPU perception own ranges, obstacle intersections, and gameplay visibility.
2. Encode the player's angular visible distances into one fixed-size lookup texture.
3. Let one full-screen shader turn that lookup into soft radial and wall-aware fog.
4. Let gameplay consume perception results directly; never infer combat truth from fog pixels.

Read [mechanics.md](references/mechanics.md) before implementing or changing the algorithm. It records the proven obstacle model, shader composition, calibrated values, state rules, enemy behavior, lighting constraints, and telemetry.

## Inspect before editing

- Locate the authoritative player position, camera, obstacles, scene lifecycle, frame loop, targeting, enemy perception, and render layers.
- Confirm the gameplay ground model. The proven corner-unprojection method assumes a locally horizontal plane; use authoritative surface or terrain reconstruction when elevation varies across the visible area.
- Find existing scene fog, post-processing, renderer creation, review modes, menus, captures, transitions, and disposal paths.
- Read the current tests and recent fog/perception commits before changing constants or ownership.
- Confirm whether obstacle state changes at runtime. Reuse the same active obstacle collection used by navigation or collision when its geometry is suitable for sight.
- Check the working tree early and preserve unrelated changes.

## Implement in dependency order

### 1. Define perception truth

The rest: https://github.com/MengTo/Skills/blob/HEAD/agent-skills/codex/implement-fog-of-war/SKILL.md
