Chapter 7. Program Structure


You've made it through six chapters so far, and you've learned a lot. This chapter provides a payoff for your persistence. It shows how to pull together everything you've learned to design and implement an actual game.

In my experience, one of the worst things game programmers can do when they're writing a game is to just jump in and start writing program code. That's a recipe for disaster (or at least a big mess). The typical result is that a lot of code has to be rewritten because it doesn't quite do what's needed.

Instead, programmers should take some time to design the game program. This is different than designing the game. Designing the game includes tasks such as figuring out where to hide the Singing Sword of Power or what happens when you fire a 1000-MegaHurt InstaKill Thunderbomb at the Disgusting Fangbeast of Blort. We're not discussing game design in this chapter; we're talking about designing a game program.

When you design a game program, you're designing two important features of the code: the game's program structure and its file structure. This chapter explains how professional game programmers design the structure of their game programs. It also provides an overview of how they structure the files in a game. It demonstrates these concepts by creating a game called Ping.

In addition, the Ping example illustrates how to write a real game. It demonstrates dividing a game into levels. In this case, each level will be a ping-pong match. Ping also shows how to create and use message maps. It shows how easy message maps make it to respond to user input by updating the state of the game. Finally, the Ping program demonstrates game startup and shutdown.



Creating Games in C++(c) A Step-by-Step Guide
Creating Games in C++: A Step-by-Step Guide
ISBN: 0735714347
EAN: 2147483647
Year: N/A
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net