Get Started Now

Intro to C++ Programming

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

LATEST UPDATES

Screenshot from Cyberpunk 2077
Module One

Intro to C++ Programming

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

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

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

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

Bounding Boxes

Discover bounding boxes: what they are, why we use them, and how to create them
Abstract 3D art representing computer programming
Ryan McCombe
Published

So far, our game objects exist only as single points (Vec2 Position). While great for movement, it's not enough for interactions like checking if a projectile hits a character.

This lesson tackles that by introducing bounding boxes – simple rectangular shapes that represent the space an object occupies. We'll focus on Axis-Aligned Bounding Boxes (AABBs), implement a BoundingBox class using SDL_FRect, add it to our GameObject, and learn how to draw these boxes for debugging purposes.

In the next lesson, we’ll learn how to use these bounding boxes to detect when they intersect, and some practical reasons why that is useful.

Finally, we’ll end the chapter by revisiting our physics system and use our new bounding boxes to let our objects physically interact with each other.

Intersections and Relevancy Tests

Optimize games by checking object intersections with functions like SDL_HasIntersection().
Abstract 3D art representing computer programming
Ryan McCombe
Published

In this lesson, we'll learn how to determine if shapes overlap in our game world, a process often called intersection testing. We'll focus on using SDL's built in functions like SDL_HasIntersection() and SDL_IntersectRect() to check if SDL_Rect and SDL_FRect objects intersect.

We'll also see how these tests are crucial for relevancy testing - optimizing our game by only updating objects that are currently important, like those near the player or visible on screen.

Handling Object Collisions

Implement bounding box collision detection and response between game objects
Abstract 3D art representing computer programming
Ryan McCombe
Published

In this lesson, we’ll revisit our physics system and integrate our new bounding boxes and rectangle intersection tools to allow objects to interact with each other.

We'll start by adding a floor object, and we’ll use bounding box intersections to detect when our object hits the floor (or anything else).

Finally, we'll code the logic to react to these collisions appropriately, with behaviors such as preventing objects from overlapping or reducing our player’s health if they get hit by a projectile.

Physical Motion

Create realistic object movement by applying fundamental physics concepts
Abstract art representing computer programming
Ryan McCombe
Published

In this lesson, we'll explore fundamental physics principles and how to implement them in our games. We'll explore how to represent position, velocity, and acceleration using our vector system, and how these properties interact over time.

By the end, you'll understand how to create natural movement, predict object trajectories, and integrate player input with physics systems.

We’ll be working with the basic Scene, GameObject, and Vec2 types we created previously:

Force, Drag, and Friction

Learn how to implement realistic forces like gravity, friction, and drag in our physics simulations
Abstract art representing computer programming
Ryan McCombe
Published

Now that we understand basic motion in our game engine, it's time to explore the forces that drive that motion. In this lesson, we'll implement several physical forces including gravity, drag, and friction.

We'll see how each affects our game objects differently based on their properties like mass and velocity. These techniques will allow you to create more realistic and engaging gameplay.

In this lesson, we’ll continue to use the basic application loop and components we introduced in the previous lesson. We’ll mostly be working in the GameObject class in this lesson.

It currently looks like the following, with the most notable characteristics being the Position, Velocity, and Acceleration vectors, and the Tick() function that updates them:

Momentum and Impulse Forces

Add explosions and jumping to your game by mastering momentum-based impulse forces
Abstract art representing computer programming
Ryan McCombe
Published

In this lesson, we'll explore how to implement physics interactions by adding momentum and impulses to our simulations.

We'll learn we can use physics to create features requiring sudden changes to motion, such as having our characters jump or get knocked back by explosions. We’ll also learn how to modify the strength of those forces based on how far away the source of the force is.

This lesson continues to use the components and application loop we introduced earlier in the section. We’ll mostly be working in the GameObject class.

The most relevant parts of this class to note for this lesson are its Tick() and ApplyForce() functions, as well as the Position, Velocity, Acceleration, and Mass variables. Those functions and variables currently look like this:

Scene Rendering

Create a scene management system that converts world space coordinates to screen space for 2D games.
Abstract art representing computer programming
Ryan McCombe
Published

When developing games, we need a way to represent our virtual world and then transform it to display on a screen

In this lesson, we'll create a complete scene system that lets us position game objects using world coordinates, and then automatically converts those positions to screen coordinates when rendering.

We’ll be using the Vec2 struct we created in the previous chapter, as well as Window and Image classes using techniques we covered earlier in the course. A complete version of these are available below:

Cameras and View Space

Create camera systems that follow characters, respond to player input, and properly frame your game scenes.
Abstract art representing computer programming
Ryan McCombe
Published

In most games, the player cannot view the entire game world at the same time. Rather, we can imagine the player moving a virtual camera around the world and what that camera sees determines what appears on the player’s screen.

In a top-down game, for example, they might move that camera by clicking and dragging their mouse. In an action game, the camera is attached to the player they’re controlling. As such, we need to show the world from the perspective of that camera. This view is another example of a space, commonly called the view space or camera space.

In this lesson, we'll explore how view space works, we’ll implement camera movement controls, and create character-following mechanics.

We’ll be using the Vec2 struct we created earlier. A complete version of it is available below:

Discrete and Continuous Values

Learn how to handle floating point precision issues when programming game physics and transformations between coordinate spaces.
Abstract art representing computer programming
Ryan McCombe
Updated
Published

When developing games, we frequently need to work with both continuous values (like physics positions) and discrete ones (like screen pixels).

In this lesson, we'll explore the challenges of working with floating point numbers in different coordinate spaces and learn practical techniques to avoid common pitfalls related to precision and comparison.

We’ll be using the Vec2 struct we created earlier in the course. A complete version of it is available below:

Building a 2D Vector Type

Learn the foundations of vector math to work with positions and movements, and create a custom type to apply these concepts
Abstract art representing computer programming
Ryan McCombe
Updated
Published

In previous lessons, we hinted at a custom type that could store a two-dimensional vector, which we can use to represent positions in a space. Such a type is typically called a vector, and they are the fundamental building block of computer graphics, simulation, and more.

Throughout the rest of this chapter, we’ll use them to represent concepts like positions, movements, directions, accelerations, and forces.

In this lesson, we'll implement a Vec2 type that can represent positions, movements, and forces in a 2D space by equipping our vector with operations like addition, subtraction, and scalar multiplication. This foundation will serve us well throughout the remainder of this chapter as we build increasingly sophisticated graphics and physics systems for our games.

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:

  • 99 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.

Contact|Privacy Policy|Terms of Use
Copyright © 2025 - All Rights Reserved