- navigate to the untextured directory and run “make”
- next run “./raycast”. To navigate map use arrow keys
- use “ctrl +” or “ctrl -” to change FOV(zoom in and out)
- you can also try fisheye mode by running “./raycast fisheye”
- still a work in progress
- Inspired by: https://lodev.org/cgtutor/raycasting.html (most of the math was from the article here)
- My implementation is done entirely in C from scratch using only the SDL library
- The basic idea here is that the map is a 2D square grid, with each square being either 0 (no wall), or a value greater than 0 (a wall with a certain color)
- The player effectively shoots out a bunch of rays in his FOV(field of vision), tracking how far each ray goes until it hits a wall. Then using that distance, we render a a vertical line, the size of which depends on the distance the ray traveled. Specifically the size of the vertical line is proportional to the inverse of the distance traveled(ie the closer the wall the larger the line drawn). After drawing all the lines we can render a view of the walls.