Home / Cub3D

Cub3D

September 2025 Graphics / Game C · Raycasting · MLX42

Overview

Cub3D is a first-person 3D maze game written in C that uses a DDA (Digital Differential Analysis) raycasting engine to render a pseudo-3D perspective from a 2D map. Navigate textured corridors, open animated doors, and explore levels defined in .cub configuration files — all inspired by Wolfenstein 3D.

Built as a 42/Hive Helsinki team project using the MLX42 graphics library, the engine includes a minimap, sprite rendering, mouse look, and frame-rate independent animations.

Key Features

Tech Stack

C MLX42 Raycasting / DDA Graphics Makefile

My Role

This was a two-person project. I owned the map parser — reading and validating .cub configuration files including flood-fill map validation. On the rendering side I implemented the minimap, mouse-look rotation, and the animated door system including the alpha-blending logic for the open/close transition.

Challenges & Learnings

The most complex part was the door animation system: doors needed to be partially transparent during opening/closing, which required alpha-blending pixels on the fly and deciding when a ray should pass through versus stop at a door less than 95% open. Implementing a flood-fill map validator to guarantee no walkable void space leaks was also essential to catch malformed .cub maps before rendering.