A C++ and SDL2 raycasting engine inspired by Wolfenstein 3D.
Under active development.
Documentation and refactorings are in progress...
- C++11 compatible compiler
- SDL2
- SDL2_image
- YAML-CPP
- CMake
sudo dnf install gcc-c++ cmake SDL2-devel SDL2_image-devel yaml-cpp-devel- Player Movement: Initialize SDL project, create the player class, and implement basic movement and rotation controls
- Map Implementation: Create a 2D map system and implement collision detection to prevent walking through walls
- Basic Raycasting: Implement the raycasting algorithm - casting rays across the field of view to detect walls
- Raycasting Walls: Transform ray distances into 3D wall rendering, apply fisheye correction, and add directional shading for depth
- Textured Walls: Replace flat-colored walls with textures, implement texture sampling per ray, and align textures correctly on vertical and horizontal hits.
- Rendering Objects: Render sprites (objects) in the world, handle perspective scaling, visibility checks, and correct occlusion against walls.
Full Implementation: Fully-featured raycaster with HUD, weapons, and shooting mechanics. Use as reference or starting point for your own game.
# BUILD
cmake -S . -B build
cd build
make
# RUN
./maincmake -S . -B build -DCMAKE_BUILD_TYPE=DebugThis is a recreational, step-by-step raycasting project.
The goal of this project is to learn and understand raycasting by building it gradually, experimenting with the math, and visualizing how each part of the algorithm works.
What is Raycasting?
Raycasting is a rendering technique that simulates 3D perspective by:
- Casting rays from the player's position
- Detecting wall intersections
- Drawing vertical slices based on distance
- Creating the illusion of 3D depth


