Fog of War RTS
Fog of War RTS is a Unity package that brings the classic "fog of war" mechanic from strategy games like Age of Empires and StarCraft to your project. Unexplored areas remain completely hidden, while previously discovered regions appear dimmed when not actively observed. The system is optimized for real-time strategy (RTS), top-down, and 2D games, efficiently handling thousands of units simultaneously.
Watch the Demo
See the system in action in the demonstration video below.
How It Works
The fog of war divides your map into three visibility states:
- Hidden Areas: Unexplored regions that have never been discovered by any vision source.
- Explored Areas: Previously discovered locations that are not currently in vision range.
- Visible Areas: Regions currently within your units' vision range.
As units move, the fog updates automatically in real-time with smooth transitions between states.
Key Features
- Customizable Fog Appearance: Use custom textures and colors for both unexplored and explored fog to match your game's art style.
- Real-Time Updates: Fog responds instantly to unit movement with smooth fade transitions between visibility states.
- High Performance: Efficiently processes large maps with thousands of units without impacting frame rates.
- Simple Integration: Drag-and-drop components make setup straightforward - attach a VisionSource to any unit to reveal fog.
- UI Map Fog Overlay: Apply fog of war effect to your custom UI minimaps with a single component.
- Visibility Events: Control object behavior based on fog state using UnityEvents or C# events.
- Smooth Object Fading: Built-in Fader component for seamless fade-in and fade-out transitions.
- Persistent Discovery: Save and restore explored areas between game sessions.
- Flexible Refresh Modes: Choose between automatic real-time updates or manual control for turn-based gameplay.
- Top-Down and 2D Support: Works with both XZ orientation (top-down games) and XY orientation (2D side-scrolling games).
Main Components
FogOfWarManager: Core component managing all fog calculations, map boundaries, and visual configuration.VisionSource: Reveals fog in circular or square patterns.VisibilitySwitch: Receives visibility events to control object behavior based on fog state.Fader: Provides smooth fade-in and fade-out transitions for renderers using custom shaders.MapFogOverlayUI: Applies fog of war overlay to your custom UI minimap.