Game Development Reference
In-Depth Information
Chapter 3
Game Programming Basics
3.1 Introduction
In this chapter, we are going to cover the basic elements of programming games.
This chapter provides a starting point for the chapters that follow it. First, we are
going to talk about the basic skeleton of any game, consisting of a game world and
a game loop . We will also show you what the basic structure of a game application in
C# looks like, and how to create a simple application that changes the background
color to illustrate how to use this structure. Finally, we will talk about clarifying
your code by using comments, layout, and whitespace in the right places.
3.2 Building Blocks of a Game
3.2.1 The Game World
What makes games such a nice form of entertainment is that we can explore an
imaginary world and do things there that we would perhaps never do in real life. We
can ride on the back of a dragon, destroy entire solar systems, or create a complex
civilization of characters that speak in an imaginary language. This imaginary world
in which we play the game is called the game world . Game worlds can range from
very simple worlds such as the Tetris world to complicated virtual worlds in games
such as Assassin's Creed or World of Warcraft.
When a game is running on a computer or a console, the machine maintains an
internal representation of the game world. This representation does not look any-
thing like what you see on the screen when you play the game. It consists mostly
of numbers describing the location of objects, how many hit points an enemy can
take from the player, how many items the players has in his inventory, and so on.
Fortunately, the machine also knows how to create a visually pleasing representa-
tion of this world that it displays on the screen. Otherwise, playing computer games
would probably be incredibly boring, where the players have to sift through pages of
 
Search WWH ::




Custom Search