Difference between revisions of "Shadow casting"

From RogueBasin
Jump to navigation Jump to search
(Added articles, a couple of advantages/disadvantages and a link to libfov.)
 
m (added doryen-fov implementation)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==What is Shadow Casting?==
==What is Shadow Casting?==
Shadow casting is a way to implement [[Field of Vision]]. In shadow casting, a destination square is visible from a source square if there exists an unobstructed line from the center of the source square to any point in the destination square. There are several efficient algorithms to accomplish this, including two which only visits squares that are visible ([[Spiral Path FOV]] and [[FOV using recursive shadowcasting]]).


==Advantages==
==Advantages==
Line 9: Line 11:
==Disadvantages==
==Disadvantages==


* Some counter-intuitive results
* Some artifacts (corners of rooms, for example).
* Non-symmetric, making it awkward for some implementations of ranged combat.


==How do I implement it?==
==How do I implement it?==
Line 16: Line 19:
* [[FOV using recursive shadowcasting]]
* [[FOV using recursive shadowcasting]]
* [[FOV using recursive shadowcasting - improved]]
* [[FOV using recursive shadowcasting - improved]]
* [[Improved Shadowcasting in Java]]
* [[Spiral Path FOV]]
* [[Spiral Path FOV]]
* [[Precise Shadowcasting in JavaScript]]


==What games use it?==
==What games use it?==
Line 24: Line 29:
==What libraries implement it?==
==What libraries implement it?==


* [[libfov]] is a C++ library which implements recursive shadow casting.
* [[SquidLib]] is a Java library which includes an easy to read recursive shadowcasting algorithm.
* [[libfov]] is a C library which implements recursive shadow casting.
* [[Roguelike Library For Java]] provides an implementation of shadow casting in Java.
* [[libtcod]]
* [[rot.js]] implements Precise Shadowcasting
* ([https://github.com/jice-nospam/doryen-fov doryen-fov]) implements it in Rust
 
[[Category:FOV]]

Latest revision as of 08:18, 14 June 2019

What is Shadow Casting?

Shadow casting is a way to implement Field of Vision. In shadow casting, a destination square is visible from a source square if there exists an unobstructed line from the center of the source square to any point in the destination square. There are several efficient algorithms to accomplish this, including two which only visits squares that are visible (Spiral Path FOV and FOV using recursive shadowcasting).

Advantages

  • Moderately easy to implement
  • Efficient
  • Existing library

Disadvantages

  • Some artifacts (corners of rooms, for example).
  • Non-symmetric, making it awkward for some implementations of ranged combat.

How do I implement it?

What games use it?

Most modern games use shadow casting.

What libraries implement it?

  • SquidLib is a Java library which includes an easy to read recursive shadowcasting algorithm.
  • libfov is a C library which implements recursive shadow casting.
  • Roguelike Library For Java provides an implementation of shadow casting in Java.
  • libtcod
  • rot.js implements Precise Shadowcasting
  • (doryen-fov) implements it in Rust