C++ game coding tutorials
Beginner’s Guide to Handling Errors in C++
Writing error-free code is a crucial skill for any programmer. This guide will provide beginners with an overview of handling errors while writing C++ code. We will cover different types of errors, including configuration errors, compile errors, link errors, and bugs. Each section will be accompanied by game-like examples to illustrate the concepts effectively.
Configuration Errors
Configuration […]
Using C++ vectors
Here’s a quick tutorial on using the C++ from the Standard Template Library (STL). Be sure to check my tutorial on C++ maps, also from the STL. The Standard Template Library (STL) is a collection of data containers and ways to manipulate the data we put in those containers. It is a way to store and […]
Coding a simple text adventure in C++
As the last tutorial before we install a graphics library I thought a simple example that involves a game loop but no graphics would be worth while. Here’s a simple C++ tutorial for creating an adventure game where a prisoner escapes from a dungeon:
Setting up the game
To begin, create a new C++ project in your […]
Organizing your Game Data with C++ Maps
Maps are a great feature of C++ they allow us to store objects (made from classes) of any type and store them paired with any other variable. One useful combination I have used a fair bit in games programming is strings and Texture objects. The string represents the name of the graphics file and the […]
C++ Game Coding Level 1
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 […]
Game variables in C++
Whenever we code a PC game, we need to ‘know’ what the situation in the game is at any given point in time. As an example, things like the player’s score, how many people connected to the game lobbies, what position the game level all the players and NPCs are and of course what they are doing. The game’s variables are the […]
Manipulating the value of our game’s variables
Having just learned what C++ game variables are and that they store values that represent the objects in our games it is probably obvious that these values held by our variables will need to change as the game progresses. We can achieve this with C++ operators. Operators in C++ are just like mathematical operators and many of […]
C++ condition checking in a game
Condition checking in games is all about making decisions. How do we know the player has run out of lives? How do we detect the ball has reached the edge of the screen and needs to bounce back the other way? C++ has the keyword which we can use to code our […]
Structuring and branching the code
We have seen in the last tutorial how we can detect certain conditions in our C++ code. For example when the player loses a life, destroys an alien or gets a new fastest time. We have also seen the C++ keyword that allows us to execute a certain block of code when a particular condition or […]
Loops in the game code
Loops might sound a bit odd at first? They are a way of executing parts of our C++ code more than once, looping over code until we have the result we want or a test is done. This can simply mean doing the same thing until the code being looped over prompts the loop to end or it could […]