In this post, I will introduce you to C++ template programming. Some of the topics I will cover are function templates, class templates, variable templates, variadic templates, type traits, SFINAE, and C++ 20 concepts.
Tag Archives: C++
C++ Fast Track for Games Programming Part 17: AI
Like physics, AI (Artificial Intelligence) is an incredibly complex field, and it’s always changing. Some companies allocate entire teams to the subject to make their game provide challenging game play. So we will only cover a few very basic concepts in this tutorial.
C++ Fast-track for Games Programming Part 16: Physics
In this tutorial, you will be introduced to game physics. This is an incredibly broad field, and quite complex too, so you’ll really only get a teaser. This will however produce some pretty neat effects.
C++ Fast Track for Games Programming Part 15: File I/O
Before we continue with typical game related topics, you need to know a few more general techniques that will help you when you write your games. One of these techniques is file I/O. File I/O stands for Input/Output. You are of course already performing file I/O operations, for example when you load an image. However, this is handled by some image library (FreeImage). Sometimes, you simply want to store your own data.
C++ Fast Track for Games Programming Part 14: Fixed Point
In part Part 9 you worked with colours and were introduced to the noble art of bitmagic. Here’s a quick refresher: multiplying an integer value by a power of 2 can be done by shifting its (binary) bits to the left.
Division is similar, except this time you shift to the right. So for example, \(6a\) is equivalent to \(2^2a+2a\) which is equivalent to
(a<<2)+(a<<1) using bit-shifting operations. Being aware of the number of bits in a variable is especially important if more than one number is stored in the bits of a 32-bit integer. This is is the case for 32-bit colours: Each of the red, green, and blue components each use 8-bits with the alpha component completing the 32-bits to represent a single pixel.
C++ Fast Track for Games Programming Part 13: Data Structures
You are quite far into the C++ Fast Track preparation for Games Programming tutorial series. If you got here in good shape, you learned a lot: you went though the basics of C++ programming, and got a taste of object oriented programming as well. In the meantime, you experimented with quite a few game related concepts. In the upcoming parts, you’ll further expand your knowledge, with more info on bit magic, file I/O, graphics programming and game development in general. But first: let’s get acquainted with the wonderful world of data structures.
C++ Fast Track for Games Programming Part 12: Classes
In this part, we will build on the code from our work with Tiles. We aim to place this in a more reusable and understandable structure – this is where classes come in.
C++ Fast Track for Games Programming Part 11: Tiles
It is time to introduce you to a great concept for 2D graphics in C++, that you will find very useful and easy to use: tilemaps.
C++ Fast Track for Games Programming Part 10: Arrays
In previous episodes we generally worked with one object at a time: one ball, one grain of sand, and so on. In practice, we will generally want several of these. This is where arrays come in handy.
C++ Fast Track for Games Programming Part 9: Colours
In this article we will return to the numbers that represent colours, as demonstrated in the second instalment of this series. This can only be done through the wonderful world of
bit magic, which is by the way a very nice place to be, so we will explore it thoroughly.