Learning Path: C++ Game Programming
4.2 (16 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
189 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learning Path: C++ Game Programming to your Wishlist.

Add to Wishlist

Learning Path: C++ Game Programming

Develop your game programming skills by creating innovative and customized games from scratch with C++
4.2 (16 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
189 students enrolled
Created by Packt Publishing
Last updated 6/2017
Current price: $10 Original price: $200 Discount: 95% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 9 hours on-demand video
  • 2 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Get to know C++ from scratch while simultaneously learning game building
  • Learn the basics of C++, such as variables, loops, and functions, to animate game objects, respond to collisions, keep the score, play sound effects, and build your first playable game.
  • Use more advanced C++ topics such as classes, inheritance, and references to spawn and control thousands of enemies, shoot with a rapid fire machine gun, and realize random scrolling game worlds
  • Stretch your C++ knowledge beyond the beginner level and use concepts such as pointers, references, and the Standard Template Library to add features—for example, split-screen co-op, immersive directional sound, and custom levels loaded from level-design files
  • Get ready to go and build your own unique games!
View Curriculum
  • Basic prior knowledge of game development and C is recommended, but not required.

Are you looking to learn C++ from scratch and simultaneously build stunning and interactive games?

Explore this Learning Path and you'll get what you're looking for. Start as an amateur and rise as a pro by taking this Learning Path.

This Learning Path is a fun journey to the world of game programming starting from the very basics of C++ such as OOP, pointers, introduction to the Standard Template Library, and finally building OpenGL-powered SFML fully-playable complex games. 

These games are an addictive frantic two-button tapper, a multi-level zombie survival shooter, and a split-screen multiplayer puzzle-platformer.

You will explore exciting game programming concepts such as particle effects, directional sound, OpenGL programmable Shaders, spawning thousands of objects, and more.

Packt’s Video Learning Paths are a series of individual video products put together in a logical and stepwise manner such that each video builds on the skills learned in the video before it.


John Horton

John Horton is a coding and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles about programming, especially for beginners. He is the founder of Game Code School , which is dedicated to helping complete beginners get started with coding using the language and platform that is best suited for them. John sincerely believes that anyone can learn to code and that everybody has a game or an app inside of them, and that they just need to do enough work to bring it out.

Who is the target audience?
  • If you are a game developer and looking to explore C++ game development, then this is perfect course for you.
  • This course offers a fun, example-driven approach to learning game development and C++. In addition to explaining game development techniques in an engaging style, you’ll learn the key C++ topics by building a game in a practical (not theory-based) way, with multiple runnable/playable stages in each section.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
89 Lectures
Beginning C++ Game Programming - Part 1
64 Lectures 06:03:29

This video provides an overview of the entire course.

Preview 04:25

SFML has the potential to build the highest-quality 2D games. So a beginner can start using SFML and not worry about having to start again with a new language/library as their experience grows. Let's explore the games we will build using SFML.

The Games, C++, and SFML

Now that we know about how we will be making these games, it is time to set up a development environment. This video will show us how to proceed with that.

Setting Up the Development Environment

If we don't know how the game is going to work on the screen, how can we possibly make it work in code? Let's learn how to plan the game and create a new project from the reusable project template.

Planning Timber!!! and Creating a Project from the Template

Assets are things we need in order to make a game. It mainly includes font, sound and graphics. We must know how to add them. This video guides us with assets and understanding screen and internal co-ordinates.

Adding Project Assets and Understanding Co-ordinates

It's time to apply all that we've learned and start coding the game. This video will guide us with the initial code and explain what each line of code does.

Starting to Code the Game

We've studied about SFML but using SFML can be a bit tricky. Let's explore how we can use SFML features to open a new window.

Opening a Window using SFML

We need a way to stay in the program until the player wants to quit. Also, we must provide a way for the player to exit. Otherwise the game will go on forever. This video will help us achieve this goal.

The Main Game Loop

At last, we need to add some real graphics in our game. Let's see how we will create and draw the game background and display it.

Drawing the Game Background

There will always be problems and errors in every project you make, that is guaranteed. Let's learn about the types of errors so that we are able to identify and rectify them whenever they occur.

Handling Errors

Variables are the way that our C++ games store and manipulate values. If we want to know how much health the player has then we need a variable. Is the game over or still playing? That's also a variable. So, let's first learn about variables before we proceed with our game.

Preview 06:01

At this point, we know exactly what variables are, the main types, and how to declare and initialize them, but we still can't do many operations with them. We need to manipulate our variables, add them, take them away, multiply, divide, and test them. Let's explore manipulating variables.

Manipulating Variables

In this video, we will add clouds, a tree and a bee to our game. This is going to be easy. We will use exactly the same procedure that we used in the previous section when we drew the background.

Adding Clouds, a Tree, and a Buzzing Bee

Random numbers are useful for a lot of reasons in games. Perhaps you could use them for determining what card the player is dealt with. This video will demonstrate using random numbers to determine the starting location and the speed of the bee and the clouds.

Random Numbers

The C++ if and else keywords are what enable us to make decisions. We have already seen if in action in the previous section when we detected, in each frame, whether the player had pressed the Esc key. So, it'd be quite easy to learn.

Making Decisions with if and else

Before we can move the bee and the clouds, we need to consider timing. As we already know, the main game loop executes over and over again, until the player presses the Esc key.


Let's use the elapsed time since the last frame, to breathe life into the bee and the clouds. This will solve the problem of having a consistent frame rate across different PCs.

Moving the Clouds and the Bee

As we progress with this game over the next three sections, the code will obviously get longer and longer. So, now it seems like a good time to think ahead and add a little bit more structure into our code. We will add this structure to give us the ability to pause and restart the game.

Pausing and Restarting the Game

In the previous section, we briefly mentioned strings and we learned that a string can hold alphanumeric data. We didn't look at declaring, initializing, or manipulating strings. So let's do that now and briefly discuss the Text and Font classes.

C++ Strings, SFML Text, and Font

Now we know enough about strings, SFML Text, and SFML Font to go about implementing the HUD. This video will show us how to add a score and a message to our game screen.

Adding a Score and a Message

As time is a crucial mechanic in the game, it is necessary to keep the player aware of it. It will give him a sense of urgency as the end of the game draws near, and a sense of accomplishment if he performs well enough to maintain or increase his remaining time.

Adding a Time Bar

In programming, we often need to do the same thing more than once. The obvious example that we have seen so far is our game loop. There are a few different types of loop and we will look at the most commonly used.


If a variable is a box in which we can store a value of a specific type, like int, float, or char, then we can think of an array as a whole row of boxes. Let's learn about arrays in detail so we know how to use them.


We have already seen if, which allows us to make a decision whether to execute a block of code based upon the result of its expression. Sometimes a decision in C++ can be made better in other ways. This video will demonstrate using switch.

Making Decisions with switch

An enumeration is a list of all the possible values in a logical collection. They make the code clearer and less error-prone. Let's learn how to use class enumerations.

Class enumerations

A function is a collection of variables, expressions, and control flow statements (loops and branches). In fact, any of the code we have learnt about in the course so far can be used in a function. Let's explore C++ functions in this video.

Getting Started with Functions

This last video of the section will guide us in using all the new C++ techniques to draw and move some branches on the tree.

Growing the Branches

As we now move closer to running the game. Let's add the code for the player's sprite, as well as a few more sprites and textures and then draw them.

Preparing and Drawing the Player and Other Sprites

Lots of different things depend on the movement of the player, such as when to show the axe, when to begin animating the log, and when to move all the branches down a place. This video shows us how to set up the keyboard handling for the player chopping.

Handling the Player's Input

Every game has to end badly, with either the player running out of time (which we have already handled) or getting squished by a branch. Let's see how to detect the player getting squished.

Handling Death

We've built the game but it has no sound yet. To complete the game, we will add three sounds. Each sound will be played on a particular game event. Let's identify what are the sounds and when we'll play them.

Simple Sound FX

Now that we've built the game, let's take a look at these suggested enhancements for Timber!!! project. This video will show what the enhanced version of our game look like.

Improving the Game and the Code

Understand and start with our Zombie Arena game.

Planning and Starting the Zombie Arena Game

Manage, change, or update easily to with OOP.

Object-Oriented Programming

Player class benefits from knowing a few details about the overall environment the game is running in.

Building Player - The First Class

Controlling the Game Camera with SFML View

Controlling the Game Camera with SFML View

Start the game engine by using the updated code.

Starting the Zombie Arena Game Engine

Manage the code to reduce its length and make it concise.

Managing the Code Files

In this video, we will learn how to manage the code for game.

Starting Coding the Main Game Loop

What do we do if we need to work on a number of complex objects which are needed in the main function? References are the solution to this problem.

C++ References

SFML allows us to load a sprite sheet as a regular texture in exactly the same way we do for every texture. So, let's see how to do it.

SFML Vertex Arrays and Sprite Sheets

Now that we have our hands on with C++ References and we are capable of creating Sprite sheets, let us step ahead and learn to generate a scrolling background.

Creating a Randomly Generated Scrolling Background

By the end of this video you will be able to use and render the background. So, let's jump right in.

Using the Background

Pointers are variables that hold memory addresses. Typically, a pointer will hold the memory address of another variable. This sounds a bit like a reference but in this video, we will see how they are much more powerful.

Getting Started with Pointers

Now that we have learned the basics about pointers. We will use a pointer to handle an ever-expanding horde of zombies.

Working with Pointers

The STL is a collection of data containers and ways to manipulate the data we put in those containers. Or to be more specific, it is a way to store and manipulate different types of C++ variables and classes. Let's learn more about STL in this video.

The Standard Template Library

Thousands of zombies represent a new challenge. Not only would loading, storing, and manipulating thousands of copies of three different zombie textures take up a lot of memory, but also a lot of processing power too. This video will show us how to use the TextureHolder class to solve this problem.

The TextureHolder Class

We are now armed with the TextureHolder class to make sure that our zombie textures are easily available, as well as only loaded into the GPU once, we can look into building a whole horde of them.

Building a Horde of Zombies

Now we have a class to create a living, attacking, and killable zombie. This video will show us how to spawn a whole horde of them.

Creating a Horde and Bringing It Back to Life

Since we have our TextureHolder class, we might as well be consistent and use it to load all our textures. Let's make some very small alterations to the existing code that loads textures for the background sprite sheet and the player.

Using the TextureHolder Class for All Textures

As of now, we have a controllable character running around in an arena full of zombies that chase him. The problem is that they don't interact with each other. We need to detect collisions between the zombies and the player and give him bullets to defend himself.

Coding the Bullet Class

Now that we've given the player bullets, we need to make them usable. This video will show us how to get the bullets working.

Making the Bullets Fly

The player would see a mouse cursor on the screen, at this moment. We have to replace it with a crosshair which gives him an aim to shoot on and looks cool as well. Adding a crosshair is easy and only requires one new concept. We'll see that in this video.

Giving the Player a Cross-Hair

In this video, we will code a Pickup class that has a Sprite, member as well as other member data and functions. We will add pickups to our game in just a few steps.

Coding a Class for Pickups

After all that hard work implementing the Pickup class, we can now go ahead and write code in the game engine to actually put some pickups into the game.

Using the Pickup Class

We need to know when certain objects from our game touch certain other objects. We can then respond to that event in an appropriate manner. In our classes, we have already added functions to call when our objects collide. So, let's see how we'll detect collisions.

Detecting Collisions

Familiarize yourself with the details added to the code, especially the variable names.

Adding All the Text and HUD Objects

Understand how to slow down our game loop.

Updating the HUD Each Frame

HUD stays neatly positioned over the top of the main game action after drawing it.

Drawing the HUD, and the Home, and Level-Up Screens

Create and save the high score for each game.

Saving and Loading the High-Score

Create sound effects to the game.

Preparing Sound Effects

Enable the player to level-up.

Leveling Up

Modify code and restart the game.

Restarting the Game

Play the sound and the final game.

Playing the Rest of the Sounds
Beginning C++ Game Programming - Part 2
25 Lectures 02:45:05

This video provides an overview of the entire course.

Preview 03:05

To keep our game simple without losing the challenge, we will have the task of creating the need for two players to Play cooperatively. We also need to make sure the game is not too easy. This video shows us the basic features and the assets we need to create our game.

The Thomas Was Late Game

One of the problems that has been quite pronounced so far is how long and unwieldy the code gets. OOP allows us to break our projects up into logical and manageable chunks called classes. Let's see how we can make a big improvement to the manageability of the code.

Structuring the Thomas Was Late Code

As discussed earlier, we will code a class called Engine that will control and bind together the different parts of the Thomas Was Late game. This video guides you in building the Engine class, which will hold all other functions.

Building the Game Engine

For instantiating the Engine class, we need a file that contains our main function and the code that instantiates the Engine class. Let’s see how we can do that.

Coding the Main Function

We have seen how we can create objects from the classes of the SFML library. But, what if there is a class that has useful functionality, but is not quite what we want? This video will teach you how you can inherit from the other class.


Polymorphism allows us to write code that is less dependent on the types we are trying to manipulate. In this video, we'll take a look at what polymorphism means in its simplest form.


An abstract class is a class that cannot be instantiated and therefore cannot be made into an object. So, is it code that will never be used, then? Let's find out.

Abstract Classes – Virtual and Pure Virtual Functions

Now that we know the basics about inheritance, polymorphism, and pure virtual functions, we will put them to use. In this video, we'll build a PlayableCharacter class that has the vast majority of the functionality.

Building the PlayableCharacter Class

Now it's time for us to use inheritance for real. We will build a class for Thomas as well as Bob. They will both inherit from the PlayableCharacter class we have coded. Let's see how we do that.

Building the Thomas and Bob Classes

In order to be able to run the game and see our new characters, we have to declare instances of them, call their spawn functions, update them in each frame, and draw them in each frame. Let's do that now.

Updating the Game Engine to use Thomas and Bob

There are different levels in a game. In this video, you will learn about the different levels in our game.

Designing Some Levels

We need to add levels to the levelmanager class that we will create. This video will guide you through that.

Building the Level Manager Class

For using the level manager class that we created earlier, we need to code for loading the level in the engine class.

Coding the loadlevel Function

After adding classes in engine, we will update the engine in order to make final changes in the view of our game in this video.

Updating the Engine

To detect if our players come in contact with other things in the game or each other, we need a collision detector.

Collision Detection

Spatialization is making something relative to the space it is a part of. It gives the game a real-world feeling. In order to do that, we must first understand spatialization and how it works.

Spatialization and SFML

To manage all the sounds that will be used in our game, we will create a class and manage all our sound effects through that.

Building the SoundManager Class and Adding it to the Game Engine

When a player nears a particular tile, a sound is emitted from the tile which makes it easy for the player to identify the type of tile they are going toward. This helps in creating a real-life effect in the game. 

Populating the Sound Emitters

Now that we have all the functions for sound effects in the appropriate places, we will code for playing these sounds according to the time and place.

Playing Sounds

In order to interact with the player, we require text in our game. The HUD class helps in that.

The HUD Class

To let the player know about his score, health, and even position, we need to know how to use the HUD class.

Using the HUD Class

The Drawable class has just one function. It has no variables either. Furthermore, its one and only function is pure virtual. This means that if we inherit from Drawable, we must implement its one and only function. This video will guide you how we can solve this problem.

The SFML Drawable Class

We will use the particle effect in our game. When a character Dies, he will explode in a starburst/firework-like particle effect. Let's see how we can achieve that.

Building a Particle System

Open Graphics Library is a programming library that handles 2D and 3D graphics. This video explores how OpenGL works.

OpenGL, Shaders, and GLSL
About the Instructor
Packt Publishing
3.9 Average rating
8,059 Reviews
58,215 Students
686 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.