Using miniLibX and ray-casting principles we created a “realistic” 3D graphical representation of a maze from a first-person perspective, modelled on the style of Wolfenstein 3D.
The program displays the image in a window and respects the following rules:
- The left and right arrow keys of the keyboard allow the player to look left and right in the maze.
- The W, A, S, and D keys allow the player to move the point of view through the maze.
- Pressing ESC will close the window and quit the program cleanly.
- Clicking on the red cross on the window’s frame will close the window and quit the program cleanly.
make./cub3d ./maps/map_tech.berRaycasting is a rendering technique used to create a 3D perspective in a 2D map.
It works by projecting rays from the player’s position at regular angular intervals across their field of view. Each ray travels until it hits a wall, and the distance determines the apparent height of the wall on the screen.
AI was used to handle the mathematics involved in ray casting and the DDA algorithm.