Cub3D is a 42 school team project to create a dynamic view inside a 3D maze. Using the MiniLibX library, we must implement raycasting in the style of the famous Wolfenstein 3D game, the first true FPS in videogame history.
This project has been archived in the state it was in at the time of evaluation.
Validated 12/02/2023. Grade: 115%.
Clone the repository including the MiniLibX submodule:
git clone --recursive https://github.com/mcombeau/cub3D.git
Or:
git clone https://github.com/mcombeau/cub3D.git
git submodule update --init --recursive
There are two versions of the program, the mandatory part and the bonus part. The bonus part adds wall collision, a minimap, and the ability to rotate the view by moving the mouse.
To compile the mandatory part, cd
into the cloned directory and:
make
To compile the bonus part, cd
into the cloned directory and:
make bonus
Note: you may need to make fclean
to switch between the mandatory and bonus compilations (working on a fix for this!).
To run the program:
./cub3d <path/to/map.cub>
The program takes a map file as an argument. Maps are available in the maps
directory. There are good maps which the program should run smoothly with, and bad maps which the program should reject.
For example:
-
./cub3d maps/good/library.cub
should run. -
./cub3d maps/bad/filetype_wrong.buc
should print an error and abort.
Controls for movement and rotation are:
W
: move forwardS
: move backwardA
: strafe leftD
: strafe rightleft arrow
: rotate leftright arrow
: rotate rightmouse
: rotate by moving the mouse (bonus only)
Useful resources for this project are:
- Minilibx: hsmits MiniLibX documentation
- Minilibx: gontjarow's MiniLibX tutorial
- Xlib (for MLX events): The Xlib Manual
- Raycasting: Lode's Computer Graphics Tutorial - Raycasting
- Raycasting: Permadi's Raycasting tutorial
- Movement: Calculating heading in 2d games: Using trigonometric functions part 1
Made by aquesada and mcombeau