Skip to content

jlebre/42Cub3d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42Cub3D

42 School Logo

🕹️ 42 Cursus - Cub3D

Cub3D is the final C project in the 42 curriculum, where we implemented a basic raycasting engine inspired by Wolfenstein 3D.

This was a group project:

The project took around 2 months to complete, using the original textures from Wolfenstein 3D.

One of the biggest challenges was correctly mapping the X-coordinate of a texture onto a wall.


📸 Gallery

Screenshot

Screenshot

Recording.2023-05-10.020203.mp4
Recording.2023-05-10.020825.mp4

⚙️ Installation

git clone https://github.com/jlebre/42Cub3d.git
cd 42Cub3d/
make

To run the game:

./cub3d "map"

Available maps:

./cub3d basic.cub
./cub3d info.cub

You can create custom maps as long as they follow the constraints in The Assignment section.

To compile and run basic.cub in one command:

make a

📜 The Assignment

The goal was to build a 3D labyrinth game with first-person view, inspired by Wolfenstein 3D.

Key Requirements

  • Use MiniLibX for rendering.
  • Smooth window management (switching, minimizing, etc.).
  • Textured walls that vary based on orientation (N, S, E, W).
  • Custom floor & ceiling colors.
  • Keyboard controls:
    • W, A, S, D → Move player
    • ←, → → Rotate view
    • ESC → Exit game
  • Clicking the window’s close button should properly exit.
  • Parse .cub files for game settings & map layout.
  • The map must be enclosed by walls (1 for walls, 0 for empty space, N/S/E/W for player spawn position).

Example of a valid .cub map:

111111
100101
101001
1100N1
111111

Texture & Color Configuration

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 225,30,0

If any error is found in the configuration file, the program must exit with:

Error
[Description of the issue]

🎮 Features

✔️ Working compass

✔️ Minimap FOV matches actual player vision

✔️ Pause menu (P key)

✔️ Toggle minimap (M key)

✔️ Lives system (press - to lose a life, game stops at 0)

⚠️ The settings icon is not functional.


🏆 Final Grade: 115/100

We completed 3 out of 5 possible bonus features:

✔️ Wall collisions

✔️ Mini-map system

✔️ Move FOV with mouse

Screenshot


🎤 Conclusion

This was one of the most enjoyable projects I’ve worked on! Seeing visual progress made it extra rewarding.

This might be my favorite project so far, and I’d love to add more features in the future. 🚀