What are variables?
Secretly, under the hood, games are all about data. The position of the player character, the names of your teammates in an online match, the volume amount in the setting window, or the maximum distance a fireball can travel – these are all pieces of data that the game works with to create an experience users like to play.
For example, a player character’s position can change during play by pressing the arrow keys on a keyboard. The computer will take this input, calculate the new position, and show the player where their character is within the virtual world. The computer will do this in some capacity for every piece of data within the game. We will learn a lot more about how the computer does all of these calculations throughout the book, but first, we’ll have to learn about these little pieces of data, where they get stored on the computer, and how they are used while the game is running.
Within the code of a game, each of these pieces...