Get Started Now

Intro to C++ Programming

Starting from the fundamentals, become a C++ software engineer, step by step.

Free, Unlimited Access

LATEST UPDATES

Screenshot from Cyberpunk 2077
Module One

Intro to C++ Programming

Starting from the basics, become a C++ software engineer, step by step

View Course
Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
Screenshot from Cyberpunk 2077
Module Two

Game Dev with SDL2

Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games

View Course
Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
Screenshot from Cyberpunk 2077
Module Three

Professional C++

Learn C++ and SDL development by recreating classic retro games

Preview Course
Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
MOST POPULAR

Breakout: Project Setup

Begin building a Breakout clone by integrating our level editor and engine into a new game project.
Abstract art representing computer programming
Breakout: Part 1
Ryan McCombe
Published

In this project, we'll build a complete clone of the classic arcade game, Breakout. We'll implement all the core mechanics, including a paddle, a ball, breakable bricks, scoring, and multiple levels.

To get started, we'll set up our project structure. We will be reusing a lot of code from our previous projects, including the component-based game engine and the level editor. This allows us to hit the ground running and focus on game-specific logic rather than rebuilding foundational systems.

This first lesson will walk you through all the starting files, highlighting the minor changes we've made to our engine since we last worked on it. By the end, you'll have a running application that shows both our editor window and a new, empty window for our Breakout game.

Breakout: The Ball

This lesson focuses on creating the Ball class, customizing our physics engine, and launching the ball.
Abstract art representing computer programming
Breakout: Part 2
Ryan McCombe
Published

Now that our project is running, we can start building the game itself. The first element we need is the ball. This lesson is dedicated to bringing our game's ball to life, from its visual representation to its movement.

We will begin by creating a new Ball class. This class will use our existing entity-component system to manage its properties. We'll add components for its position, image, and collision bounds. We'll also add a physics component and learn how to customize it for our game by disabling gravity.

Our key goals for this lesson are to:

  • Create a Ball entity class.
  • Add and configure the necessary components.
  • Modify the engine's PhysicsComponent to support zero-gravity movement.
  • Set an initial velocity to get the ball moving.

Breakout: Walls and Collision

We'll add invisible walls around the play area and write the collision response code to make the ball bounce.
Abstract art representing computer programming
Breakout: Part 3
Ryan McCombe
Published

Our ball is moving, but it flies off the screen forever. To create a playable game, we need to contain it within the play area. We'll achieve this by adding four invisible walls around the edges of our scene.

This lesson will guide you through creating a Wall entity. We'll instantiate four of them - for the top, bottom, left, and right boundaries - and give them collision components.

The core of this lesson, however, is implementing the collision response in our Ball class.

We'll start with a simple bouncing algorithm that works well in most cases. Then, we'll explore a more advanced, physically accurate method using vector math concepts like the dot product and surface normals.

By the end, our ball will be correctly bouncing around inside the game window.

Breakout: The Player Paddle

We'll build the player's paddle, hook it up to keyboard controls, and keep it from moving off-screen.
Abstract art representing computer programming
Breakout: Part 4
Ryan McCombe
Published

It's time to give the player some control! In this lesson, we will implement the paddle, the primary way the player interacts with the world of Breakout. We will build upon our entity-component system to create a paddle that moves left and right in response to keyboard input.

We will create a Paddle entity and add components to it. A key focus will be on the InputComponent and PhysicsComponent. We'll explore how to customize the default input bindings, implement a "press to move, release to stop" control scheme, and add a new capability to our physics engine to constrain movement within a defined area.

In this lesson, we will:

  • Create a Paddle entity class.
  • Bind the left and right arrow keys to paddle movement.
  • Implement logic to reset velocity when no key is pressed.
  • Add movement constraints to the PhysicsComponent to keep the paddle on-screen.

Breakout: Improving Paddle Physics

We'll add detailed collision logic to the paddle, giving the player control over the ball's trajectory.
Abstract art representing computer programming
Breakout: Part 5
Ryan McCombe
Published

Right now, our paddle behaves just like a moving wall. This is functional, but it doesn't give the player much control. In a classic Breakout game, where you hit the ball on the paddle determines its new direction. This lesson is all about implementing that nuanced physical interaction.

We will write code that calculates the precise point of impact on the paddle and uses that information to construct a new velocity for the ball. This will transform the gameplay from a simple reaction test into a game of skill, where players can aim their shots.

Additionally, we'll tackle a common problem in game physics: rapid, repeated collisions. We'll enhance our Component class with an isEnabled flag and use SDL_Timer to temporarily disable the paddle's collider after a hit, ensuring clean, single bounces.

Breakout: Loading Levels

Add breakable bricks to the game by loading and parsing level files saved from our level editor.
Abstract art representing computer programming
Breakout: Part 6
Ryan McCombe
Published

So far, our game scene has been hard-coded. To create a real game, we need the ability to load different level layouts dynamically. This lesson will implement the level loading system, reading the .bin files generated by our editor and using them to build our game world.

We will create a Block entity to represent the bricks. The core of our work will be in the Block constructor and the BreakoutScene::Load() method, where we'll use SDL_RWops to perform binary file reads.

We'll interpret the file's byte stream to determine each block's type and position, and then add the corresponding components to make them visible and collidable.

Once this system is in place, creating new levels for our game will be as simple as designing them in our editor and saving the file - no code changes required.

Breakout: Game Progression

Implement the core gameplay loop of destroying blocks and advancing through levels using SDL events.
Abstract art representing computer programming
Breakout: Part 7
Ryan McCombe
Published

Our game now has all its core interactive elements: a ball, a paddle, walls, and bricks. In this lesson, we'll tie them all together to create a complete gameplay loop, from destroying the first brick to advancing to the next level.

The main focus will be on handling the consequences of collisions. When the ball hits a brick, we need to "destroy" it. We'll implement this by disabling the brick's image and collision components, effectively removing it from play. We'll also use SDL's event system to broadcast a BLOCK_DESTROYED event.

Our BreakoutScene will listen for these events, keeping a count of the remaining bricks.

Once that count reaches zero, we'll trigger the level advancement logic, either loading the next level or declaring the game won.

Breakout: Final Touches

Learn to manage game states for winning, losing, and pausing, and prepare the final game for distribution.
Abstract art representing computer programming
Breakout: Final Touches
Ryan McCombe
Published

Welcome to the home stretch! In this last lesson, we'll add the finishing touches that turn our Breakout project into a complete, replayable game. Our focus will be on the overall game flow - managing how the game begins, how it can be won or lost, and how it can be started again.

We'll implement a GameState enum to keep track of the current situation. We'll use this state to trigger a loss when the ball misses the paddle and to provide visual feedback to the player when they win or lose. We'll also add a pause system, so the action doesn't start until the player is ready, and a simple keypress to restart the entire game from level one.

Finally, we'll look at how to prepare our project for distribution by creating a "release" build configuration that strips out the level editor and other development tools, leaving us with a clean, standalone game.

Type Objects

Learn to create flexible game entities using the Type Object pattern for data-driven design.
Abstract art representing computer programming
Ryan McCombe
Updated
Published

In the previous lessons, we learned some techniques that allow objects in our C++ program to acopt characteristics defined in some external location. This might be a file created by a different program, a stream of data coming from the internet, or simply a text file that we can edit.

For example, we could let designers on our team or our end users add monsters to our game by editing a JSON file:

Types From Data Files

Learn to load game object types and instances from external text files
Abstract art representing programming
Ryan McCombe
Updated
Published

The Type Object pattern introduced in the previous lesson provides a flexible way to manage variations among game entities by externalizing their common properties into data. This avoids a proliferation of C++ classes and makes game updates and content creation more accessible.

In this final lesson in the chapter, we put this theory into practice, combining it with the SDL_RWops techniques covered previously. We will build the foundations of a system to load these type objects and their corresponding entities from external data, process that data, and use it to instantiate our C++ objects.

We’ll use data serialized as text in this project. In the next chapter, we’ll build a program using binary serialization, so we can establish experience in both approaches.

Module One
3D art showing a progammer setting up a development environment

Intro to C++ Programming

Become a software engineer with C++. Starting from the basics, we guide you step by step along the way

This course includes:

  • 60 Lessons
  • Over 200 Quiz Questions
  • 95% Positive Reviews
  • Regularly Updated
  • Help and FAQ
Module Two
sdl2-promo.jpg

Game Dev with SDL2

Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games

This course includes:

  • 128 Lessons
  • 92% Positive Reviews
  • Regularly Updated
  • Help and FAQs
Module Three
A computer programmer

Professional C++

Comprehensive course covering advanced concepts, and how to use them on large-scale projects.

This course includes:

  • 125 Lessons
  • 550+ Code Samples
  • 96% Positive Reviews
  • Regularly Updated
  • Help and FAQ
Get Started Now

Intro to C++ Programming

Starting from the fundamentals, become a C++ software engineer, step by step.

Free, Unlimited Access
Contact|Privacy Policy|Terms of Use
Copyright © 2025 - All Rights Reserved