- Home /
Fog of War Explored Area Gray out / un-updated areas
So I'm working with a RTS style game and I am unsure as how in SC2 or WC3 etc. when the player has explored an area and seen a building and left the area there appears to be a grayed out image of what was found in that area that doesn't update until the player returns to the region.
IE player sees a building, and it displays when he looks at that portion of the map and if it's destroyed but the area hasn't been explored since the building is destroyed it still displays that building on that player's view of the region. Also the player doesn't see any unit movement inside that area.
I am looking at two implementations using a shader that changes the alpha value of the aperture point where the camera sees the player seen here http://www.youtube.com/watch?v=yzcfTb9e0lo. The second is sort of a block veil plane that sits above the map and is changed when the player enters the region seen here http://www.youtube.com/watch?v=x40TDCjC4DY&list=PLDE92E64BE11FE309∈dex=17.
Are you asking how to do the entire FOW or just the hidden/unupdated objects?
The hidden/unupdated objects portion in previously explored areas but not currently occupied by anything that provides the player vision.
Just keep a different version of the object map for the player than the actual object map. Depends how your map/object list is done.
@yveris For objects, this is something that very much depends on your game world implementation and how your GameObjects are linked to the actual data. But in theory, the world would live separately from what the player "remembers".
For units, you can just hide them if the player can't see them. Layers is one option if your GameObjects depend on their Update calls.
For buildings, one way would be to store a secondary variable for each property of a building that can have player-specific data. So may be health_real
and health_playerLastSeen
. Every turn/update the world would update the real variables. But it would only update/match the player variables if they can see them at that time.
Then you render what the player variables say, not what the real state is. So building will burn if the player last saw it at low health, regardless of what is actually happening.
As for terrain, that will be handled differently, both your linked solutions would work.