This project is inspired by the game Wolfenstein 3D. The goal of the project is to create a simple graphic engine capable of rendering a 3D maze using the Raycasting technique.
This project was developed in colaboration with teroVF.
- 3D maze rendering using Raycasting.
- Wall textures support.
- Player movement with WASD keys.
- Player vision rotation with arrow keys.
- Map defined in a .cub file.
Before compiling and running the project, make sure you have the MiniLibX installed in project folder. For that, after cloning, it's necessary to extract the contents of the minilibx-Linux.tgz
file, rename the folder with the name mlx
, and copy and paste this in the folder lib
.
To compile the project, run:
make
This will compile the source files and generate the cub3D
executable.
After compilation, you can run the game using the following command:
./cub3D <map>
Replace <map>
with the path to the map file you want to use. The map file should have the .cub
extension and follow the format specified in the project. Inside the assets/maps
folder there are folders with some examples of valid and invalid maps.
The maze map is defined in a .cub file. Example:
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 15,15,15
111111
100001
101101
10N001
111111
NO
,SO
,WE
,EA
: Paths to wall textures.F
: Floor color in RGB format.C
: Ceiling color in RGB format.- The map is represented using the letters
0
(empty space) and1
(wall), and the spawn point with the orientationN
,S
,E
orW
. The map must be surrounded by walls.
- W: Move forward.
- S: Move backward.
- A: Move left.
- D: Move right.
- Arrow keys: Rotate player's vision.
- ESC: Exit game.