Fog of War

Blitz3D Forums/Blitz3D Programming/Fog of War

Poita(Posted 2006) [#1]
How could I implement Fog of War in an RTS with no terrain. i.e in space.

Cheers


RifRaf(Posted 2006) [#2]
depends..

one way would be.
All interactive objects such as player characters, and trees ect. that are "part of the action" get a flag for visibility. Also give them a playertype flag.

Since you have to cycle through them anyway for other reasons, in that same cycle you check if any of the local player characters are close to any other type of action object. if so you flag them as "seen" otherwise they remain "unseen".

If seen in the cycle you hide an object, otherwise you allow it to be rendered and unhide it.

You can go a step farther and if an object is somthing like a tree or rock ect. once seen, it cannot be hidden again, this would effectively give you the once explored always viewable effect for terrain objects, but then you could also have the only seen when you are close enough effect for enemy players .. much like warcraft.

another way..
For generic FOW effect you could create a grid of quads between the terrain and cameraheight. make them black or texture them with whatever. (you could even make them semi round, and overlap them for a more natural fog look).

Then if the player characters are under a fog grid, you hide it.. thus you get the once explored always seen. If you also give the quads a pickmode, then you cannot pick though them, and effectively cannot select objects that are still in the fog.

You can go a step farther with this, and for each fog quad you hide, or delete.. all surrounding quads get an alpha value of .9 and .8.. this would give the fade out effect from where you have been


Poita(Posted 2006) [#3]
Thanks. That was exactly what I was after...

Makes things much easier :)


Sir Gak(Posted 2006) [#4]
Um, what's Fog of War? A game? A special effect?


Poita(Posted 2006) [#5]
Have you ever played any real time strategies like Command & Conquer or Age of Empires, Total Annihilation etc?

Fog of war is also known as 'shroud' and is basically what you can't see. It usually just makes all the map that you can't see black or faded.