A 2.5D raycasting game engine built from scratch in C with SDL2, implementing classic techniques used in games like Doom and Wolfenstein 3D.
- Pure C raycasting implementation - No external game engines
- Real-time 2.5D rendering - Wall projection with texture mapping
- Sprite rendering system - Billboard sprites with depth sorting
- Texture mapping - Multiple wall textures with transparency support
- Minimap display - Real-time overhead view with player position
- Collision detection - Grid-based world collision system
- Cross-platform - Works on macOS and Linux
- Arrow Keys - Move forward/backward, turn left/right
- ESC - Exit
macOS:
brew install sdl2Ubuntu/Debian:
sudo apt-get install libsdl2-devFedora/RHEL:
sudo dnf install SDL2-develgit clone <repository-url>
cd raycasting-c
make build
./raycast- Ray casting algorithm - Cast rays for each screen column to find wall intersections
- DDA (Digital Differential Analyzer) - Efficient grid traversal for ray-wall intersection
- Texture sampling - UV mapping for realistic wall textures
- Sprite projection - 3D to 2D transformation with distance-based scaling
- Transparency handling - Magenta color key for sprite backgrounds
- Memory management - Custom texture loading and sprite management
src/
├── main.c # Game loop and input handling
├── graphics.c # SDL rendering and display
├── ray.c # Raycasting algorithm implementation
├── player.c # Player movement and physics
├── sprite.c # Sprite rendering and management
├── map.c # World map and collision detection
└── upng.c # PNG texture loading
- PNG Loading: Uses upng by Sean Middleditch - A minimal PNG decoder library
- Graphics: SDL2 for cross-platform rendering and input handling
- Game Assets: Wolfenstein 3D textures and sprites © id Software - Used for educational purposes
Built as an educational project to understand classic 3D rendering techniques and game engine architecture.
