You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.