A “realistic” 3D graphical representation of the inside of a maze from a first-person perspective. You have to create this representation using the Ray-Casting principles.
- Introduction
- Requirements
- Installation
- Usage
- Features
- Controls
- Preview
- Contributors
- Resources
- License
The cub3d project is a simple 3D game engine that uses a 2D map to generate 3D visuals using raycasting. The goal of the project is to get familiar with computer graphics, understanding basic rendering algorithms, and working with textures, colors, and the player perspective.
- MinilibX: The project uses the MinilibX library for graphics rendering.
- GNU Make: For compiling the project.
- gcc: GNU Compiler Collection.
- OS: The project is built and tested on macOS and Linux distributions.
-
Clone the repository:
git clone https://github.com/amineichou/Cub3d.git cd cub3d -
Compile the project:
- For mandatory part :
make
- For bonus part :
make bonus
This will generate an executable named
cub3d.
-
Run the program by providing a map file in
.cubformat:- For mandatory part :
./cub3d Mandatory/maps/valid.cub
- For bonus part :
./cub3d_bonus Bonus/maps/valid.cub
-
In the map file
.cub:1represents a wall.0represents empty space.Drepresents a door.S E W Nrepresents player position, where :- S: Player starts facing South.
- E: Player starts facing East.
- W: Player starts facing West.
- N: Player starts facing North.
-
The map configuration also includes
texturepaths for the walls, defined as follows:
- NO: Path to the texture for the north-facing wall.
- SO: Path to the texture for the south-facing wall.
- WE: Path to the texture for the west-facing wall.
- EA: Path to the texture for the east-facing wall.
Example:
NO textures/tx_1.png
SO textures/tx_2.png
WE textures/tx_3.png
EA textures/tx_4.png- The map also defines the colors for the floor and ceiling in RGB format:
- F: Floor color
- C: Ceiling color
Example:
floor color
F 16, 16, 255ceiling color
C 135, 206 , 235Raycasting: Render a 3D view of the world using a raycasting algorithm.Textures: Wall textures applied.Sprites & animation: Rendering of sprites like doors and animation like shooting.Minimap: 2D overview of the map in real-time.BasicCollision Detection: Prevents the player from moving through walls.Different Map Inputs: Custom maps can be created with .cub files.
W: Move forward
S: Move backward
A: Move left
D: Move right
Left Arrow: Rotate view left
Right Arrow: Rotate view right
space: gun shoot
ESC: Exit the game
This project is licensed under the MIT License - see the LICENSE file for details.


