tude
role: Gameplay & System
programmer
software: VS Code
framework: C++, SDL2
duration: 8 weeks
date: -
team size: 1
type: game engine
---
github: Here

overview.
​
As part of my studies at Stockholm University, I built a custom C++ game engine using SDL2 from scratch. The engine was designed with a modular, entity-based architecture that allows multiple games to share core systems — input handling, rendering, audio, and collision detection — while each game defines its own mechanics on top.
To test the engine I built two games: Starship and Rabbit Hammer.
​
starship.
A vertical space shooter where the player controls a starship and destroys waves of incoming enemy ships before they reach the bottom of the screen. The focus is on precision, timing, and threat prioritisation.
Enemy ships spawn from the top of the screen at random X positions and move downward at a fixed rate each tick. If one reaches the bottom it reduces the player's health and removes itself. The player fires bullets by clicking, each spawning at the pistol's current position and moving upward at 6 pixels per tick. When a bullet intersects an enemy ship both are queued for removal and the kill counter increments. The game is won when the player reaches the target kill count, and lost when health hits zero.
rabbit hammer.
A reaction-based game where the player wields a sledgehammer to eliminate fast-moving rabbits before they disappear. The focus is entirely on reflexes and fast decision-making.
Rabbits spawn at random screen positions and store their creation timestamp using SDL_GetTicks(). Every tick they check how long they have existed — if 3 seconds have elapsed without being hit, they remove themselves and reduce the player's health. The sledgehammer tracks the mouse cursor directly each tick, and on click it checks all active sprites for collision, removes any rabbits it intersects, and increments the kill counter.
​​
​
​