Skip to content

feat: implement industry-standard fog of war optimizations#1260

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/fog-of-war-research-SGXOA
Feb 3, 2026
Merged

feat: implement industry-standard fog of war optimizations#1260
braedonsaunders merged 1 commit into
mainfrom
claude/fog-of-war-research-SGXOA

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

Implements all three phases of fog of war improvements based on research from StarCraft 2, League of Legends, Civilization VI, and other AAA RTS games.

Phase 1: Performance Foundation (Reference Counting)

  • VisionOptimizer: Track how many units can see each cell
  • Cell boundary detection: Only update when units cross grid boundaries
  • Incremental updates: O(moved_units × affected_cells) vs O(casters × cells)

Phase 2: Gameplay Critical (LOS Blocking)

  • LineOfSight: Height-based terrain vision blocking
  • Ray-tracing and shadowcasting algorithms
  • Integration with Terrain heightmap data
  • Units on high ground see down, low ground can't see up

Phase 3: Visual Polish (SDF Edges)

  • SDFVisionRenderer: Signed distance field for smooth fog edges
  • Pattern-based upscaling (LoL's 16 transition patterns)
  • Resolution-independent edge quality without expensive blur

Key Changes

  • src/engine/systems/vision/VisionOptimizer.ts: Reference counting system
  • src/engine/systems/vision/LineOfSight.ts: Terrain LOS blocking
  • src/engine/systems/vision/SDFVisionRenderer.ts: SDF edge rendering
  • src/engine/systems/VisionSystem.ts: Integration of all optimizations
  • src/rendering/compute/VisionCompute.ts: Height texture support for GPU
  • src/rendering/Terrain.ts: Expose heightmap for vision calculations
  • Comprehensive test coverage for all new systems

https://claude.ai/code/session_01XSmJ7hgNws3pkW6EHC2W4j

Implements all three phases of fog of war improvements based on research
from StarCraft 2, League of Legends, Civilization VI, and other AAA RTS games.

## Phase 1: Performance Foundation (Reference Counting)
- VisionOptimizer: Track how many units can see each cell
- Cell boundary detection: Only update when units cross grid boundaries
- Incremental updates: O(moved_units × affected_cells) vs O(casters × cells)

## Phase 2: Gameplay Critical (LOS Blocking)
- LineOfSight: Height-based terrain vision blocking
- Ray-tracing and shadowcasting algorithms
- Integration with Terrain heightmap data
- Units on high ground see down, low ground can't see up

## Phase 3: Visual Polish (SDF Edges)
- SDFVisionRenderer: Signed distance field for smooth fog edges
- Pattern-based upscaling (LoL's 16 transition patterns)
- Resolution-independent edge quality without expensive blur

## Key Changes
- src/engine/systems/vision/VisionOptimizer.ts: Reference counting system
- src/engine/systems/vision/LineOfSight.ts: Terrain LOS blocking
- src/engine/systems/vision/SDFVisionRenderer.ts: SDF edge rendering
- src/engine/systems/VisionSystem.ts: Integration of all optimizations
- src/rendering/compute/VisionCompute.ts: Height texture support for GPU
- src/rendering/Terrain.ts: Expose heightmap for vision calculations
- Comprehensive test coverage for all new systems

https://claude.ai/code/session_01XSmJ7hgNws3pkW6EHC2W4j
@braedonsaunders braedonsaunders merged commit 7e8d407 into main Feb 3, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants