Implement Fog Of War logo

Implement Fog Of War

CommunityPopular
MengTo
implement-fog-of-war

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.

Overview

PublisherMengTo
RepositorySkills
Skill nameimplement-fog-of-war
Stars
6.1K
Forks
717
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by MengTo on GitHub. Read the source before you install it.

Installation

Install the Implement Fog Of War AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MengTo/Skills.git /tmp/Skills
mkdir -p .claude/skills
cp -r /tmp/Skills/agent-skills/codex/implement-fog-of-war .claude/skills/implement-fog-of-war
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Implement Fog Of War in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Implement Fog Of War on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Implement Fog Of War is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 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

  • Represent each sight blocker with a stable footprint, vertical span, and active state.
  • Intersect a 3D sight segment or ray with both the horizontal footprint and vertical span.
  • Ignore inactive blockers and cover below the eye-to-target sight line.
  • Expose:
    • point-to-point perception for enemies, targeting, and attacks;
    • a deterministic angular distance fill for the fog lookup.
  • Use explicit player and enemy ranges. Allow them to differ when the encounter design needs enemies to acquire beyond the player's reveal edge.

2. Build the visibility lookup

  • Allocate the distance array, byte pixels, and data texture once.
  • Cast a fixed number of evenly spaced horizontal rays around the player's eye point.
  • Normalize hit distances by the player vision radius and quantize them into a one-row red-channel texture.
  • Use linear filtering, horizontal repeat wrapping, no mipmaps, and a bounded mobile/desktop ray budget.
  • Refresh after meaningful player motion or a short maximum interval. Do not allocate in the frame loop.

3. Render one soft overlay

  • Use one clip-space plane and one transparent shader material.
  • Reconstruct each fragment's ground-plane position from the four camera-corner intersections.
  • Combine:
    • a clear inner radius and soft outer radial falloff;
    • a feathered wall boundary sampled from the angular lookup.
  • Smooth obstacle visibility across neighboring angles. Weight wall fog below the outer radial fog so blockers read as atmosphere, not opaque wedges.
  • Combine radial and obstacle fog with max, then cap final opacity.
  • Disable depth test, depth write, and tone mapping; render after the world.
  • Do not introduce a second renderer, render target, composer, or per-ray meshes.

4. Integrate gameplay

  • Keep simulation presence separate from presentation visibility.
  • Hide unrevealed enemy renderables through layers or a presentation-only mechanism; do not toggle the actor root if root visibility also controls lifecycle or simulation.
  • Exclude unrevealed enemies from target lock, aim selection, nearest-target search, HUD counts, and player hit eligibility.
  • Hide telegraphs that would leak an unseen enemy.
  • Let enemy acquisition and attacks use their own range plus the same line-of-sight truth.
  • Clear an active target lock as soon as perception invalidates it.
  • Cache perception within a simulation phase and refresh after movement when downstream systems need current positions.

5. Integrate state and lifecycle

  • Enable fog only during active gameplay.
  • Disable it for menus, inventory, review/capture modes, paused or non-playing states, and stage transitions unless the product explicitly requires otherwise.
  • Disable it before any early-render branch so a previous frame cannot leak into another state.
  • Keep atmospheric scene fog separate from fog of war.
  • Dispose the overlay geometry, material, and lookup texture on teardown.
  • Publish compact telemetry for ray budget, enabled state, ranges, visible enemies, target visibility, line of sight, and measured distance.

Tune in the right order

  1. Validate obstacle geometry and eye height.
  2. Validate player and enemy ranges.
  3. Set the fully clear inner radius.
  4. Set the outer radial falloff and maximum opacity.
  5. Set wall-edge softness.
  6. Add angular smoothing until spokes disappear.
  7. Reduce obstacle darkness until walls feel like occlusion rather than black rays.
  8. Adjust ray budgets only after visual correctness and measured performance.

Do not hide bad obstacle data with extra blur. Do not make the entire scene darker to compensate for weak visibility boundaries.

Validate

Read validation.md before claiming completion. Run:

  • pure perception and opacity tests;
  • structural render-budget contracts;
  • integration tests for targeting, layers, lighting, and state;
  • project lint and build;
  • real desktop and mobile browser checks in the Codex browser.

Use normal gameplay for visual verification when review modes intentionally disable fog. Judge motion, camera movement, wall edges, gates, seams, and menu transitions—not only a still frame.

Protect the proven qualities

  • Keep the inner play area readable.
  • Keep the maximum darkness restrained.
  • Keep walls soft and free of visible radial spokes.
  • Keep the angle seam invisible.
  • Keep dynamic gates synchronized with sight.
  • Keep enemy behavior fair even when enemy vision exceeds player reveal.
  • Keep one authoritative visibility model and one bounded overlay.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Implement Fog Of War AI skill do?

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.

Why use Implement Fog Of War on TypingMind?

Because you install it once and use it with any model. Implement Fog Of War is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Implement Fog Of War in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MengTo/Skills/tree/main/agent-skills/codex/implement-fog-of-war. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Implement Fog Of War?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Implement Fog Of War?

As many as you like. As long as a model supports skills, you can use Implement Fog Of War with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Implement Fog Of War AI skill free?

Yes. It is published on GitHub by MengTo under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇