• $19 Game Dev' Courses - Use code "FEBUDEMY"

    Video courses

The Unreal Engine Developer Course – Learn C++ & Make Games

Learn and Understand C++

Over 260 video lectures in 44 hours of video!

Beginning C++ Game Programming: Part 1

6 hours, 2 games, No experience necessary

This course is for you if you are completely new to programming or the C++ language. This tutorial course will explain all you need to know to code C++ games as quickly as is realistic. This course will also be relevant if you wanted an introduction to C++ that was a bit more fun and a lot more visual than a typical C++ beginners guide.

There will be a whole range of game related mini-projects to accompany this course and you will be able to choose which ones you are most interested in completing. I would suggest however that you try out all the practical projects that are suggested throughout these tutorials as you will learn faster.

This course is also the place to start if you want to progress to learn to code for many different development platforms. For example C++ is the language of Unreal Engine and CryEngine the two most advanced game engines available. This C++ course will be especially relevant if you are an aspiring indie developer who wants to make super-fast 2d games; perhaps you want to get your game on Steam? C++ is the place to start. To accompany this C++ course there will be practical projects that use the SFML C++ library which is probably the best way for someone just starting game development who wants to make 2d games for any of the desktop operating systems. These mini-projects will lead to full working game projects.

About this tutorial

Skill level 1
Time to read: 10 minutes

New Concepts:

  1. C++ code comments
  2. Introduction to the key C++ topics for building games

Recommended preparation tutorials

  • No previous experience needed

Projects related to or that demonstrate these concepts

  • None
This C++ course will assume you know absolutely nothing about C++ or any other programming language. It will explain all jargon as we proceed through each tutorial.

At times in the course, we will take an optional break from theory to do an appropriate project. These projects are hands-on real coding and are much more fun than theory. All the projects will be as game related as possible, including some full working games.

The tutorial list here will grow over the coming days and weeks.

Explaining code through comments

Sometimes I will add extra explanation or clarification within the code itself. To do this I will use C++ comments. Whenever you see a line of code with two forward slashes- like this // at the start, that line of code doesn’t do anything except tell you something about the code. In our C++ programs, we will use comments to remind us of what different blocks or lines of code achieve. Here is what a comment looks like.

// I am just a comment and don't really do anything


// The line of code above shoots an alien
// That was a useful comment wasn't it

Enough of all the introductions let’s get on with the tutorials.

The C++ game coding tutorials

The tutorials are designed to get you coding games as fast as possible. They are not fully comprehensive and some topics have been trimmed to the maximum. I am sure that the best way of learning to code C++ games; is to code C++ games. So the sooner we can start doing that the better. You will find that all of the practical C++ projects on this site come with loads of refresher information and of course lots of useful C++ comments using “//”. So don’t feel you need to master a topic before moving on. You can always refer back.

1 – Game Variables in C++

This tutorial introduces the fundamental C++ building blocks of our game, variables. The variables tutorial explains how we keep track of the state of our game when writing in C++. Variables can be everything from the players score to an entire level of our game. Let’s get started and learn about game data and variables in C++.

  • Beginning C++ Game Programming

    Beginning C++ Game Programming

    This book is all about offering you a very fast and fun introduction to the world of game programming and C++. It will begin by teaching you the programming basics such as variables, loops, and conditions. In this book there is very little theorizing. If you want a deep discussion of all the ins and outs of C++ concepts look elsewhere. If you are starting from a knowledge of zero C++ and want to build great games- fast, take a look at this book.
    • Setup a C++/SFML/Visual Studio development environment
    • Build a fast, fun Timber clone after learning basic C++
    • Discover the fundamentals of C++ object oriented programming and build a multi-level, top-down 2D, scrolling zombie survival/shooter
    • Explore some advanced C++ concepts and make a side scrolling, co-op split-screen multiplayer platform game with directional sound, particle effects and your very own level designs!
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US only)
    C++ for Game programmers book

    C++ For Game Programmers

    Already know the basics of C++ but want to dig much deeper in an entirely game-focussed context? C++ for Game Programmers is that book. This best selling title supplements your knowledge by putting everything into perspective from a game-development point of view. The book points out the most effective C++ practices and steers you away from the potentially dangerous ones. It describes common C++ techniques to solve specific problems most game developers face.
    • From a gaming perspective, learn about inheritance, performance, memory management, and STL to object creation, object serialization, and scripting languages
    • Explore C++ Design Patterns and high-level problem-solving constructs that are most commonly found in games
    • Discover custom Structures and algorithms, which provides a detailed hands-on discussion of using C++ to create efficient solutions to difficult problems in a highly structured manner
    Amazon USA
    Amazon UK
    Amazon CA
    Game Programming Patterns book

    Game Programming Patterns

    If you are serious about writing high quality, reusable, efficient code using C++ or indeed any other language, then inevitably you will need to seriously hone your knowledge of game programming patterns. If you don't know what game programming patterns are they are simply the solutions to design problems. If you have programmed even a basic game you will have noticed that the code gets long and hard to manage, very quickly. The more features you add the more sprawling and messy your code gets. In addition to usability/reuse-ability, our game code needs to be efficient enough for the game to run smoothly. That's what this book will do for you.
    • Learn to write a robust game loop, how to organize your entities using components, and take advantage of the CPUs cache to improve your performance
    • Discover how to organize your entities using components, and take advantage of the CPUs cache to improve your performance.
    • Never again wonder what is the "best" way to organize your game code
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US only)

2 – Manipulating Game Variables in C++

This tutorial shows us the mathematical way in C++ that we can change our game’s data that is contained within our variables. After all, the player’s score does not remain static. Changing game variables in C++.

3 – Checking for conditions in C++

Now that we can use variables to represent all the vital data in our game we will see how we can test for important events called conditions within our game. How do we know when the player has lost their last life or achieved a new high-score? Find out about Checking for conditions in C++.

4 – Branching our C++ game code

Here we will use everything we learned about conditions and variables so far to make our game take a different course dependent upon an outcome . Learn about Branching our C++ game code.

5 – Looping our game code

In game coding, we will regularly want to execute parts of our code multiple times while making subtle or not-so-subtle variations to our C++ code on each pass. For example, each and every frame of our game is contained in just such a loop. This is how it works: Looping our game code.

6 – Organizing code with functions

Functions are the organizing blocks of our code. We can think of a function as a black box that does one very specific task and can be reused over and over. Learn how we organize our game code with C++ functions.

7 – Introducing OOP for C++ games

OOP is probably the most vital topic in modern game coding. How do we break down our planned game and the objects (like characters, spaceships, and levels) into its most appropriate constituent parts? Find out in this introduction to OOP in C++ game coding.

8 – Game data handling with C++ arrays

C++ arrays are what enable us to manage lots of objects in our game in an orderly manner. It is all well and good to have a well-designed object that can represent a zombie, an invader or a bullet; but what about when we need dozens, hundreds or even thousands of them? This brief tutorial solves the problem by learning about C++ arrays.

9 – Using C++ references to make code faster

When we pass values to a function or return values from a function that is exactly what we are doing. Passing or returning a value. What happens is that a copy of the variable’s value is made, and sent into the function where it is used. Nothing happens to the actual variable itself. C++ references allow us to work around this. But why would we even want to? Using C++ references to make code faster.

10 – Controlling game memory with C++ pointers

Pointers have a bad reputation. They can appear complicated or convoluted. Add to this, the way pointers can be used in C++ code has evolved in recent years. I believe the best way to understand them is to use them in their original (old-fashioned) form. You can’t understand how an internal combustion engine works if you go straight to a supercar. So what is a pointer? Controlling game memory with pointers.

Be sure to complete all the related SFML game projects.