feat: implement industry-standard fog of war optimizations#1260
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
Phase 2: Gameplay Critical (LOS Blocking)
Phase 3: Visual Polish (SDF Edges)
Key Changes
https://claude.ai/code/session_01XSmJ7hgNws3pkW6EHC2W4j