This project is a graphic design project, inspired by the famous game Wolfenstein 3D. We need to create a "realistic" 3D graphical representation of the inside of a maze from a first person perspective, using Ray-Casting principles.
This project also enables us to improve skills in: windows, colors, events, fill shapes, etc.
- Allowed functions:
open
,close
,read
,write
,malloc
,free
,perror
,strerror
,exit
, all functions of themath
library and theMinilibX
library - All heap allocated memory space must be properly freed when necessary
- Management of window must remain smooth
- Allow for the display of different wall textures
- Allow for setting the floor and ceilling colors to two different colors
- Program must take a scene description file as a first argument
This repo provides two versions (Linux & MacOS), due to major differences between these two operating systems:
- The
MinilibX
library needs to be compiled differently on Linux and MacOS ft_reset_resolution()
function from theMinilibX
library is not provided on the Linux version- The keycode value for movement and closing windows are different
If you are on a Linux distribution, make sure that you installed the packages below:
sudo apt-get update && sudo apt-get install xorg libxext-dev zlib1g-dev
Run the following commands. A few map files (
xx.cub
) are provided in themaps
directory. Replacechoose_one_file.cub
with the file of your choice
$ git clone https://github.com/qingqingqingli/cub3d
# choose linux / MacOS based on your operation system
$ cd cub3d/linux_version
$ make
$ ./cub3d maps/choose_one_file.cub
- Create the
cub3d
executable. A window will pop up when you run the executable with a map file
- Press
W / A / S / D
key to move andLeft / Right
key to rotate