< Return to Academics
Burger Time Remake
Project Size
~80 hours
Tools & Languages
C++, Visual Studio
Topics
Engine Programming
Programming Patterns
Assignment
The assignment was split into two parts:
- Create a 2D game engine using shown techniques (game loop, game design patterns, threading)
- Remake Burger Time using the engine
Engine Features
- Game Loop (Update, FixedUpdate, Render & Input)
- SceneGraph with GameObjects and Components
- 2D SDL Renderer with depth sorting
- Input Manager using Command and pImpl
- Multithreaded Sound System
- Observer & Event Queue
- Prefabs
Implementation
Game Loop
The core gameloop is an infinite loop with following steps:
- Calculate frame time
- Update all GameObjects and their Children / Components
- Render visuals to game window
Image from Game Programming Patterns, Robert Nystrom
Input System using pImpl
By comparing the previous controller and keyboard states it is possible to know which key is pressed, released or held this frame.
Next, a few steps are needed to set up bindings:
- Create a container with keycode, keystate and command
- Compare container with keyboard and controller state
- Execute the commands
Image from Game Programming Patterns, Robert Nystrom
Subject & Observer
To implement events, there needs to be a subject observer relationship. The subject needs to know who is observing, while the observer needs to be able to observe the subject.
I chose for an easy implementation, where both Observer and Subject are base classes that can be derived from. The observer can then subscribe to any class that derives from subject, and listen for any notifications sent by the Subject.
Image from Game Programming Patterns, Robert Nystrom
Useful Resources
C++ Coding Standards 1st edition (2005) by Andrei Alexandrescu and Herb Sutter
Game Programming Patterns