A 3D raycasting game engine implementation in C, inspired by Wolfenstein 3D. This project features real-time 3D rendering, sprite management, and interactive gameplay mechanics.
- Ana Gabriela - Lead: Rendering, Graphics, Mathematics
- Daru - Lead: Parser, Game Logic, Input Handling
- Real-time 3D rendering using raycasting algorithm
- Dynamic sprite system with enemies, doors, and collectibles
- Portal mechanics for advanced gameplay
- Audio system with ambient sounds and effects
- Interactive HUD with health and minimap
- Map parsing from
.cubconfiguration files - Cross-platform support (Linux/macOS)
- GCC with C99 support
- Make
- MLX library (included)
- Valgrind (optional, for memory checking)
git clone https://github.com/yourusername/Cub3D.git
cd Cub3D
make# Run mandatory version
./cub3D maps_and_textures/correct_maps/demo.cub
# Run bonus version with enhanced features
make bonus
./cub3D_bonus maps_and_textures/correct_maps/demo.cub
# Save screenshot (BMP format)
./cub3D maps_and_textures/correct_maps/demo.cub --save| Key | Action |
|---|---|
WASD |
Move player |
←→ |
Rotate camera |
↑↓ |
Look up/down |
Space |
Shoot |
E |
Interact with doors |
ESC |
Exit game |
Cub3D/
├── srcs/ # Source code
│ ├── core/ # Core game logic
│ ├── render/ # Rendering engine
│ ├── parser/ # Map parsing
│ ├── game/ # Game mechanics
│ └── math/ # Mathematical utilities
├── include/ # Header files
├── assets/ # Textures and sounds
├── maps_and_textures/ # Test maps
└── scripts/ # Development tools
make # Build mandatory version
make bonus # Build bonus version
make debug # Build with debug symbols
make clean # Clean object files
make fclean # Clean everything# Check code style
make norm
# Memory leak detection
valgrind --leak-check=full ./cub3D demo.cub
# Address sanitizer
make sanitize && ./cub3D demo.cub- Memory: 0 leaks detected ✅
- Frame Rate: 60 FPS target
- Memory Usage: < 100MB
- Compilation: < 30 seconds
The project includes comprehensive memory testing using both Valgrind and AddressSanitizer:
# Memory leak test
valgrind --leak-check=full ./cub3D demo.cub
# Address sanitizer test
make sanitize
timeout 10s ./cub3D demo.cubResults: 0 memory leaks, 0 errors, perfect memory management.
Maps are defined in .cub files with the following structure:
- Resolution settings
- Texture paths (North, South, East, West)
- Floor and ceiling colors
- Map grid with walls, sprites, and player spawn
This project is part of the 42 School curriculum.
Built with ❤️ at 42 Barcelona