Classic tile-based Fog of War system combining a dark fog representing undiscovered area and a bright fog representing currently hidden area. The full system is entirely implemented in Blueprints. Both types of fog are projected onto the ground using a PostProcess material. This system is designed to have the same performance on small as well as on very large maps. Line of sight vision allows the creation of maps with strategic advantageous positions. Last known location of actors (e.g. buildings) can be remembered even if the actor moved or is destroyed.
This system is designed for RTS, MOBA and similar multiplayer games with many actors over multiple ground areas with individual height. Multiple options how the vision of an actor is calculated are available. So the impact on performance for actors like flying units, buildings and rarely moving units can be minimized.
Technical Details:
Number of Blueprints: 13
1 Actor calculating how both types of fog have to be drawn.
1 PostProcess Material drawing both types of fog.
1 Component controlling if an actor should hide in the fog and if its last known location should be remembered.
1 Component controlling if and how an actor should have vision.
Precomputed tile-based heightmap easily created by placing and scaling an actor.
Tiles are only loaded and drawn within an area visible to the camera.
Detailed tutorials guiding you how the systems works and how you can easily implement it into your game.
That’s amazing! Didn’t know this was possible in blueprints. Especially the part with different high plateus. Now I can try to finish my little Warcraft 3 clone.
One question though, obviously this doesn’t directly work with the minimap. Can you give a hint how I might get that to work?
Making this ready to use with your minimap is pretty easy. You just need to copy how the texture fog is currently created. But instead of looping over each tile of the screen, you loop over the whole map but only taking every Xth tile of course. Where X is the ratio of the resolution of your minimap to the number of Fog of War tiles of the area you want your minimap to cover. So to summarize, copy the blueprint that creates the fog texture, change the variable “center” and change the first and last index of the 2 loops.
The result will be a texture for the fog you can use to paint over your minimap. Please don’t hesitate to ask if there are any more problems.
I just found a little bug in your example. If you walk with a red (client) player to the rocks and then destroy the rocks, the client will still see the rocks.
Thanks for reporting this. Shame on me I didn’t test this!
Can’t take a look at it at the moment, but I guess the rocks actor is just not replicated. Setting “Replicates” to true in the root component of this actor may already fix this. I will upload a fixed version soon.
But at least this is only a bug with the example content, not with the pack itself
Together with the 4.14 update this bug is now fixed. Additionally another bug is fixed that may cause a player’s own unit to disappear for a very short duration when moving up a ramp.
Has anything been changed with the 4.16 update? Just wondering if we should re-install it to get any new changes. We had integrated the pack with the 4.15 update. Thanks!
I like what i see but i have one question… does your product have shroud possibility?
You know… like entire map is 100% black and then if you walked into area that area is like 50% lighted to indicate that you walked there before?
This depends on your camera angle but unfortunately in general this is is not recommended. This is due to performance reasons. The performance scales with the size of the area that’s visible to the camera. So when the player can see really far the computing cost can get very high.
Yes, the torch can just be treated like every other unit.
Hello , Just bought your work and i am playing arround with it. I have few questions…
1 cant find distinction of bright fog and light fog?
2 cant find tile size (i would like to reduce it to 0,5)
3 how do you determine visibility height?
Sorry, missed your post. Yes I speak german but others might be interested in posted questions & answers aswell so it’s better to keep conversation in english.
I’m not sure if I understand your question but I’ll try clarify this point. Each tile always has one of 3 states. Visible, hidden or undiscovered. Visible tiles are tiles that are currently visible to a unit and therefore there is no fog at all. Hidden tiles are tiles that aren’t currently visible but where discovered (were visible at any point in time) earlier. These tiles are covered in bright fog. Undiscovered tiles are tiles that were never visible so far and are therefore covered in dark (black) fog. If your chosen lightning causes problems distinguishing the 3 states you can reduce / increase the brightness of the bright fog with the fog_color parameter of BP_FOW_Actor.
You can adjust the tilesize within the class BP_FOW_Actor. The classes BP_HeightmapTile and BP_WorldGrid will receive that value from BP_FOW_Actor. This variable isn’t editable because placed heightmap tiles won’t properly adjust after modifying the value. So if you choose to modify the tilesize do it before you start placing any heightmap tiles in the level. Please note that when you’re using many units with high vision ranges reducing the tilesize will lead to more computation time each tick.
I think this question relates to the heightmap tiles. In order to create a heightmap you place BP_HeightmapTiles in the level and scale them up (in x,y,z coordinates) to the needs of your level. You can toggle the visibility of the heightmap tiles during the level design process using the ShowHeightmap boolean of BP_FOW_Actor. During BeginPlay these actors will be destroyed (and won’t therefore decrease the performance) to create a 2D array for the heightmap using the heightmap tiles’ location and scale. Please read through the tutorials aswell, they should hopefully clarify this.
I chose a precomputed heightmap because it’s computationally much more efficient than e.g. linetracing during the game.
adition:
ok, iw added new height map tile to desired place but its looking like they do not rotate (although iw rotated them, compiled and saved) in the world but stay in the original (horizontal/vertical) position…
Ok, there is something seriously wrong with height map tiles.
They can’t be rotated.
… i mean i rotate them in editor to diagonal position, save, compile etc. but they are still displayed in play mode as horizontaly/verticaly positioned!
Yes, there is no rotation of the heightmap tiles intended nor do I see a reason why it would be wanted. They are supposed to snap to the location and scale of the tiles of the fog of war system. It’s a tile-based fog of war system and hence the heightmap has to use the same tiles. That’s simply how tile-based fog of war systems work. If you want some rotated heightmap tiles this would be a very complex and hard to implement system. I doubt any game has ever used such a system. For a reason, the result wouldn’t be very noticable and the extra computation needed for this could simply be used for smaller tiles, what would most likely lead to a better result anyway.