Breakout! (the… sequel?)

Developed in February 2021 for Northeastern’s CS4850 Building Game Engines class, this rendition of the classic Breakout game is an exercise in basic game structure using the SDL library for C++.


Tools, libraries, and languages used: C++, SDL, VSCode


Developing the Game

This assignment was an introduction to fundamental game programming and engine architecture designs, as well as familiarizing myself with SDL. I programmed the collision detection for the ball movement - even with the simple rectangular hitboxes, there were still issues with collision detection when the ball’s velocity was too high that I had to work through - and handled user input for the paddle movement. On the code side, I implemented a Resource Manager class to handle loading in media files without having to allocate memory each time an asset was requested, such as sprites, music, and fonts. I also implemented simple frame capping and the ability to load in levels from configuration text files.

The Photographic Evidence

Watch the demo gameplay below:


Breakout Level 3 Breakout Level 3

Post Mortem for Class

While making a game from scratch for the first time is a learning experience in itself, I would like to think that given more time, I could expand this game even more.

Code Design

In terms of the design of the code - specifically from an OO-perspective - I feel like my code didn’t utilize delegation nearly enough, and instead had a lot of code crowded into the main game loop function. I had laid out a plan to use a Level Manager class, which would allow me to delegate more tasks out appropriately, and I would have liked to fully implement that class. I think the Sprite class could also be built a little better, and probably should have had a “tag” attribute rather than a boolean flag for if it was a paddle.

Additional Features

With a little more tinkering, and perhaps a separate Block class, the next steps for improving the gameplay itself would be to add in different colored/scored blocks. With a child class of the Sprite class, Blocks could very easily have additional color/image id and score attributes. Each row would simply contain a different color/score block, which pattern could repeat with larger boards. Another feature that would be interesting to add is blocks that spawn extra balls for the player to use. Again, this behavior could be implemented in the block class and handled during collisions.

Code available upon request for academic integrity purposes.

Art assets and sound effects from Unity asset store.

Updated: