RTS Fog of War
RTS Fog of War 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 appear completely black or covered.
- Discovered Areas: Previously visited locations are visible but dimmed.
- Visible Areas: Regions within your units' vision range appear fully bright and clear.
As units move, the fog updates automatically in real-time to reveal new areas with smooth fade transitions.
Key Features
- Real-Time Updates: The fog responds instantly to unit movement with smooth fade transitions between visibility states.
- High Performance: Efficiently processes large maps with hundreds or thousands of units without impacting frame rates.
- Simple Integration: Drag-and-drop components make setup straightforward - attach a vision source to any unit or building to reveal surrounding fog.
- Minimap Support: Built-in minimap component displays fog coverage and customizable markers for locations, resources, or units.
- Visibility Events: Control object behavior based on fog state - hide enemy units in fog, show them when visible, or create custom fade effects.
- Persistent Discovery: Save and restore explored areas between game sessions with the built-in save system.
- Flexible Refresh Modes: Choose between automatic real-time updates or manual control for turn-based gameplay.
Main Components
FogOfWarManager: Central controller managing all fog calculations and map boundary configuration.VisionSource: Attach to units or buildings to reveal fog in circular or square patterns around them.VisibilitySwitch: Receives fog visibility events to control object behavior - useful for hiding or showing enemies based on fog state.MapMarker: Displays icons on the minimap for important locations, resources, or units.Map: Ready-to-use minimap UI component with automatic fog visualization.