Day 52 – Improved Fog of War
Started work on the AI implementation yesterday, but quickly noticed I had to add some visual debugging options first.
Until now I manually controlled the enemy, just as if it was just another player. This is useful to test scenarios myself and I’ll keep this option around.
But in the actual game, when the AI manages the turn, the player will only see what’s happening when the enemy is in the player’s field of view. Of course that’s not very handy during development where I would like to see what the AI is doing.
I’m working on three different debugging options that I can toggle during development:
- execute the enemy turn from the player’s point of view, as in the final game: only showing what the actual player sees
- follow the player point of view but also show all the non-visible objects and characters
- execute the enemy turn from the enemy’s point of view: see what the enemy sees exactly (even if it’s still the AI running the show)
Option 2 is mostly finished. I have a toggle that I can use to show all objects on the field, even if they are not currently visible to the player.
Changing the Fog Of War
While working on it I also noticed some limitations with my fog of war implementation. Once I visualized hidden objects inside the fog, the fog was not applied to them correctly.
The reason for this was obvious: the fog was a simple plane being rendered on top of the playing field, and anything higher than the plane’s position would pop out of the fog.
I switched from the plane approach to a camera postprocessing implementation. The camera renders anything inside the fog in black & white, with the exception of the last position reflections, those always show in color.
Overall this approach is much better as it doesn’t matter how high an object is, it will always be black & white right now.
Continuing on the other debugging options tomorrow.
Leave a Reply