Chapter 2: Creating Your First Game-Pong


Overview

This chapter talks about designing and creating a simple Pong game. Pong was the first video game ever and even before there were the first Pong versions in the sixties there was a version that could be played on an oscilloscope (Tennis for Two, 1958, by William A. Higinbotham). This shows how easy it is to implement a very basic version of Pong. A TV engineer named Ralph Baer claims that he had the idea of implementing Pong even before that in 1951, but not until 1966 was he able to produce the first prototypes. Atari licensed Pong in the eighties and even fought a court case with another company claiming they were the first to invent Pong. If you think about it today it sounds really crazy for such a simple game. You can read the whole Pong story at www.pong-story.com.

Implementing a very simple Pong clone doesn’t take much time, but you will also learn about the sprite classes of XNA in this chapter. You start by writing the concept of your game and go through the full design phase of game projects. In future projects you can make the same choices, and after a while you won’t have to think about the process of writing concepts first anymore because you will do it naturally to get the ideas for the first unit tests. Then you learn about an effective way to organize and use textures for your games. Additionally you will fine-tune the game, make it more fun, add 2-player support, and even test it on the Xbox 360 console.

Though this chapter focuses on the Pong game, it is not the only thing you are going to learn. The Pong game is used to learn more about the Agile Methodology I will mention later in this chapter. You will learn why it is important to write unit tests first and design the game up front in a very quick process and then improve it as you go along. In the next chapters you will use unit tests for additional classes too. For this game you just have one simple class and a couple of unit tests added at the end of it to test out the graphics, the collision testing, and to position everything correctly.

The kinds of unit tests used in this chapter are referred to as static unit tests as opposed to the dynamic unit tests you learn about in the next chapter. The difference is that you have to start static unit tests by hand and check the results yourself by watching the result on the screen. Dynamic unit tests, on the other hand, are executed automatically with help of a Unit Testing Framework like NUnit. For more details about the Unit Testing Framework, read Chapter 3.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

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