Sign in to follow this  
Telastyn

Fog of War

Recommended Posts

I'm interested in hearing some experiences and getting some links for implementing fog of war. Not the actual fog, but internal representations and processing of what is visible and what is not. If it matters, the target application is your standard 2d turn based 4X game, ala civilization. I'm looking to have a non-boolean fog, where players discover tiles, but then wouldn't recieve updates about them after the tile leaves visual range. The tricky part in my thinking is not so much the discovery of tiles as determining when discovered tiles then leave visual range of all player agents.

Share this post


Link to post
Share on other sites
In my previous project, i just went through the entire map and updated each tile. My tiles had 3 states: undiscovered, unseen, and seen. Once a tile is discovered, it doesn't need to be recomputed. But for visibility, i reset all tiles to "unseen" and then loop through all the game units and cast a circle around each one. Everything in the circle is "visible". After looping though all the game units, you have a completely updated map every turn.

This is of course a very inefficient way to do it. But it works and was plenty fast so i had no intentions of doing it some other way.

Share this post


Link to post
Share on other sites
A faster way to do it would be to store an integer for the visibility status of each tile, and each time a unit moves, decrement the value for each tile it can currently see then increment the value for each tile it can see after the movement. This way, you only need to do a full visibility pass at the start of the game, which will probably only involve a few units at most.

Share this post


Link to post
Share on other sites
Quote:
Original post by Extrarius
A faster way to do it would be to store an integer for the visibility status of each tile, and each time a unit moves, decrement the value for each tile it can currently see then increment the value for each tile it can see after the movement. This way, you only need to do a full visibility pass at the start of the game, which will probably only involve a few units at most.


Hmmm... thanks.

* files idea away for later *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this