Cub3D is a project in the curriculum of the 42 coding school that involves creating a first-person 3D maze game using raycasting techniques. The objective is to build a program that generates a 3D representation of a maze and allows the player to navigate through it. The project is inspired by the game Wolfenstein 3D and requires the use of the MiniLibX library for graphics rendering.
- macOS operating system
- Solid CPU
Here's a preview of the game:
This gif showcases the immersive gameplay experience you can expect from Cub3D. Enjoy exploring the maze and battling your way through!
To run the Cub3D project, follow these steps:
- Clone the Cub3D repository.
- Build the project by running the
make bonus
command. - Execute the program by running the
./cub3D_bonus map_bonus.cub
command.
Make sure to provide the map.cub file as an argument when running the ./cub3D command. This file should contain the necessary information to generate the maze and configure the game.
The controls for playing Cub3D are as follows:
- Movement: Use the keys W, A, S, and D to move forward, left, backward, and right, respectively.
- Rotation: Use the left and right arrow keys (← and →) to rotate the view.
- Mouse Rotation: Alternatively, you can rotate the view by moving the mouse.
- Speed boost: Press SHIFT to activate a speed boost and move faster.
- Interaction: Use SPACE to open doors.
- Exit: Press ESC or click the red cross to exit the game.
The mandatory part of the Cub3D project includes the following features:
- Wall textures: The maze walls are rendered with textures.
- Sprite: A sprite is displayed within the maze.
- Limited controls: Only the keys W, A, S, and D are available for movement, and the left and right arrow keys for rotation.
In addition to the mandatory part, the Cub3D project offers bonus opportunities. The bonus part adds extra features and functionality to enhance the game. These may include:
-
Wall collisions: Implement collision detection with walls to prevent the player from passing through them.
-
Minimap system: Create a minimap display that provides an overview of the maze layout and the player's position.
-
Doors: Implement doors that can open and close, adding an interactive element to the game.
-
Animated sprite: Add animations to the sprite, such as walking or attacking animations, to bring it to life.
-
Rotate the point of view with the mouse: Enable the player to rotate the view using mouse movements, providing a more immersive experience.