cub3D is a raycasting project that renders a first-person 3D graphical representation of a maze, inspired by Wolfenstein 3D. The project utilizes the MiniLibX graphics library and implements fundamental raycasting principles to simulate a pseudo-3D environment.
- Raycasting rendering for realistic 3D visualization
- Smooth window management (minimizing, switching, etc.)
- Wall textures based on direction (North, South, East, West)
- Custom floor and ceiling colors
- Player movement using
W
,A
,S
,D
- Camera rotation using arrow keys
- Clean program exit via
ESC
key or window close button - Configurable map format (
*.cub
)
make
MiniLibX
libft
(custom standard function library)
To compile cub3D, run:
make
This will generate the cub3D
executable.
To compile cub3D bonus (see Bonus Features), run:
make bonus
This will generate the cub3D_bonus
executable.
To remove object files:
make clean
To remove the executable and object files:
make fclean
To recompile everything:
make re
make re_bonus
Run the program with a valid .cub
map file:
./cub3D map/example.cub
./cub3D_bonus map/example.cub
Key | Action |
---|---|
W |
Move forward |
A |
Move left |
S |
Move backward |
D |
Move right |
← |
Look left |
→ |
Look right |
SHIFT |
Increase player speed |
ESC |
Exit game |
Window close | Exit game |
P |
Open door (bonus) |
The map must be provided in a .cub
file and follow specific formatting rules:
- Wall textures:
NO ./path_to_north_texture SO ./path_to_south_texture WE ./path_to_west_texture EA ./path_to_east_texture
- Floor & ceiling colors:
F 220,100,0 # RGB format C 225,30,0
- Map layout:
1
- Wall0
- Empty spaceN
,S
,E
,W
- Player start positionD
- Door (bonus)
111111 100101 101001 1100N1 111111
- The map must be fully enclosed by walls (
1
). - Elements must appear before the map in the file.
The bonus version includes:
- Wall collision detection
- Minimap system
- Doors that open and close
- Mouse-controlled rotation
This project is developed as part of the 42 curriculum and follows its academic integrity guidelines.