I want to prototype a small multiplayer Fog of War system using Blueprint. I have a particular setup in mind and while I think it should work, I’d like to gather some opinions around here to know if it looks good performance-wise.
Here is the setup I’m thinking of:
Creating a CollisionBoxActor called “FogOfWarVolume”, it should cover the entirety of my map
Creating a CollisionBoxActor called “FogOfWarBox”, size 50*50
Creating an empty BlueprintActor called “FogOfWarManager” (or the Game Mode, whatever)
Creating a PlayerCharacter with a variable Float “SightRange” of 800
OnEventBeginPlay of the **FogOfWarManager **I get the X and Y size of the FogOfWarVolume, divide both by 50 and I get the number of Columns and Rows in my level
For each Row, I get each Column and create a **FogOfWarBox **at position X (50index - 50) and position Y (50index - 50)
Whenever a **PlayerCharacter **overlaps a **FogOfWarBox **I get every **PlayerCharacter **in the game and check the distance separating them with the Overlapping Character. If they are in **SightRange **I perform a Raycast between them (using a well setup visibility channel), if the Raycast is blocked by the targets in **SightRange **I tag both them as Visible for each other (this last visibility part of the system doesnt seem to be a problem multiplayer-wise).
We could imagine having between 6 and 14 players split into 2 different teams (shared vision). Maybe up to 30 different units with their own line of sight (I do realize that every unit added is another ActorInRange to check at each Box Overlapping).
The level is fully revealed, there is no “black mask”, I only want to deal with the Fog Of War and vision toggling.
If I build the FogOfWarBox as 5050Maximum height difference in the map I might even be able to build some verticality in the level.
So here it is.
I hope some more experienced fellow blueprint developers around here will take the time to look at this
In the meantime, have a good day !