Field of Vision | Visibility Algorithm

by Hanzhe
  scripts
  sprites
See inside
Instructions

Here's an algorithm on Field of Vision, or visibility algorithm. This generates visible areas and non-visible areas (shadows).

Visible areas are where the player can see, and are shown in white.
Non-visible areas are the dark portion of the map.

Use a/w/s/d to move, use your mouse to generate walls. Use the map variable to switch between maps.

Notes and Credits

All code and art by me.

Welp, this took me a while. Idk how this can be used in a game or anything but whateves. Let me know if there's a faster way to draw triangles. (see the triangle drawing function inside)

- Improved the speed by a bit.

Shared: 15 Sep 2017 Modified: 26 Sep 2017
Favorite this project 24
Love this project 57
Total views 335
View the remix tree  1
  
More projects by Hanzhe