A first-person raycasting engine inspired by Wolfenstein 3D, developed in C using the MiniLibX graphical library.
The player can explore a 3D environment rendered from a 2D map, navigate around walls, through doors and rotate the camera in real time.
git clone
cd Cub3D
- For version without mini-map and animated sprite
cd mandatory
make all
-For version with mini-map and animated sprite
cd bonus
make all
./cub3D map/map_simple.cub
W: Move forward
S: Move backward
A: Move left
D: Move right
Touchpad / mouse: Rotate camera
ESC: Quit the game
- Robust map parsing and validation
- Custom raycasting engine
- Real-time 3D rendering based on a 2D map
- Smooth player movement and camera rotation
- Mini-map to guide player movement
- Animated sprite
- Descriptive error handling
- Raycasting calculates the distance from the player to the closest wall for each rendered column (projected wall slice).
The Digital Differential Analyzer (DDA) algorithm is used to detect wall intersections by advancing the ray through the grid cell by cell and checking horizontal and vertical crossings until a wall is hit.
-
Mouse movement updates the camera by tracking the latest and previous cursor positions.Each mouse movement creates a new node holding the latest cursor coordinates at the head of a linked list. The next node has the previous cursor coordinates. Two cursor coordinates are then compared to detect horizontal or vertical motion of player's view, which leads to update of the frame. A drawback of this approach is that it can produce memory leaks if the linked list grows unchecked.

