
TUDE
ROLE: Programmer
​
SOFTWARE: VS Code
​
DEVELOPMENT FRAMEWORK: C++, SDL2
​
DURATION: 8 Weeks
​
DATE: -
​
TEAM SIZE: 1
​
TYPE: Game Engine
​
GITHUB: Link
​
OVERVIEW​​​
As part of my studies at Stockholm University, I developed a custom C++ game engine using SDL2. The engine was designed from scratch with a modular, entity-based architecture, allowing multiple games to share core systems such as input handling, rendering, audio, and collision detection, while enabling unique gameplay mechanics for each title. ​
FEATURED GAMES​
To test the engine’s capabilities, I created two games:
STARSHIP
A vertical space shooter where players control a starship to destroy waves of incoming enemies before they reach the bottom of the screen. This game emphasizes precision, timing, and strategic shooting.
​​
KEY FEATURES
-
Player-Controlled Shooting: Players can aim and shoot at enemy ships, requiring accuracy and timing.
-
Enemy Waves: Enemies approach in waves, with increasing difficulty, testing the player's endurance and skill.
-
Health Management: Players must manage their health, avoiding enemy collisions and strategically eliminating threats.
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​​
​
RABBIT HAMMER
A reaction-based game where players wield a sledgehammer to eliminate fast-moving rabbits before they disappear. This game tests reflexes and fast decision-making.
​
KEY FEATURES
-
Dynamic Enemy Spawning: Rabbits appear at random locations and intervals, increasing the challenge as the game progresses.
-
Intuitive Controls: The sledgehammer follows the mouse cursor, providing a direct and responsive gameplay experience.
-
Performance Optimization: Efficient rendering and collision detection ensure smooth gameplay even with multiple active entities.
​
While Starship and Rabbithammer were developed as test cases, the engine itself was designed to easily accommodate other types of games by leveraging its shared collision detection, input handling, rendering, and entity management systems.
​
ENGINE ARCHITECTURE & TECHNICAL HIGHLIGHTS
​
CORE FEATURES:
Modular Design: New games or mechanics can be added without rewriting core systems.
-
Entity-Based System: All game objects (players, weapons, enemies) inherit from a base Sprite class.
-
Optimized Rendering: Uses SDL2's hardware acceleration for consistent performance.
-
Scalable & Maintainable: Designed to grow with new weapons, enemies, or entire game modes.

SYSTEM BREAKDOWN
CORE SYSTEMS
​
SYSTEM CLASS​
The System class is responsible for initializing SDL2, managing textures, playing sounds, and handling fonts.
​
WHY USE A SEPARATE SYSTEM CLASS?
-
Prevents memory leaks by ensuring proper deallocation.
-
Encapsulates SDL2 logic, allowing game logic to remain independent of rendering details.
-
Ensures optimal performance by caching textures and sounds.
​
SPRITE CLASS​
All game objects in both Starship and Rabbithammer are derived from the Sprite class, which provides:
-
Position & size handling via SDL_Rect.
-
Collision detection using SDL_HasIntersection().
-
A common interface for rendering and updating game objects.
​
This ensures code reusability, allowing enemies, weapons, and bullets to be handled consistently across both games.
​
GAME ENGINE CLASS
The heart of the engine. Manages:
-
Main game loop (render, update, input)
-
Queued addition/removal of game entities
-
Win/loss tracking and end-game screens
-
Restart handling
​
​
HEALTH HANDLER CLASS
Real-time UI rendering using SDL_ttf:
-
Tracks and displays player health
-
Shows kill progress (e.g. “Ships to destroy: 4/10”)
-
Ensures feedback remains responsive and readable
​
​​
WEAPONS
​
​PISTOL CLASS
The pistol class is used as the Player weapon mechanic in the Starship game. This mechanic tests the player's reflexes and accuracy.
​
-
The pistol follows the mouse for precise aiming.
-
Clicking spawns a bullet that moves upward.
-
Plays gunshot sound for feedback.​​
​​​
​
SLEDGEHAMMER CLASS
The Sledgehammer class is used as the Player weapon mechanic in the Rabbit Hammer game. This mechanic tests reaction speed, as players must quickly hit rabbits before they escape.
​
-
The sledgehammer follows the mouse cursor.
-
Clicking instantly destroys rabbits in range.
​
​
PROJECTILES
BULLET CLASS
Bullets move up and check for collisions with enemy ships. If a bullet hits an enemy, both are removed from the game.​​
​
​
ENEMIES
​​​
ENEMY SHIP CLASS
-
Move downward toward the player.
-
If they reach the bottom, the player loses health.
-
Can be destroyed by bullets.
​​​
​​​
ENEMY RABBIT CLASS
-
Spawn randomly on the map.
-
Disappear after 3 seconds, reducing player health if not destroyed.
​
​
ENEMY SPAWNER CLASS
​This system makes sure the difficulty scales over time, keeping both games challenging.
​
-
Randomly spawns enemies at different locations.
-
Dynamically increases spawn rate to make the game harder.​​
​
​
​
​
FINAL THOUGHTS
This project demonstrates my ability to:
-
Design and implement a modular, scalable C++ game engine
-
Build two complete games with distinct mechanics using shared systems
-
Apply object-oriented principles to real-time rendering and game logic
-
Optimize performance for responsiveness and smooth gameplay
​
By supporting multiple gameplay styles within one engine, I proved the flexibility of my architecture and my proficiency in game system design, C++ development, and SDL2 integration.