SCHOOL · PROJECT

cub3d

Wolfenstein‑style raycasting engine

GitHub Repo
CRaycastingTexturesMathPerformance

Overview

cub3d implements a real-time raycasting renderer in C. It draws walls based on DDA ray traversal, supports textures, and handles player movement with smooth camera rotation.

Highlights

  • DDA-based raycasting with wall distance and texture coordinates
  • Player movement and camera rotation
  • Basic z-buffering for proper sprite order
  • Optimizations to keep 60 FPS on modest hardware

Technical Details

  • Map parsing and validation with clear error messages
  • Separate modules for math, rendering, and input
  • Texture sampling with fixed-point arithmetic in hot paths
  • Explicit memory ownership and cleanup on exit

Challenges

  • Floating vs fixed-point tradeoffs
  • Texture seams and precision errors
  • Balancing clarity and performance in C

What I Learned

  • Computer graphics math fundamentals
  • Cache-aware data layouts
  • Profiling and micro-optimizations
cub3d · Projects · Mohamed Kobaa