Cub3d is a 3D game engine project inspired by the famous game Wolfenstein 3D. The goal of this project is to create a simplified version of a ray-casting engine using the C programming language and the MinilibX graphical library. This project is part of the curriculum at 42 School.
- Basic 3D rendering using ray-casting
- Textured walls and floor
- Simple sprite rendering
- Mini-map display
- Basic player movement and collision detection
-
Clone the repository:
git clone https://github.com/vtrevisa/Cub3d.git cd Cub3d -
Install dependencies: Ensure you have the MinilibX library installed. You can find it in the
libsdirectory or install it separately. -
Compile the project:
make
Run the executable with a map file:
./cub3D maps/map_pdf.cubMap files (.cub) are used to configure the game's environment. A sample configuration is provided in the maps directory. The map file should contain the following elements:
- Resolution
- Textures (north, south, east, west, sprite)
- Floor and ceiling colors
- Map layout (1 for walls, 0 for empty spaces, 2 for sprites)
NO texture_1
SO texture_2
WE texture_3
EA texture_4
F 220,100,0
C 225,30,0
1111111111111111111111111
1000000000110000000000001
1011000001110000002000001
1001000000000000000000001
1111111110110000011100000
1000000000110000011101111
1111011111111101110000001
1111011111111101110101001
1100000011010101110000001
1000200000000000110000001
1000000000000000110000001
1111111111111111111111111
- W: Move forward
- S: Move backward
- A: Rotate left
- D: Rotate right
- Left Arrow: See left
- Right Arrow: See right
- ESC: Exit game
Cub3d is developed by vtrevisa, and renanbatista as part of the 42 School curriculum.