Difference between revisions of "Field of Vision"

From RogueBasin
Jump to navigation Jump to search
 
Line 1: Line 1:
It's common to check the visiblity of many objects from one point on the map. For example, you might want to know which parts of map are visible from the place the player character is standing, to draw those parts of map on the screen.
It's common to check the [[visiblity]] of many objects from one point on the map. For example, you might want to know which parts of map are visible from the place the player character is standing, to draw those parts of map on the screen.


You might just use the [[Line of Sight]] to check all the map squares in range, but that's pretty slow, and you're repeating most of the calculations mulitple times. It is much better to calculate the [[Field of Vision]] as a whole.
You might just use the [[Line of Sight]] to check all the map squares in range, but that's pretty slow, and you're repeating most of the calculations mulitple times. It is much better to calculate the [[Field of Vision]] as a whole.
Line 14: Line 14:


* [[Recursive shadow casting]]
* [[Recursive shadow casting]]
[[Category:Algorithms]]

Revision as of 19:42, 18 September 2005

It's common to check the visiblity of many objects from one point on the map. For example, you might want to know which parts of map are visible from the place the player character is standing, to draw those parts of map on the screen.

You might just use the Line of Sight to check all the map squares in range, but that's pretty slow, and you're repeating most of the calculations mulitple times. It is much better to calculate the Field of Vision as a whole.

There are several ways to do it:

  • Light whole level. Just make everything visible, or at least everything close to the player. Many games use this approach and it seems to work.
  • Light whole room. This is the apporach used by the original Rogue. You just make the whole room in which the player character is visible, and all other parts of map -- not visible. When the character is in a corridor, it can only see one square from where he stands -- this doesn't require any sophisticated calculations.