Chapter 2, part 1

I'm sure that you have at some point played a video game on some gaming system, so you should know what a game is. A game is a program that presents a challenge to a user, who performs some series of actions to accomplish a set goal. Games generally accept vast amounts of user input, from simple data entry to key presses. This tutorial will describe all of that.

Some games that we know of are played between two players. These are called multiplayer games. They can be further subdivided into two classes. There are multiplayer games where both players share one machine or they can be played on two separate machines, connected by some sort of linking device. The later method is substantially more complex, as it requires the two devices to be synced with each other. However, it is possible, even in TI-BASIC, as you will soon see.

Then there are the single-player games, in which a player battles against some sort of challenge himself. This challenge can be hard-coded into the game, randomized (where the actions of the machine are completely unrelated to what the user does), and games with true AI. In AI games, an artificial intelligence is programmed to respond to specific actions a user takes and the truth of various conditions increases the likelihood that the machine will take a certain action. The best and most challenging type of artificial intelligence (and by far the hardest to code) is one in which the machine constantly gathers information about how you play and adjusts its tactics accordingly.

Chapter 2, part 2

There are several things that distinguish a game from any other program type, and some of them make game programming one of the more difficult types of programming. First off, all games involve some sort of interface. An interface is simply a communication involving the user. The communication between two machines in multiplayer mode is one form of interfacing; the communication between user and machine is another.

Saving progress is another feature of a good game. What good would a longer game be if you had to start over every time you relaunched the program? It would be much better if you could somehow return to the place you left off. Saving is not a hard concept to understand, but keeping it organized is another story. You can record game data in variables and recall them later. But using fifteen variables can get confusing and cause conflicts with other programs. Luckily, you can use arrays, single variables that can be created and can store more than one piece of data. In TI-BASIC, arrays come in the form of lists, which will be discussed in a later chapter.

Another feature of most games is the existence of stages. Unless you have been involved in programming, you probably don't even think about this, but life is full of stages. A certain weapon cannot be used until level five. You cannot use a flamethrower in water. An explosive detonates near gunpowder and the explosion is several times larger than normal. This involves the use of conditionals, which are instructions that test for the truth of a statement. We will explore use of conditionals in game design later in this tutorial.

Chapter 2, part 3

What makes a game do what a game does? The answer to that question lies in the programming of the game. As you probably already know, a program is a series of instructions given to a processor, resulting in a certain output. Game programs often become large and complicated. They occupy large amounts of memory, especially on devices that don't have much memory to begin with. That's why all coders must go through a process called optimization, in which a program's code is modified to accomplish the same tasks within a smaller space and timeframe. In the following chapters, we will discuss how to create games of all styles.

+ Tweet