As part of the 42 Network curriculum, I recently completed the Cub3D project—an exciting venture into the world of 3D graphics programming using ray-casting techniques. This project challenged us to create a 3D maze-like environment from a 2D map, similar to classic games like Wolfenstein 3D. Through this experience, I gained valuable insights into graphics programming, trigonometry application, and efficient rendering techniques.

https://youtu.be/AYjC75kCCzk?si=AOTx9LvIn1aFJg6C

Features :

Our implementation of Cub3D includes several core features:

  1. Raycasting Engine: The heart of our 3D rendering, allowing for a first-person perspective.
  2. Texture Mapping: Applying detailed textures to walls and objects for enhanced visuals.
  3. Player Movement and Rotation: Smooth player movement and camera rotation based on user input.
  4. Map Parsing and Rendering: Reading and interpreting map files to generate the game environment.
  5. Interactive Elements: Features like weapon displays, animations, and interactive doors.
  6. Minimap: A small overview map showing the player's position and surroundings.

Trigonomet Review :

At the core of Cub3D lies some fascinating mathematics, particularly trigonometry. Here's a brief overview of the key concepts we applied:

Radians

Radians are the angular unit of choice in mathematics and physics. One radian is the angle subtended at the center of a circle by an arc equal in length to the radius. A full circle contains 2π radians (approximately 6.28318 radians).

Screen Shot 2024-05-31 at 2.01.30 PM.png

Sine, Cosine, and Tangent

These fundamental trigonometric functions relate the angles of a triangle to the lengths of its sides: