1. Technology

Sams teach yourself Windows 7 Phone Game Programming in 24 Hours Book review

Interested in Developing Mobile Games?

About.com Rating 4 Star Rating


Screenshot of Windows 7 Phone Game Programming in 24 Hours Book

If you wish to become a mobile phone game developer you have a choice of three different systems and programming languages. Learn Objective-C to program iOS devices (iPhone, iPad), Java to program Android or C# to program Windows Phone 7. However through commercial software like MonoTouch and MonoDroid it's possible to program iOS devices and Android in C#, so in theory, you could build off one code base for all three platforms.

Sams Teach Yourself Windows Phone 7 Game Programming in 24 hours aims to teach you game programming in 24 one hour lessons, a common format of theirs. If you are familiar with either of Silverlight or XNA then you would find this book a breeze.

Those are the two WP7 Phone programming technologies employed. This is however not a book for the complete beginner to C#. It doesn't pretend to be and if you want to learn C#, start with another book first then come back to this. Additionally although I mentioned Silverlight, as does the book, the emphasis in the book is on XNA. Silverlight is mentioned to show you the alternative but that's it. This is not a book about Silverlight!

What You'll need to get the best out of the Book

The good news is that Microsoft provides all the tools free for programming Windows Phone 7 games, though I believe if you wish to release them commercially through Microsoft you may need to buy the professional version of Visual C# 2010. For learning though you can just use the free Visual C# 2010 Express Edition.

You'll also need to install the Game Studio, a free add-in that gives you XNA. Chapter two goes over this and shows you the project types you can setup once it's installed. By the end of that chapter you should have run an empty project and added some code from the book.

Bitmaps and Sprites

Chapter three is a very small one that finishes off the code started in the last chapetr and you end up with a way of displaying text in the Wp7 Emulator. As there are 24 hours and chapters in the book and its only about 350 pages long, each chapter is by necessity short and snappy. You may overflow the odd hour once or twice but chapter four on user input and touch won't stretch you too much.

Displaying bitmaps is a large part of any game and that's what chapter five introduces you too- drawing bitmaps with transparency. Without transparency you'd just get rectangles moving around and that's not much fun! This is such an important topic that the next 11 hours, chapter six to sixteen are devoted to it. Starting with bitmaps as sprites, creating a class, this expands to moving sprites in chapter seven and rotating and scaling in chapter eight. There's a little bit of trigonometry in chapter nine on advanced linear and angualar velocity, i.e. pointing sprites in different directions with a simple 2D helicopter and space shuttle examples, with plenty of code.

Hour ten is a bit longer and deals with sprite collisions. It's at a simple level, using boundaries, both circular and rectangular. The next chapter is a different subject, that of managing lots of sprites. It's not particularly clever stuff though, just using large dynamic lists to hold the sprites.

Chapter twelve looks in a very simplistic way at sprite color animation. Would I have missed this chapter had it been left out? Not a lot! The next chapter on sprite transform animation is a little better. If you have used Flash and the animation system there, you'll get a sense of what the author is doing with the animation class, as in sort of programmatically creating the timeline. All gthe game sprites are based on an Animation class which manages color, and other transformations.

Chapters fourteen and fifteen build on this with frame animations to end up with a powerful class for handling sprite animation. The last of the sprite chapters, sixteen deals with 2D sprites and issues such as sprite depth which deals with which sprites appear in front of others aka z-depth ordering.

The Rest of the Book

The last third of the book, chapters 17-24 covers GPS, playing audio, reading and writing files, creating a GUI, and then finishes off with the last four chapters on gameplay. GPS is very easy to program but not easy to test on the emulator so the book includes simulation code. Coverage of using audio is good in Chapter 18 and deals with both SoundEffect and SoundEffectInstance classes which gives greater control.

Isolated Storage is a technique where WP7 Apps can store and retrieve data on the phone without accessing any other system files. Chapter 19 gives good examples of creating and reading an XML file. This would typically be used for storing game levels solved, user config data etc.

Chapter twenty looks at the GUI and creates labels, buttons, horizontal and vertical sliders based on a common control. Short but effective.

Finally the last four chapters are about game play starting with Chapter 21 on Finite State Gameplay, breaking down game play into logical states. Chapter 22 is about physics, and gravity in particular with the start of a black hole game. This is enhanced in chapter 23 and polished off in chapter 24 with sounds, title screen, game over screen etc.

In Conclusion

This is a book for reasonably experienced developers who know C# already and who want to learn a new technology. If you know XNA already I'd suggest that you could get by without this. There's a fair bit in the book but it feels a little lightweight and skips over some bits that could do with a lttle extra depth. There is a lot of code though so overall it gets a 4 * rating.

  1. About.com
  2. Technology
  3. C / C++ / C#
  4. Book and Software Reviews
  5. Sams Teach yourself Windows 7 Phone Game Programming in 24 Hours Book review

©2014 About.com. All rights reserved.