Skip to content

Shape Shooters · 2020 · university project

Shape Shooters - C++ Game Engine

A university project: a multiplayer arcade shooter and the small engine under it, written from scratch in C++ with SFML. My first real lesson in game loops, timing, and why collision detection is never quite finished.

Layers
interface, application
Built with
C++ · SFML · OOP · UML · Game Development
Elsewhere
source on GitHub
SCORE 0420 LIVES 3 · WAVE 4 grid 80 px · 18 cells AABB 56² Ship · p(234,248) v(0,42) v(‑26,36) v(‑40,0) hit · +20 CLASSES Entity pos · vel · box Ship Enemy Bullet entities 14 collision tests 31 / 91 grid saves 66 % frame time · 60 Hz ONE FRAME · 16.7 ms input 0.4 · update 2.1 collide 1.3 render 6.8 idle 6.1 · vsync dt = clock.restart() · position += velocity · dt 1 2 3 4 5
Fig. 01 — One frame of the game loop: positions, velocities, the boxes that decide a hit, and where the 16.7 ms go.
  1. 1Entity · position, velocity, bounding box
  2. 2Spatial grid · only neighbours get tested
  3. 3Velocity · integrated every frame with dt
  4. 4Frame budget · 16.7 ms, measured each loop
  5. 5Class hierarchy · Entity, then Ship, Enemy, Bullet

The problem

A university project with a wide-open brief and one hard constraint: build a game, but build the engine too, in C++ with SFML and no game framework to lean on.

What I built

A multiplayer arcade shooter in which everything is a geometric shape, and the small engine under it: a game loop with proper timing4, an entity model1 built on object-oriented design patterns, collision detection with bounding boxes2, a scoring and state system, power-ups, and several enemy types5 with their own behaviour. I drew the architecture in UML first and kept the engine separate from the game that runs on it.

What I learned

Game loops teach you about time in a way web work never does: everything happens every sixteen milliseconds, or it does not happen. I learned that collision detection is never quite finished, that a clean entity model pays for itself the moment you add the third enemy type, and that drawing the design before writing it is not bureaucracy.