Those who approach programming with the intention of developing games initially tend to fall into two distinct categories of people: those who are confident with mathematics and those who are not. The latter group often overlooks the importance of mathematics and its relation to games as well as to programming in general. I once was in this latter group, and I readily admit to not having originally appreciated the relationship between them. In retrospect, it can now be said with some considerable certainty that mathematics makes a significant contribution to programming and games.
The fundamentals of programming are inextricably bound up with the laws of logic and reason, and throughout a programming career programmers are required to perform all sorts of calculations. The dualistic nature of programming and mathematics should be seen as a positive truth rather than a negative one; something comforting and predictable in a world of variation and surprise. This is because, as I hope to demonstrate, mathematics is not nearly as difficult as it initially seems, and readers who harbor irrational fears of anything numerical really ought not to concern themselves with such trivial worries. Math is fun and almost everybody can do it.
This book is about C++ game programming, and from its title we can conclude two things: a) I shall be explaining C++, and b) I shall be explaining C++ in the context of games. However, in order to understand C++ and game programming to its fullest extent, a suitable introduction to basic mathematics is first required. It is to this subject that we must now turn. This chapter aims to explain the following: