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.
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.