Back to Projects

cub3d

Raycasting-based 3D rendering project written in C.

  • C
  • Makefile

Overview

cub3d is a small first-person renderer inspired by early raycasting engines. It parses a map, casts rays through the scene, and renders textured walls from the player's point of view.

Visit the repository for source and setup instructions.

Collaborator

This was a collaborative project built with Mohamed Ouahmane (@med-ouahman).

Usage

Build with make, then run the program with a .cub map file:

make
./cub3D maps/example.cub

The map file describes the scene layout, texture paths, floor and ceiling colors, and the player's starting position.

What I Built

Details

Raycasting and rendering

The renderer casts one ray per screen column, detects where that ray intersects the map, and uses the distance to decide how tall the wall slice should appear. That creates a simple 3D view while still drawing into a 2D image buffer.

Map validation

The project needs to reject malformed maps before rendering begins. That means checking required assets, color definitions, allowed characters, a valid player spawn, and whether the playable area is properly enclosed.

Project rules and limitations

The project is intentionally limited to C and a small graphics library, so most of the parsing, validation, state updates, and rendering logic is implemented directly. It is a learning project rather than a general game engine.

Notes

This project connects low-level C programming with game-dev-adjacent work: rendering loops, input handling, geometry, assets, and careful state updates.

Sources / Further Reading