Skip to content

Claude/fog of war research sgxoa#1261

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

Claude/fog of war research sgxoa#1261
braedonsaunders merged 3 commits into
mainfrom
claude/fog-of-war-research-SGXOA

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

No description provided.

Cleanup from previous commit - removed unused systems that were initialized
but never actually integrated into the computation flow:

Removed (dead code):
- VisionOptimizer: Reference counting system that duplicated GPU efficiency
- SDFVisionRenderer: Smooth edge system not connected to fog shader
- VisionCompute LOS methods: GPU height-based LOS never wired into shader
- Terrain getHeightMapData/Dimensions: Only needed for removed GPU LOS

Kept and properly integrated:
- LineOfSight: Now actually used in revealArea() for height-based blocking
  - Uses Terrain.getHeightAt() as height provider
  - Falls back to simple circular reveal when no height provider set
  - Implements industry-standard shadowcasting algorithm

The GPU path still uses simple circular visibility (efficient for most cases).
The CPU/main-thread path now properly uses LineOfSight when height data is
available, enabling terrain-based vision blocking (high ground advantage).

https://claude.ai/code/session_01XSmJ7hgNws3pkW6EHC2W4j
Phase 1: VisionOptimizer now uses LineOfSight for terrain-aware visibility
- Added setLineOfSight method to VisionOptimizer
- getCellsInRange uses LOS when height provider is available
- VisionSystem connects LineOfSight to VisionOptimizer automatically

Phase 2: Fixed LineOfSight high ground advantage
- Units on high ground can now see down without their own terrain blocking them
- Added casterGroundHeight check in traceRay to skip terrain at/below caster level

Phase 3: Fixed SDFVisionRenderer algorithm
- SDF now correctly computes distance to boundary (not just visibility)
- Boundary cells are properly identified (visible cells adjacent to fog)
- Fixed edge factor calculation for cells far from any boundary
- Updated test to check actual SDF behavior rather than Three.js internal state

https://claude.ai/code/session_01XSmJ7hgNws3pkW6EHC2W4j
@braedonsaunders braedonsaunders merged commit ff76f51 into main Feb 3, 2026
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