# Digital field of view

From RogueBasin

(Difference between revisions)

m |
(→How do I implement it?) |
||

Line 20: | Line 20: | ||

* [[Digital field of view implementation]] is Zeb's explanation for his own algorithm, based on a method similar to beam casting. | * [[Digital field of view implementation]] is Zeb's explanation for his own algorithm, based on a method similar to beam casting. | ||

− | * Any working [[Permissive Field of View]] algorithm can be turned into a digital field of view algorithm by rotating the grid by 45 degrees, and changing some of the corner cases. The resulting algorithm can be simpler and faster than the original PFOV algorithms, because DFOV has less special cases and inspects tiles in an order matching horizontal dungeon walls. See [https://github.com/Mikolaj/LambdaHack/wiki/Fov-and-los] for such a simple recursive-shadow-casting-like version of DFOV (and PFOV) included in [[LambdaHack]]. | + | * Any working [[Permissive Field of View]] algorithm can be turned into a digital field of view algorithm by rotating the grid by 45 degrees, and changing some of the corner cases. The resulting algorithm can be simpler and faster than the original PFOV algorithms, because DFOV has less special cases and inspects tiles in an order matching horizontal dungeon walls. See [https://github.com/Mikolaj/LambdaHack/wiki/Fov-and-los] for such a simple recursive-shadow-casting-like version of DFOV (and PFOV) included in [[LambdaHack]]. There also seems to be one coded in C at [http://www.interq.or.jp/libra/oohara/digital-fov/index.html]. |

==What games use it?== | ==What games use it?== |

## Revision as of 23:20, 18 September 2011

## Contents |

## What is Digital Field of View?

Digital Field of View is a method of determining Field of Vision based on Digital lines. Geometrically, all objects are considered to be diamond shaped, and the source diamond can see the destination diamond if there is an unobstructed line connecting them.

## Advantages

- Symmetric field of view.
- Completely artifact free.
- O(N
^{2}) algorithm available. - More permissive than Permissive Field of View.
- It is easy to check by hand whether there is a digital line connecting two points.
- Targeting line is easily drawn in case of ranged combat

## Disadvantages

- Few implementations exist yet.
- Could be too permissive.

## How do I implement it?

- Digital field of view implementation is Zeb's explanation for his own algorithm, based on a method similar to beam casting.
- Any working Permissive Field of View algorithm can be turned into a digital field of view algorithm by rotating the grid by 45 degrees, and changing some of the corner cases. The resulting algorithm can be simpler and faster than the original PFOV algorithms, because DFOV has less special cases and inspects tiles in an order matching horizontal dungeon walls. See [1] for such a simple recursive-shadow-casting-like version of DFOV (and PFOV) included in LambdaHack. There also seems to be one coded in C at [2].

## What games use it?

DoomRL (as it focuses on ranged combat, it really needs digital lines to represent the aiming direction)

## What libraries implement it?

None.