A 42 School project recreating Wolfenstein 3D-style raycasting in C
cub3D is a minimalist 3D raycasting engine inspired by Wolfenstein 3D.
Built from scratch in C using MiniLibX, it transforms 2D maps into interactive 3D environments through mathematical rendering.
🛠️ Technical Highlights
- Raycasting engine using DDA algorithm
- Dynamic rendering of textured walls/floors
- Smooth controls: WASD + mouse look
- Configurable maps via
.cubfiles - Optimized for 60+ FPS
- Linux/WSL2 (or macOS with X11)
- MiniLibX (included in the repo)
- C Compliler(
cc/gcc/clang) - GNU Make
sudo apt-get install gcc make xorg libxext-dev libbsd-devbrew install libx11Open PowerShell as Administrator. Use the command:
Invoke-WebRequest -Uri "https://netcologne.dl.sourceforge.net/project/vcxsrv/vcxsrv/1.20.14.0/vcxsrv-64.1.20.14.0.installer.exe" -OutFile "$env:USERPROFILE\Downloads\vcxsrv-installer.exe"Use the command:
Start-Process -Wait -FilePath "$env:USERPROFILE\Downloads\vcxsrv-installer.exe" -ArgumentList "/S"- Set display srttings to
Multiple windows - Start with no client
- Tick
disable access control - Finish
In powershell use the command:
ipconfigIn bash use the command:
export DISPLAY=[IP_ADDRESS]:0 >> ~/.bashrcgit clone https://github.com/mtelek/cub3D.git
cd cub3D
makeExecutable will be named cub3D.
Run the Game:
./cub3D test.cubTest.cub can be replaced with a custom map file.
In all cases it should end with .cub.
WASD: Move forward/backward/strafe←→: Rotate cameraESC: Quit game
Example:
NO textures/wall_north.xpm # North texture
SO textures/wall_south.xpm # South texture
WE textures/wall_west.xpm # West texture
EA textures/wall_east.xpm # East texture
F 220,100,0 # Floor color (RGB)
C 135,206,235 # Ceiling color (RGB)
1111111111111 # Map (1=wall, 0=empty)
1000000000001 # Player: N/S/E/W for spawn
1111111111111- The project uses MiniLibX by École 42 (BSD 2-Clause License).
