A raycasting-based 3D game engine inspired by Wolfenstein 3D, developed as part of the School 42 curriculum. This project implements fundamental computer graphics concepts to create a dynamic first-person perspective in a maze environment.
-
3D Rendering Engine
- Raycasting-based rendering
- Textured walls with different textures for each direction (N,S,E,W)
- Dynamic view with proper perspective
- Configurable floor and ceiling colors
-
Player Controls
- Smooth movement using W,A,S,D keys
- Camera rotation with left/right arrow keys
- Wall collision detection
- Field of view management
-
Map System
- Custom map format (.cub)
- Dynamic map loading
- Support for different map sizes
- Validated map parsing with error handling
- GCC compiler
- Make build system
- MLX42 graphics library
- Math library (-lm)
- GLFW library (-lglfw)
- Clone the repository:
git clone https://github.com/yourusername/cub3D.git
cd cub3D- Install dependencies (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install build-essential libglfw3-dev- Build the project:
makeRun the program with a map file:
./cub3D asset/map/ninja_temple.cubThe map file should contain:
NO ./path_to_north_texture.png # North wall texture
SO ./path_to_south_texture.png # South wall texture
WE ./path_to_west_texture.png # West wall texture
EA ./path_to_east_texture.png # East wall texture
F 220,100,0 # Floor RGB color
C 225,30,0 # Ceiling RGB color
# Map layout (1 = wall, 0 = floor, N/S/E/W = player start position)
111111
100101
101001
1100N1
111111
- W - Move forward
- S - Move backward
- A - Strafe left
- D - Strafe right
- ← - Rotate camera left
- → - Rotate camera right
- ESC - Exit game
.
├── src/
│ ├── ch0/ # Scene/Map parsing
│ ├── ch1/ # Window management
│ ├── ch2/ # Raycasting engine
│ └── ch3/ # Texture management
├── include/ # Header files
├── lib/ # External libraries
└── assets/ # Textures and maps
- Scene parsing and map validation
- Window and event management
- Ray-casting engine implementation
- Texture mapping system
- Performance optimization
- Wall collision detection
- Player movement and rotation
- Error handling and memory management
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- School 42 for the project subject
- Id Software for the original Wolfenstein 3D
- MLX42 library maintainers
- The GLFW team
J Felipe D Stieven - @jos-felipe
Project Link: https://github.com/jos-felipe/cub3D