An asteroids-like game made in C++ and SFML for the BUas CMGT intake procedure (numerus-fixus).
Result: Accepted!
This is my first videogame written in C++. I learned many things in a short time:
- Manually handling dependencies (static and dynamic) through project configurations
- A simple game loop (when to update input, update objects, render objects, etc)
- A design pattern called "object pool" to reuse already allocated objects
- Collision detection and resolution
- Pointers and references
- What the difference is between a list and vector and when to use them
In order to do this, I used a few resources:
- Beginning C++ Through Game Programming, 4th ed
- C++ Fast Track for Games Programming (the full series)
- SFML 2.4 For Beginners (the full series)
- 2D elastic collisions based on this article
- Fixed 2560x1600px resolution, because I did not have time for dynamic scaling
The project uses vcpkg manifests to install dependencies and include source code. Therefore to build the project, vcpkg is required.
In the root folder of the project (next to vcpkg.json):
vcpkg install --triplet x86-windows
vcpkg integrate install| Action | Key | Description |
|---|---|---|
| Fly Right | D | Ship flies right |
| Fly Up | W | Ship flies up |
| Fly Left | A | Ship flies left |
| Fly Down | S | Ship flies down |
| Fire | Left MB | Ship fires projectile at the facing direction |
| Aim | Cursor | Ship faces the cursor |
The project depends on SFML, a Simple and Fast Multimedia Library. This includes:
- Audio and sound effects
- Inputs
- Windows
- Graphics
I wanted to keep the repository as vanilla as possible, but there were some major bugs/disturbances that had to be fixed:
- Added vcpkg manifests to not bloat the repository with dependencies
- Added an asset folder (for the fonts) to remove the build folders
- Fixed the game on 2560x1600px resolution
- Fixed the game starting in game over state
- Fixed the player speed-up at the first run
- Changed folder names and moved source files

