2026-02-04 12:09:29 +01:00
2026-01-25 16:57:20 +01:00
2026-01-25 16:57:20 +01:00
2026-01-25 16:57:20 +01:00
2026-01-25 16:57:20 +01:00
2026-01-25 15:58:40 +01:00
2026-02-04 12:09:29 +01:00

This project has been created as part of the 42 curriculum by amikhail and aortigos.

cub3d

Description

cub3D is a graphical project inspired by early 3D games such as Wolfenstein 3D. Its goal is to render a 3D representation of a maze from a 2D map using the raycasting technique, written entirely in C using MLX graphics library.

This project renders a 3D view of a 2D map described in a '.cub' file. The player can move inside the map, rotate the camera and see textures walls, floor and ceiling.

This rendering is possible duo to classic raycasting algorithm, where one ray is cast per screen column to calculate wall distance and draw it correctly.


Instructions

Requirements

  • Linux or macOS
  • MLX / MLX42
  • 'gcc' or 'clang'

Compilation

make

Execution

./cub3D assets/maps/example.cub

Controls

Use W, A, S and D to mover the player. Use UP, DOWN, LEFT and RIGHT arrows to rotate camera. Use ESC for exit the program.

Map configuration (.cub)

A .cub file contains:

  • Wall textures (NO, SO, WE, EA)
  • Floor and ceiling colors (RGB format)
  • Map layout, composed of:
    • 1 for walls
    • 0 for empty space
    • N, S, E or W for the player start position

The map is strictly validated:

  • Exactly one player position
  • Fully closed by walls
  • Only valid characters
  • RGB values between 0 and 255

Resources

Description
No description provided
Readme 9.5 MiB
Languages
C 89.6%
C++ 7.8%
Python 1.4%
CMake 0.7%
Makefile 0.2%
Other 0.2%