Files
novafarma/docs/FOG_OF_WAR_FIX.md
2025-12-13 00:58:46 +01:00

2.3 KiB

🌫️ Fog of War - ANIMATED WEATHER FOG!

Date: December 13, 2025, 00:46


FINAL CHANGES

1. Animated Fog Effect 🌊

  • Before: Static square tiles (ugly!)
  • After: Smooth animated circles that move like real fog!

2. Wave Animation

  • Fog moves in wave pattern
  • Math.sin() and Math.cos() for smooth movement
  • Slow animation (0.0005 speed)

3. Very Light Fog

  • Unexplored: 15% opacity (0.15 alpha)
  • Explored: 5% opacity (0.05 alpha)
  • Visible: No fog (0% opacity)

4. Larger Visible Radius

  • Radius: 8 tiles (you see more!)

5. Smooth Circles Instead of Squares

  • Uses fillCircle() instead of fillRect()
  • Overlapping circles create smooth fog
  • No more ugly square edges!

🎨 HOW IT LOOKS NOW

Unexplored Areas

  • Smooth animated fog circles
  • Moves in wave pattern
  • Very light (15% opacity)
  • Looks like real weather fog!

Explored Areas

  • Almost invisible (5% opacity)
  • Gentle wave animation
  • You can see everything clearly

Visible Areas

  • No fog at all
  • Crystal clear view

🎮 CONTROLS

Disable Fog Completely

Press F12 in game, then:

scene.fogOfWar.disable();

Make Even Lighter

scene.fogOfWar.setFogAlpha(0.05);  // Super light

Make Darker (if needed)

scene.fogOfWar.setFogAlpha(0.3);  // Darker

Adjust Animation Speed

Edit line 170 in FogOfWarSystem.js:

const time = this.scene.time.now * 0.001;  // Faster
const time = this.scene.time.now * 0.0001; // Slower

📊 TECHNICAL DETAILS

Animation Formula

// Wave movement
const waveX = Math.sin(time + x * 0.1) * 5;
const waveY = Math.cos(time + y * 0.1) * 5;

// Pulsing alpha
const alpha = baseAlpha + Math.sin(time + x + y) * 0.05;

Rendering

  • Circles instead of rectangles
  • Overlapping for smooth effect
  • Wave pattern for movement
  • Time-based animation

🎉 RESULT

No more ugly square fog!

Now you have:

  • Smooth animated fog
  • Moves like real weather
  • Very light and subtle
  • No square edges
  • Beautiful wave animation

Restart the game to see the new animated fog! 🔄

Fixed: December 13, 2025, 00:46