Skip to main content

Welcome to Cub3D

Cub3D is a real-time 3D raycasting engine written in C that brings the classic Wolfenstein 3D rendering technique to life. Experience the magic of turning a 2D map into an immersive 3D first-person perspective using the power of mathematics and graphics programming.

Quick Start

Get Cub3D running on your system in minutes

Installation

Step-by-step installation guide for all dependencies

Understanding Raycasting

Learn how raycasting transforms 2D maps into 3D views

Creating Maps

Design your own custom levels with the .cub format

Key Features

Real-time Rendering

Fast 3D raycasting engine using DDA algorithm for smooth gameplay

Textured Walls

Support for XPM texture files to create visually rich environments

Custom Maps

Parse and validate .cub map files with configurable textures and colors

Player Controls

WASD movement and arrow key rotation for intuitive navigation

Map Validation

Comprehensive error handling and boundary checking for secure gameplay

MiniLibX Graphics

Built on the lightweight MiniLibX library for efficient graphics rendering

Getting Started

1

Install Dependencies

Install the MiniLibX library and required build tools for your system.
make -C minilibx-linux
make -C libft
2

Build the Engine

Compile Cub3D with a single make command.
make
3

Run Your First Map

Launch the engine with one of the included demo maps.
./cub3d maps/DOOMGUY.cub

What is Raycasting?

Raycasting is a rendering technique that creates a 3D perspective from a 2D map by casting rays from the player’s viewpoint and calculating wall distances. This method, popularized by games like Wolfenstein 3D, provides an efficient way to render 3D environments in real-time without the computational overhead of full 3D graphics.

How Raycasting Works

Deep dive into the mathematical principles behind the algorithm

DDA Algorithm

Learn about Digital Differential Analysis for ray-grid intersection

Explore the Documentation

Core Concepts

Understand the fundamentals of raycasting, textures, and rendering

User Guide

Build, run, and control the game with comprehensive guides

Technical Reference

Explore the codebase architecture and implementation details

Development

Contribute to the project and debug like a pro