Skip to content

Rapcampo/42_cub3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

141 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cube3D: Implementing raycasting for a Wolfenstein 3D-like experience!

Summary

A small first-person raycaster inspired by Wolfenstein 3D, built in C with a Xorg API library (minilibx). It renders a textured maze from a first-person perspective, parses a .cub scene file, and supports smooth window management and movement. This repository includes the bonus features: minimap and wall-collision handling.

✨ Features

  • Ray-casting engine that draws a 3D view of a 2D map.
  • Directional wall textures (N/S/E/W).
  • Independant and customisable floor and ceiling colours (takes RGB values).
  • Smooth rotation and movement with responsive keyboard controls.
  • Graceful exit via ESC or window close X button. Extensively tested for memory leaks and robust execution.
  • Bonus: Minimap and Wall collisions on the bonus version of the project.

🛠️ How to build

1 - Clone

git clone https://github.com/Rapcampo/42_cub3D.git

2 - On the project folder

make #builds the standard mandatory version
make bonus #builds the bonus version with minimap and collision

3 - Run one of the maps

./cub3D maps/valid/test.cub
./cub3D_bonus maps/valid/test.cub #for the bonus build

🎮 Controls

  • W / A / S / D — move the player in the maze.
  • ← / → — use the arrow keys to rotate the camera left/right.
  • ESC - Quit the game.

The Norm

The norm is set of rules stipulated by 42 for the pedagogical needs of the school. It enforces these rules through an open source tool called "Norminette", which the students can run to check if their code is complaint. Some of these rules are:

- No for, do...while, switch, case, goto, ternary operators and variable-length arrays are allowed
- Each function must be a maximum of 25 lines, not counting the function's curly brackets
- Each line must be at most 80 columns wide, comments included
- A function can take 4 named parameters maximum
- No assigns and declarations in the same line (unless static)
- You can't declare more than 5 variables per function
- 4 space tabulations
- and so on...
  • Norminette - The tool to enforce the 42 style of coding.
  • 42 Header - The header used by 42. To be used with Vim (or Neovim).

About

Implementing raycasting for a Wolfenstein 3D experience!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors