tsherif/space-shooter.c
FreeA cross-platform, top-down 2D space shooter written in C using only platform libraries.
FreeFree tier
Outputs: audio
About tsherif/space-shooter.c
A cross-platform, top-down 2D space shooter game written in C11 that relies exclusively on platform libraries for input, rendering, and audio. It is tested on Windows 10, Ubuntu Linux 16.04, and modern browsers (Chrome and Firefox) via WebAssembly. Rendering uses OpenGL 3.3 on desktop and OpenGL ES 3.0 on the web; audio is handled through XAudio2 (Windows), ALSA (Linux), and OpenAL (Web); gamepad input is supported via XInput, evdev, and the Emscripten gamepad API. The project is inspired by Handmade Hero and pacman.c, and includes an architectural overview (ARCHITECTURE.md). It is open source under the MIT license and has received 1.4k stars on GitHub.
Key Features
Cross-platform support (Windows, Linux, Web via Emscripten)
Written in standard C11 using only platform libraries
Rendering via OpenGL 3.3 (desktop) and OpenGL ES 3.0 (web)
Audio via XAudio2 (Windows), ALSA (Linux), OpenAL (Web)
Gamepad support via XInput, evdev, and Emscripten gamepad API
No external dependencies beyond platform SDKs
Included architecture documentation (ARCHITECTURE.md)
Open source under MIT license
Pros & Cons
Pros
- No external dependencies beyond platform libraries
- Cross-platform with support for Windows, Linux, and Web
- Open source with permissive MIT license
- Well-documented architecture for learning
- Lightweight and self-contained
Cons
- No macOS support currently
- Author admits design may be unconventional or sub-optimal
- No external contributions accepted
- Limited to 2D top-down space shooter genre
- No official releases published
Best For
Learning resource for game development in CExample of cross-platform game architecture using platform librariesReference for building a 2D shooter from scratchDemonstration of OpenGL and audio integration with minimal dependencies
FAQ
What platforms are supported?
Windows 10, Ubuntu Linux 16.04, and web browsers (Chrome 103, Firefox 103) via Emscripten.
How do I build the game?
On Windows, run build.bat with cl. On Linux, run 'make linux' (or 'make linux-release'). On the web, run 'make web' (or 'make web-release') with Emscripten installed.
Is macOS supported?
No, there is no Mac platform layer yet. The author plans to add it when a Mac machine is available.
Can I contribute to the project?
The project is a personal challenge and does not accept external contributions, but feedback via issues is welcome.