Skip to content

Fog of war

Ryan Babij edited this page Feb 15, 2019 · 2 revisions

World map

Fog of war is a big deal. Units will reveal parts of the map as they move. This can be managed quite easily, because there will only be a few hundred units on the map at a time.

Local map

Managing fog of war on local maps will be much more difficult. A map could potentially have thousands of people on it at the same time. I think it will be impossible to have perfect line of sight algorithms running for all of them. Therefore some degree of abstraction will be necessary. If the player is far away, then line of sight might simply be a fixed range, regardless of obstacles.

Another difficult thing will be managing memory of places visited before. Doing this generally requires giving the Character its own map on which it can keep track of tiles it has and hasn't visited. In a world with a million people on it, this means a million maps. This can be optimised using something other than an array, however even so, if a million people visit a million different tiles, we're looking at over 100GB of space required.

Fortunately most Characters won't explore much of the map, because they will be busy doing their jobs. Therefore I might possibly get away with using this system. To start out I might only track fog of war for the player character, however I will need to consider this in the future.

Another thing to think about is what to do if a Character "uncovers" a tile, but then the tile changes later. Should they still see the old tile on their map? That would also be difficult to implement. However it would be cool if NPCs gave information based on knowledge which is not necessarily still correct.