Cub3D is the final C project in the 42 curriculum, where we implemented a basic raycasting engine inspired by Wolfenstein 3D.
This was a group project:
- Raycasting & Graphics: José Maria Lebre
- Parsing & Map Handling: mtavares
The project took around 2 months to complete, using the original textures from Wolfenstein 3D.
One of the biggest challenges was correctly mapping the X-coordinate of a texture onto a wall.
Recording.2023-05-10.020203.mp4
Recording.2023-05-10.020825.mp4
git clone https://github.com/jlebre/42Cub3d.git
cd 42Cub3d/
make
To run the game:
./cub3d "map"
Available maps:
./cub3d basic.cub
./cub3d info.cub
You can create custom maps as long as they follow the constraints in The Assignment section.
To compile and run basic.cub
in one command:
make a
The goal was to build a 3D labyrinth game with first-person view, inspired by Wolfenstein 3D.
- Use MiniLibX for rendering.
- Smooth window management (switching, minimizing, etc.).
- Textured walls that vary based on orientation (N, S, E, W).
- Custom floor & ceiling colors.
- Keyboard controls:
W, A, S, D
→ Move player←, →
→ Rotate viewESC
→ Exit game
- Clicking the window’s close button should properly exit.
- Parse
.cub
files for game settings & map layout. - The map must be enclosed by walls (
1
for walls,0
for empty space,N/S/E/W
for player spawn position).
Example of a valid .cub
map:
111111
100101
101001
1100N1
111111
NO ./path_to_north_texture
SO ./path_to_south_texture
WE ./path_to_west_texture
EA ./path_to_east_texture
F 220,100,0
C 225,30,0
If any error is found in the configuration file, the program must exit with:
Error
[Description of the issue]
✔️ Working compass
✔️ Minimap FOV matches actual player vision
✔️ Pause menu (P
key)
✔️ Toggle minimap (M
key)
✔️ Lives system (press -
to lose a life, game stops at 0)
We completed 3 out of 5 possible bonus features:
✔️ Wall collisions
✔️ Mini-map system
✔️ Move FOV with mouse
This was one of the most enjoyable projects I’ve worked on! Seeing visual progress made it extra rewarding.
This might be my favorite project so far, and I’d love to add more features in the future. 🚀