README updated
This commit is contained in:
86
README.md
86
README.md
@@ -5,13 +5,34 @@
|
|||||||
## Description
|
## Description
|
||||||
<!-- Section that clearly presents the project, including its goal and a brief overview -->
|
<!-- Section that clearly presents the project, including its goal and a brief overview -->
|
||||||
|
|
||||||
cub3D is a graphical project inspired by early 3D games such as *Wolfenstein 3D*.
|
**cub3D** is a graphical programming project inspired by the classic game *Wolfenstein 3D*,
|
||||||
Its goal is to render a 3D representation of a maze from a 2D map using the **raycasting technique**, written entirely in C using MLX graphics library.
|
one of the first First-Person Shooters ever created.
|
||||||
|
|
||||||
This project renders a 3D view of a 2D map described in a '.cub' file.
|
The goal of this project is to build a **real-time 3D representation of a maze** from a **2D map**,
|
||||||
The player can move inside the map, rotate the camera and see textures walls, floor and ceiling.
|
using the **ray-casting technique**, written in **C** and rendered with **MLX42**.
|
||||||
|
|
||||||
This rendering is possible duo to classic **raycasting algorithm**, where one ray is cast per screen column to calculate wall distance and draw it correctly.
|
Each vertical stripe of the screen is rendered by casting a ray from the player’s
|
||||||
|
point of view, detecting wall intersections, computing distances, and projecting
|
||||||
|
textured walls with correct perspective.
|
||||||
|
Floor and ceiling colors are also rendered to complete the scene.
|
||||||
|
|
||||||
|
This project focuses on:
|
||||||
|
- Low-level graphics programming
|
||||||
|
- Mathematical projection
|
||||||
|
- Parsing and validation
|
||||||
|
- Real-time rendering performance
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Ray-casting rendering engine
|
||||||
|
- Directional wall textures (North, South, East, West)
|
||||||
|
- Floor and ceiling RGB colors
|
||||||
|
- Player movement and camera rotation
|
||||||
|
- Collision detection
|
||||||
|
- Strict `.cub` file parsing and validation
|
||||||
|
- Clean error handling and memory management
|
||||||
|
- MLX42 rendering loop
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,27 +41,42 @@ This rendering is possible duo to classic **raycasting algorithm**, where one ra
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
- Linux or macOS
|
- Linux or macOS
|
||||||
- MLX / MLX42
|
- CMake
|
||||||
- 'gcc' or 'clang'
|
- MLX42 / MLX
|
||||||
|
- C compiler (`gcc` or `clang`)
|
||||||
|
|
||||||
### Compilation
|
### Compilation
|
||||||
|
Clone the repository and run:
|
||||||
```bash
|
```bash
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
This will:
|
||||||
|
- Build MLX42
|
||||||
|
- Compile `libft`, `ft_printf`, and `get_next_line`
|
||||||
|
- Generate the `cub3d` executable
|
||||||
|
|
||||||
|
|
||||||
### Execution
|
### Execution
|
||||||
```bash
|
```bash
|
||||||
./cub3D assets/maps/example.cub
|
./cub3D assets/maps/map.cub
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The program requires **exactly one argument**: a valid `.cub` map file.
|
||||||
|
|
||||||
### Controls
|
### Controls
|
||||||
|
|
||||||
Use W, A, S and D to mover the player.
|
| Key | Action |
|
||||||
Use UP, DOWN, LEFT and RIGHT arrows to rotate camera.
|
|---|---|
|
||||||
Use ESC for exit the program.
|
| `W` | Move forward |
|
||||||
|
| `S` | Move backward |
|
||||||
|
| `A` | Strafe left |
|
||||||
|
| `D` | Strafe right |
|
||||||
|
| `←` | Rotate camera left |
|
||||||
|
| `→` | Rotate camera right |
|
||||||
|
| `ESC` | Exit the program |
|
||||||
|
|
||||||
|
|
||||||
### Map configuration (.cub)
|
### Map configuration (`.cub`)
|
||||||
|
|
||||||
A **.cub** file contains:
|
A **.cub** file contains:
|
||||||
- Wall textures (NO, SO, WE, EA)
|
- Wall textures (NO, SO, WE, EA)
|
||||||
@@ -49,15 +85,33 @@ A **.cub** file contains:
|
|||||||
- 1 for walls
|
- 1 for walls
|
||||||
- 0 for empty space
|
- 0 for empty space
|
||||||
- N, S, E or W for the player start position
|
- N, S, E or W for the player start position
|
||||||
|
- Spaces are allowed and handled correctly
|
||||||
|
|
||||||
The map is strictly validated:
|
The map is strictly validated:
|
||||||
- Exactly one player position
|
- Exactly **one** player position
|
||||||
- Fully closed by walls
|
- Map must be **fully closed by walls**
|
||||||
- Only valid characters
|
- Only valid characters
|
||||||
|
- No empty lines inside the map
|
||||||
- RGB values between 0 and 255
|
- RGB values between 0 and 255
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
111111
|
||||||
|
100001
|
||||||
|
1000N1
|
||||||
|
111111
|
||||||
|
```
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
<!-- section listing classic references related to the topic, as well as a description of how AI was used - specifying for which tasks and which parts of the project -->
|
|
||||||
|
|
||||||
|
### AI Usage
|
||||||
|
|
||||||
|
AI tools were used only as assistance, specifically for:
|
||||||
|
- Understanding ray-casting concepts
|
||||||
|
- Improving documentation clarity
|
||||||
|
- Reviewing logic and edge cases
|
||||||
|
|
||||||
|
All generated content was reviewed, understood, and manually implemented.
|
||||||
|
No AI-generated code was copied blindly into the project.
|
||||||
|
|
||||||
<!-- ADITIONAL SECTIONS MAY BE REQUIRED DEPENDING ON THE PROJECT (usage examples, feature list, technical choices, etc... -->
|
|
||||||
|
|||||||
Reference in New Issue
Block a user