No description
| .vscode | ||
| assets | ||
| docs | ||
| include | ||
| src | ||
| tools | ||
| .gitignore | ||
| BUGS.md | ||
| data.json | ||
| leaderboard.txt | ||
| Makefile | ||
| race_data.json | ||
| racer | ||
| racer.exe | ||
| README.md | ||
| settings.cfg | ||
| users.json | ||
| VERIFY_CARS.sh | ||
RaylibRacer - 3D Racing Game
A simple 3D racing game built with C++ and Raylib.
🎮 How to Build and Run
# Compile the game
make
# Run the game
make run
# Clean build files
make clean
Or simply run:
./racer
🕹️ Controls
- W / Up Arrow - Accelerate
- S / Down Arrow - Brake / Reverse
- A / Left Arrow - Turn Left
- D / Right Arrow - Turn Right
- ESC - Quit Game
📁 Project Structure
RaylibRacer/
├── src/ # Source code files
│ └── main.cpp # Main game code
├── include/ # Header files (for future use)
├── assets/ # Game assets (models, textures, sounds)
├── build/ # Compiled object files
├── Makefile # Build configuration
└── racer # Executable (after building)
🚗 What's Currently Implemented
- 3D Camera - Follows the car from behind
- Simple Car Physics
- Acceleration and braking
- Friction/deceleration
- Speed-based turning
- Basic momentum
- Simple Track - Green ground plane with red boundary markers
- UI Elements - Speed display and controls info
🎯 Next Steps to Improve Your Game
Beginner Level:
- Change car color - Modify the car's color in main.cpp:131
- Add more boundaries - Create walls or cones around the track
- Change track size - Modify the ground plane size
- Adjust car speed - Change
car.maxSpeedvalue
Intermediate Level:
- Load 3D models - Replace the cube car with a real 3D model
- Add checkpoints - Create a race lap system
- Add a timer - Track race time
- Better camera - Add different camera angles
- Sound effects - Engine sounds, collision sounds
Advanced Level:
- Multiple cars - Add AI opponents
- Better physics - Implement proper car physics
- Track editor - Design custom tracks
- Particle effects - Dust, smoke, sparks
- Collision detection - Proper boundaries and walls
📚 Learning Resources
- Raylib Official Site: https://www.raylib.com/
- Raylib Examples: https://www.raylib.com/examples.html
- Raylib Cheatsheet: https://www.raylib.com/cheatsheet/cheatsheet.html
- C++ Tutorial: https://www.learncpp.com/
🔧 Understanding the Code
Main Game Loop (main.cpp):
- Input (lines 46-63) - Handles keyboard input
- Physics (lines 65-82) - Updates car position and velocity
- Camera (lines 84-87) - Follows the car
- Rendering (lines 90-119) - Draws everything on screen
Key Concepts:
- Vector3 - Represents 3D positions (x, y, z)
- deltaTime - Time between frames (for smooth movement)
- DEG2RAD - Converts degrees to radians for math functions
- Camera3D - The viewpoint that renders the 3D scene
💡 Tips
- Start small - add one feature at a time
- Test frequently - run
make runafter each change - Read Raylib examples - they're very helpful
- Don't worry about perfection - have fun!
Happy racing! 🏎️