50cc is a minimalist 2D video game engine sandbox written in a single file of C99 with SDL3 as its only dependency.
50cc allows you to learn, explore and play several 2D games from a series of simple 2D engine primatives and functions. The entire engine and games fit in one C file and a simple/optional text based config, making it easy to modify, extend, or use as a learning tool.
The name "50cc" is inspired by small, efficient engines that power entry-level motorcycles and scooters. Just like those engines, this project aims to be:
- Lightweight - The entire codebase is small and focused
- Accessible - Easy to understand and modify
- Fun - Despite its simplicity, it provides genuine entertainment
- Good performance on most hardware
- Cross platform compatibility
- Direct access to SDL3
- Less abstration so you can see how everything works
- Compiles quickly and only depends on SDL3 and standard libraries
- A C99 compatible compiler (GCC, Clang, MSVC)
- SDL3 library
- CMake (3.16 or newer)
- pkg-config (On Unix-Like)
- Arch Linux
- Ubuntu/Debian
- macOS
- Windows
- FreeBSD
Use the appropriate installation script from the Install folder:
# Linux
./Install/linux.sh
# MacOS
./Install/macos.sh
# Windows
Install\windows.ps-
Build using CMake:
mkdir build cd build cmake .. cmake --build .
-
Run the game:
./50cc
Once launched, 50cc will present a menu to select from the available games:
- Use arrow keys to navigate
- Press Enter/Return to select a game
- Press Esc to return to the menu
- Each game has its own controls, shown on-screen
The entire game is contained in a single 50cc.c file, making it easy to modify:
- Open
50cc.cin your favorite text editor - Modify the code as desired
- Rebuild using the steps above
- Enjoy your customized version!
Just like this project, 50cc combustion engines have several merits:
- Efficiency: 50cc engines can achieve excellent fuel economy, often 100+ MPG
- Simplicity: Fewer moving parts means less that can go wrong
- Accessibility: Lower cost of entry and maintenance
- Legality: In many regions, 50cc vehicles can be operated without a full motorcycle license
- Learning: Perfect for beginners to understand the principles of internal combustion
- Reliability: When properly maintained, can run for thousands of miles with minimal issues
- Portability: Lightweight and compact design
- Low environmental impact: Smaller carbon footprint compared to larger engines
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- SDL3 developers for the excellent cross-platform library
- Inspiration from classic 2D games that defined the industry
- The open-source community for resources and documentation
