This project is inspired by the world-famous Wolfenstein 3D game, which was the first FPS ever. It enable us to explore ray-casting. Our goal was to make a dynamic view inside a maze, in which we had to find your way.
Demo gameplay showing menus.
Demo gamplay showing weapons, crosshair, enemies and doors.
- Math applied to computer science
- Computer graphics
- Game events management
- Algorithms
- Trigonometry
- Bitwise operation
- Project management
- Clone the repository
git clone https://github.com/adrianofaus/cub3D_ecole42.git
- Run
make
to compile common part andmake bonus
to bonus part - To clean objects files execute:
make clean
- To clean executable file and objects:
make fclean
- Recompile:
make re
- Run
./cub3D
or./cub3D_bonus
followed by map path e.g../maps/map_0.ber
To run the game, you must pass as first argument a scene description file with the .cub extension.
The file must have 6 element identifiers:
-
'NO'
,'SO'
,'WE'
and'EA'
: Represents the wall texture path on each direction. -
'C'
,'F'
: Represents the RGB color scale of the floor and celling respectively.
For example:
NO ./assets/xpm/walls/blue_wall_01.xpm
SO ./assets/xpm/walls/blue_wall_02.xpm
WE ./assets/xpm/walls/blue_wall_02.xpm
EA ./assets/xpm/walls/blue_wall_01.xpm
F 220,100,0
C 225,30,0
The map construction is composed by the following characters:
Walls: '1'
Empty spaces inside: '0'
Empty spaces outside: ' '
Initial player direction: 'N'
, 'S'
, 'W'
or 'E'
Doors: 'D'
Enemies: 'e'
- It must be completely surrounded by walls
- It must have a player
Map example:
111111111111111111111
100001000000000000001
101000000000000000001
100S00100100100100101
100000000000000000001
100000100000000000001
111111111111111111111
- The
'→'
and'←'
keys of the keyboard allow you to look left and right in the maze. - The
'W'
,'A'
,'S'
, and'D'
keys allow you to move the point of view through the maze. - You can run holding
'Shift'
key. 'Esc'
key exits the game.
- Move the mouse to look left and right in the maze.
- The player shoots on left mouse click or
'Ctrl'
key. - The player opens the doors with
'E'
key. - The
'M'
key pauses the game and displays a menu. - Using
'→'
,'←'
,'↓'
and'↑'
arrows allows you to navigate through the menu. - Press
'Enter'
key to select an option in the menu.