Difference between revisions of "Field of Vision"

From RogueBasin
Jump to navigation Jump to search
(Added a link to a new fov library for permissive-fov. Added permissive-fov to the list of approaches.)
m (Removed 'recursive shadow casting' as an approach. I'll address that later when I do the shadow casting page.)
Line 2: Line 2:


There are basically two ways to achieve this; by using [[Line of Sight]] to check all the map squares in range, which is a slow method as it repeats most of the calculations multiple times, or by calculating the [[Field of Vision]] as a whole.
There are basically two ways to achieve this; by using [[Line of Sight]] to check all the map squares in range, which is a slow method as it repeats most of the calculations multiple times, or by calculating the [[Field of Vision]] as a whole.
== Approaches ==


Some of the most common approaches to field of vision are:
Some of the most common approaches to field of vision are:
Line 8: Line 10:
* [[Ray casting]]
* [[Ray casting]]
* [[Shadow casting]]
* [[Shadow casting]]
* [[Recursive shadow casting]]
* [[Permissive Field of View]] (new and uncommon)
* [[Permissive Field of View]] (new and uncommon)


== Refinements ==
There are other refinements that can be applied to any approach:
* [[An Efficient Observation Algorithm]] may allow fewer squares to be visited.


== Available Libraries ==
== Available Libraries ==

Revision as of 02:43, 27 April 2007

Some of the most important features on roguelikes, including the presentation of the area that surrounds the player character, require to check the visibility of an object from a given point on the map. For example, it may be necessary 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.

There are basically two ways to achieve this; by using Line of Sight to check all the map squares in range, which is a slow method as it repeats most of the calculations multiple times, or by calculating the Field of Vision as a whole.

Approaches

Some of the most common approaches to field of vision are:

  • 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 approach 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.
  • Ray casting
  • Shadow casting
  • Permissive Field of View (new and uncommon)

Refinements

There are other refinements that can be applied to any approach:

Available Libraries