Fog of War RTS ECS
Fog of War RTS ECS brings the classic fog of war mechanic from strategy games like Age of Empires and StarCraft to Unity. Built on Unity DOTS (ECS, Jobs, and Burst), the system efficiently handles up to 100,000 units while maintaining smooth performance.
Unexplored areas remain completely hidden, while previously discovered regions appear dimmed when not actively observed. The fog updates in real-time as units move across the map.
Watch the Demo
See the system in action with 100k units:
How It Works
The fog of war system divides your map into three visibility states:
- Hidden - Unexplored regions never discovered by any vision source
- Explored - Previously discovered areas not currently in vision range
- Visible - Regions currently within units' vision range
As units move, the fog updates automatically with smooth transitions between states.
Key Features
- High Performance - Tested with 100,000 units using Burst-compiled jobs on multiple CPU cores
- Vision Shapes - Circle, square, and triangle vision patterns
- Vision Layers - Up to 4 independent RGBA layers for multi-level terrain or team-based vision
- Smooth Transitions - Configurable fade-in and fade-out durations for fog and entities
- Minimap Support - Apply fog overlay to UI minimaps with a single component
- Persistent Fog - Save and load explored areas between game sessions
- Entity Visibility - Automatically show/hide entities based on vision with optional fade effects
- Real-Time Updates - Fog responds instantly to unit movement
Main Components
FogOfWarManager- Core component managing fog rendering and GPU resourcesVisionSource- Reveals fog around units in customizable shapesVisibilitySwitch- Controls entity visibility based on fog stateMapFogOverlayUI- Applies fog effect to UI minimaps
Getting Started
Ready to add fog of war to your project? Check out the Quick Setup guide to get started in minutes.
