A high-adrenaline 2D Space Shooter game built using C++ and OpenGL/GLUT. Experience classic arcade mechanics featuring procedurally generated starfields, dynamic collision detection, and a reactive UI system, all rendered using hardware-accelerated graphics.
The game engine is designed around the GLUT Event Loop, managing real-time rendering and state transitions via a callback-based architecture:
- Rendering Engine: Utilizes
GLUT_DOUBLEbuffering to eliminate flickering. The coordinate system is mapped usingglOrthoto provide a consistent 800x600 resolution. - State Management: Controls transitions between
WelcomeScreen,Gameplay, andGameOverstates using boolean flags and reactive timers (glutTimerFunc). - Collision Logic: Implements an AABB (Axis-Aligned Bounding Box) collision detection algorithm to manage Bullet-Enemy and Enemy-Player interactions.
- Procedural Background: Features a dynamic starfield system where 100+ stars are generated with randomized velocities to create a parallax-like depth effect.
ArcadeSpaceShooter_OpenGL/
├── LICENSE # MIT License
├── README.md # Project documentation
├── .gitattributes # Git configuration
│
├── OpenGL/ # Source and Visual Studio Solution
│ ├── SpaceShooter/
│ │ ├── SpaceShooter.cpp # Main Game Logic & Rendering
│ │ └── SpaceShooter.vcxproj # VS Project Configuration
│ ├── packages/ # NuGet dependencies (FreeGLUT)
│ └── SpaceShooter.sln # Visual Studio Solution File
│
└── Screenshots/ # Visual Gameplay Previews
├── OpenGL_v1.png
├── OpenGL_v2.png
└── ...
- Spacecraft Navigation: Responsive vertical movement across the screen.
- Tactical Combat: Fire high-speed projectiles to eliminate infinite enemy waves.
- Dynamic Enemies: Enemies spawn at randomized Y-coordinates with increasing speed.
- Score Tracking: Real-time HUD displaying the current session score.
- Atmospheric Depth: A live-rendered starfield provides an immersive cosmic backdrop.
| Action | Input Key |
|---|---|
| Move Up | W |
| Move Down | S |
| Fire Bullet | Space |
| Start / Restart | Space / Y |
| Component | Specification |
|---|---|
| Language | C++ 17 |
| Graphics API | OpenGL 2.1+ / GLUT |
| Resolution | 800 x 600 (Fixed Orthographic) |
| Performance | Target 60 FPS (16ms Refresh Rate) |
| Dependency Manager | NuGet Package Manager |
Clone the project to your local workstation:
git clone https://github.com/Zer0-Bug/ArcadeSpaceShooter_OpenGL.gitcd ArcadeSpaceShooter_OpenGL- Navigate to the
OpenGL/directory. - Open
SpaceShooter.slnusing Visual Studio 2019/2022. - Under Tools > NuGet Package Manager, select Restore NuGet Packages to install
freeglut.
- Set the solution configuration to Debug and the platform to x64.
- Press F5 to compile the source code and launch the space shooter environment.
Contributions are always appreciated. Open-source projects grow through collaboration, and any improvement—whether a bug fix, new feature, documentation update, or suggestion—is valuable.
To contribute, please follow the steps below:
- Fork the repository.
- Create a new branch for your change:
git checkout -b feature/your-feature-name - Commit your changes with a clear and descriptive message:
git commit -m "Add: brief description of the change" - Push your branch to your fork:
git push origin feature/your-feature-name - Open a Pull Request describing the changes made.
All contributions are reviewed before being merged. Please ensure that your changes follow the existing code style and include relevant documentation or tests where applicable.
∞