Cub3D is a 42 School team project that recreates a dynamic 3D view inside a maze using the MiniLibX graphics library. It implements raycasting, similar to the classic game Wolfenstein 3D, the first true First-Person Shooter (FPS) in video game history.
- Raycasting engine similar to Wolfenstein 3D
- MiniLibX-based rendering a simple X-Window (X11R6) programming API in C
- Textured walls inspired by Minecraft
- Configurable maps with textures and colors
- Player movement & interaction
- A Linux or macOS system
make,gcc, and necessary dependencies for MiniLibX
- Clone the repository:
git clone https://github.com/eel-brah/CUB3D.git cd CUB3D - Compile the project:
make
Run the compiled program with a map file:
./cub3d maps/m.cub| Action | Key |
|---|---|
| Move Forward | W |
| Move Backward | S |
| Strafe Left | A |
| Strafe Right | D |
| Look Left/Right | Arrow Keys / Mouse |
| Open/Close Doors | Space |
| Show/Hide Minimap | M |
| Show full Minimap | P |
| Show/Hide FPS | F |
| Cam View | CTRL + Mouse Click |
| Toggle Menu | Tab |
| Switch Items | Mouse Click / Scroll |
| Enable/Disable Mouse | Scroll Click |
Cam view requires you to be at least two blocks away from the wall to function.
Due to differences in the MiniLibX implementation between Linux and macOS, the FPS counter and menu are disabled on macOS. Additionally, mouse look (left/right movement) is disabled on Linux.
A sample map file (.cub) contains texture paths and floor/ceiling colors followed by a grid-based layout:
NO ./path_to_the_north_texture
SO ./path_to_the_south_texture
WE ./path_to_the_west_texture
EA ./path_to_the_east_texture
F 220,100,0
C 225,30,0
1111111111111111111111111
1000000000110000000000001
1011000001110000000000001
1001000000000000000000001
111111111011000001110000000000001
...
This project is part of the 42 School curriculum and is intended for educational purposes.