A high-performance 3D racing game built with OpenGL and modern C++17, featuring advanced graphics rendering techniques and an Entity-Component-System (ECS) architecture.
Turbo Rush is an exciting 3D racing game where players control a car through a dynamic track while avoiding obstacles. The game features:
- Real-time 3D racing with smooth controls
- Dynamic obstacle avoidance with collision detection
- Timer-based gameplay with survival mechanics
- Advanced graphics rendering with lighting, post-processing effects, and sky rendering
- Multiple game states including menu, play, win, and lose states
- Objective: Survive as long as possible while avoiding roadblocks
- Controls:
- WASD/Arrow Keys: Control car movement
- Space: Start game from menu
- Escape: Return to menu or exit game
- Game Mechanics:
- Timer counts down from 120 seconds
- Player has limited hits (20 by default)
- Collision with roadblocks reduces hit count
- Surviving the timer leads to victory
- Running out of hits leads to defeat
The game is built using a robust Entity-Component-System (ECS) architecture:
- Entities: Game objects (car, camera, roadblocks, etc.)
- Components: Data containers (Transform, MeshRenderer, Camera, etc.)
- Systems: Logic processors (ForwardRenderer, CollisionSystem, etc.)
- Transform: Position, rotation, and scale management
- MeshRenderer: 3D model rendering with materials
- Camera: View and projection management
- FreePlayerController: Player input handling
- Collider: Collision detection and response
- Light: Dynamic lighting system
The game features a sophisticated forward rendering pipeline with:
- Shader-based rendering with vertex and fragment shaders
- Material system supporting textured and lit materials
- Pipeline state management for depth testing, blending, and culling
- Post-processing effects including vignette and chromatic aberration
- Sky sphere rendering for immersive environments
- Multiple light support with different light types
- OpenGL 4.0+ with modern rendering techniques
- GLFW for window management and input handling
- GLM for mathematics and transformations
- Dear ImGui for user interface elements
- STB Image for texture loading
- PBR (Physically Based Rendering) materials
- Multiple texture maps: Albedo, Specular, Roughness, Ambient Occlusion, Emission
- Dynamic lighting with point, directional, and spot lights
- Post-processing pipeline with framebuffer rendering
- Transparency handling with proper depth sorting
- 3D Models: OBJ format support (car, road, obstacles)
- Textures: Multiple formats with sampler configuration
- Shaders: GLSL vertex and fragment shaders
- Scene Deserialization: JSON-based scene configuration
turbo-rush-game/
├── assets/ # Game assets
│ ├── models/ # 3D models (.obj)
│ ├── shaders/ # GLSL shaders
│ ├── textures/ # Image textures
│ └── postprocess/ # Post-processing shaders
├── config/ # Configuration files
│ ├── app.jsonc # Main application config
│ └── [test-configs]/ # Testing configurations
├── source/ # Source code
│ ├── common/ # Core engine components
│ │ ├── components/ # ECS components
│ │ ├── systems/ # ECS systems
│ │ ├── ecs/ # Entity-Component-System
│ │ ├── material/ # Material system
│ │ ├── mesh/ # Mesh handling
│ │ ├── shader/ # Shader management
│ │ └── texture/ # Texture system
│ ├── states/ # Game states
│ └── main.cpp # Application entry point
├── scripts/ # Build and testing scripts
├── expected/ # Expected test outputs
└── vendor/ # Third-party libraries
- C++17 compatible compiler (Visual Studio 2017+, GCC 9+, or Clang 5+)
- CMake 3.17 or higher
- OpenGL 4.0+ compatible graphics card
-
Clone the repository:
git clone <repository-url> cd turbo-rush-game
-
Generate build files:
mkdir build cd build cmake .. -
Build the project:
cmake --build . -
Run the game:
# From project root ./bin/GAME_APPLICATION.exe
The game can be configured using JSON files:
# Run with custom configuration
./bin/GAME_APPLICATION.exe -c='config/app.jsonc'
# Run for specific number of frames (useful for testing)
./bin/GAME_APPLICATION.exe -c='config/app.jsonc' -f=10The project includes comprehensive testing infrastructure:
# Run all tests (PowerShell)
./scripts/run-all.ps1
# Run specific test group
./scripts/run-all.ps1 -tests sampler-test
# Compare results with expected outputs
./scripts/compare-all.ps1This project demonstrates advanced computer graphics concepts:
- Shader Programming: Vertex and fragment shader implementation
- GPU Rendering: Buffer management and vertex array objects
- 3D Transformations: Matrix-based object positioning and orientation
- Rendering Techniques: Depth testing, face culling, blending
- Texture Mapping: Image sampling and filtering
- Material System: Shader-pipeline-material integration
- ECS Framework: Entity-Component-System architecture
- Forward Rendering: Multi-pass rendering with transparency
- Sky Rendering: Background environment rendering
- Post-Processing: Framebuffer-based image effects
- Lighting Models: Multiple light types and PBR materials
- Game Development: Complete game implementation
- Shader Program implementation
- Mesh rendering with vertex buffers
- Transform system with matrices
- Pipeline state management
- Texture loading and sampling
- Sampler configuration
- Material system with inheritance
- Entity-Component-System framework
- Forward renderer with transparency
- Sky sphere rendering
- Post-processing effects
- Advanced lighting system
- Complete game implementation
- 3D model usage
- Multiple light support
- PBR texture mapping
- Sky rendering
- Custom post-processing effects
- 3D motion and physics
- Collision detection
- Game logic and objectives
- Scene deserialization
- Multiple game states
- Forward Rendering with multiple passes
- Depth-sorted transparency rendering
- Framebuffer-based post-processing
- Sky sphere background rendering
- PBR Materials with multiple texture maps
- Custom shaders for different material types
- Lighting shaders with multiple light support
- Post-processing shaders for visual effects
- Point lights for local illumination
- Directional lights for global lighting
- Spot lights for focused illumination
- Attenuation and cone angles support
- OpenGL Version: Ensure your graphics card supports OpenGL 4.0+
- CMake Version: Use CMake 3.17 or higher
- Compiler Support: Ensure C++17 compatibility
- Asset Loading: Verify all asset files are present in the assets directory
- The game uses efficient rendering techniques for smooth performance
- Post-processing effects are optimized for real-time rendering
- Collision detection uses simplified bounding box calculations
- Texture streaming and LOD systems are implemented
This project was developed as a collaborative effort demonstrating advanced computer graphics concepts and game development techniques.
Turbo Rush - Experience the thrill of high-speed racing with cutting-edge graphics technology! 🏎️💨