mcpField
F
fog-of-war-js-ts

fog-of-war-js-ts

github.com/pproencaDevelopment218123 installsUpdated 11w ago
Repository

About fog-of-war-js-ts

fog-of-war-js-ts is a JavaScript and TypeScript guide for building and improving fog-of-war and field-of-view systems in games. Its 44 rules cover algorithms, update scheduling, state, rendering, memory, scaling, geometry, and correctness.

Key features

  1. 01Guidance on FOV algorithms
  2. 02Incremental visibility updates
  3. 03State and data structure choices
  4. 04Fog rendering strategies
  5. 05Memory and map scaling guidance
  6. 06Geometry and correctness rules

Use cases

  1. 01Implementing grid-based field of view
  2. 02Refactoring a fog-of-war display
  3. 03Diagnosing slow updates or visual artifacts
  4. 04Scaling visibility across units or large maps

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill fog-of-war-js-ts

After installing, type/fog-of-war-js-tsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
correct-corner-peeking.md
correct-explored-not-overwritten.md
correct-permissiveness-model.md
correct-symmetric-walls.md
fov-dda-continuous.md
fov-octant-transforms.md
fov-radius-bounded-scan.md
fov-recursive-shadowcasting.md
fov-single-ray-los.md
fov-symmetric-shadowcasting.md
fov-visibility-polygon.md
geo-avoid-modulo-deindex.md
geo-avoid-trig-in-loop.md
geo-integer-slope-shadows.md
geo-radius-shape-choice.md
geo-squared-distance.md
mem-bitpack-explored.md
mem-clear-with-fill.md
mem-generation-stamp.md
mem-no-hot-loop-closures.md
mem-reuse-buffers.md
render-dirty-region-only.md
render-fade-alpha-lerp.md
render-imagedata-not-fillrect.md
render-lowres-soft-upscale.md
render-offscreen-fog-layer.md

Details

From the project README

dot-skills Fog of War (JavaScript/TypeScript) Best Practices

Performance and correctness guide for fog of war and field-of-view systems in JS/TS games, distilled from the canonical FOV literature (Björn Bergström, Albert Ford, Adam Milazzo), Red Blob Games, rot.js, and the MDN/WebGL rendering APIs. Contains 44 rules across 8 categories, ordered by impact, to guide writing, reviewing, and refactoring visibility code.

When to Apply

Reference these guidelines when:

  • Implementing field of view, line of sight, or tile visibility for a grid or continuous map
  • Building or refactoring a fog-of-war display (unexplored / explored / visible layers)
  • Diagnosing slow fog (recompute every frame), visual artifacts (flicker, light leaks), or memory blowups on large maps
  • Scaling visibility to many units (RTS) or to large/streaming worlds
  • Choosing how to store and render the visibility/explored state

Rule Categories by Priority

PriorityCategoryImpactPrefix
1FOV / Visibility AlgorithmCRITICALfov-
2Update Scheduling & Incremental RecomputeCRITICALupdate-
3State Representation & Data StructuresHIGHstate-
4Rendering the Fog LayerHIGHrender-
5Memory & AllocationMEDIUM-HIGHmem-
6Multi-Viewer & Map ScalingMEDIUMscale-
7Geometry & Hot-Loop MathMEDIUMgeo-
8Correctness & Visual ArtifactsLOW-MEDIUMcorrect-

Quick Reference

1. FOV / Visibility Algorithm (CRITICAL)
2. Update Scheduling & Incremental Recompute (CRITICAL)
3. State Representation & Data Structures (HIGH)
4. Rendering the Fog Layer (HIGH)
5. Memory & Allocation (MEDIUM-HIGH)
6. Multi-Viewer & Map Scaling (MEDIUM)
7. Geometry & Hot-Loop Math (MEDIUM)
8. Correctness & Visual Artifacts (LOW-MEDIUM)

How to Use

Read individual reference files for the full explanation and incorrect/correct code:

  • Start with fov- and update- for the two biggest wins: a correct algorithm and recomputing only on change.
  • Section definitions - Category structure, impact levels, and the execution-lifecycle ordering.
  • Rule template - Template for adding new rules.

Reference Files

FileDescription
references/_sections.mdCategory definitions and impact ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Comments

Markdown supported