I’m working on a tile based game and am trying to figure out how to properly display fog-of-war. This image should give you a good idea of what I’m aiming for. So far I’ve tried several different methods, and they’ve all either failed or had serious drawbacks.
Manually edit the texture on tiles using the bge.texture module
-Failed because tiles of the same type share the texture, so changing the fog on one tile changes the fog on all tiles of the same type
Use UV editing to change the texture
-Same reason as method 1. Tiles of the same type share UVs, so modifying one changes them all.
Use actions to animate the texture influence
-Texture actions don’t seem to work in the BGE. Even if they did, this may have the same problem as the previous methods.
Putting a semi transparent plane over each tile with fog.
-This method actually works pretty well. However, the amount of tiles I’m trying to have on the screen combined with the fact that fog tiles use transparency puts a very heavy load on the rasterizer (jumps from about 10ms without fog to >18ms with fog). While this isn’t absolutely terrible, I would like people to be able to run the game consistently above 60 fps.
There’s one other method I’ve thought of that would probably work, but I don’t like for a couple of reasons:
5. Have two copies of each tile: one with fog and one without
-Tedious to make and seemingly unnecessary to have two of each tile
-I want to be able to fade the fog in and out smoothly. This method wouldn’t allow that.
So I’m kind of at a loss for other ideas right now or ways to fix the ones I currently have. Any help would be greatly appreciated.