Digital field of view
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.
- Symmetric field of view.
- Completely artifact free.
- O(N2) 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
- 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.
- An improvement over beam casting, where instead of beams, octants are cast in 8 directions, is a part of the 7DRL game Kusemono, with a freely available C implementation.
- 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.
- One such conversion of PFOV is based on the recursive shadow casting PFOV algorithm that scans whole quadrants and is a part of LambdaHack and Allure of the Stars. The resulting algorithm is simpler and faster than the original PFOV algorithm, because DFOV has less special cases and inspects tiles in an order matching horizontal dungeon walls. See a discussion of this DFOV (and PFOV) algorithm with links to the Haskell source code.
What games use it?
- DoomRL (as it focuses on ranged combat, it really needs digital lines to represent the aiming direction)
- Kusemono (7DRL_Contest_2011_Reviews#Oohara_Yuuma.27s_Kusemono)
- Allure of the Stars.
What libraries implement it?