README.TXT [-][x]

C:\CUB3D> type README.TXT

cub3D is a 3D game engine built from scratch in C using raycasting, inspired by Wolfenstein 3D (1992). It renders a first-person perspective of a maze from a 2D map using the DDA (Digital Differential Analyzer) algorithm.

Features include textured walls, floor and ceiling rendering, a minimap, sprite rendering, and smooth player movement. Part of the 42 curriculum, it teaches real-time graphics programming, trigonometry, and game loops.

C:\CUB3D> _

// TECH STACK

C Raycasting MiniLibX Linear Algebra

// ABOUT THE PROJECT

cub3D is a 42 Berlin project that builds a Wolfenstein-style raycasting engine from scratch in C. Instead of true 3D geometry, the engine casts rays from the player's position across a 2D grid map and calculates wall distances to simulate a first-person 3D environment — the same technique id Software used in 1992.

// TECHNICAL CHALLENGES

The DDA (Digital Differential Analyzer) algorithm steps through the grid efficiently, selecting the nearest wall intersection per screen column. Wall heights are derived from perpendicular distance to avoid fisheye distortion. The full C implementation adds texture mapping, sprite rendering, and map parsing from configuration files — each layer adding complexity to the render loop and collision detection.

This browser demo implements the core raycasting loop with a tile-based maze, directional shading per wall face, and sliding collision detection so the player cannot pass through walls at oblique angles.

// WHAT THIS TAUGHT ME

cub3D connects trigonometry and linear algebra to something you can walk through. Building a game loop that must render at interactive frame rates teaches you to profile hot paths, avoid redundant computation, and understand why small math errors become visible wall artifacts. That attention to performance and correctness translates directly to any real-time system.

View my GitHub →

// INTERACTIVE DEMO

CUB3D.EXE _ X

CUB3D.EXE

Click to play

WASD to move / Arrows to look

POS: 2.00, 2.00 WASD: MOVE | ARROWS: LOOK FPS: --