Simple Raycasting with ClojureScriptAndrey Listopadov
This is a demo page for my post about the raycasting in ClojureScript. If you're interested, you can read more here.
To begin the game, click the canvas, and it will grab keyboard input. Press up and down keys to move, left and right to turn around. Shift makes left and right strafe. Use Escape to release the keyboard. Try to reach the yellow room to win!
Sliders control amount of rays, and angle between rays, changing field of view (FOV). Maximum FOV is 180°, but if the fish-eye compensation is toggled off, the upper boundary chages to 360° (the restriction is needed due to how compensation math is implemented). Note, that there might still be some distortion on higher values of FOV, even when fish-eye compensation is enabled.
If you want to learn more, the source code of this page is available here. The blog post also has additional code for drawing the player, overview map, and the rays which intersect with the walls on the map, indicating the view.