Author: Aaron Reed
Publisher: O'Reilly, 2010
Aimed at: C# programmers
Pros: Focused on game development
Cons: Not much that is specific to hardware platforms
Reviewed by: David Conrad
XNA has become much more popular since it became the main route to creating games applications for Window Phone 7. The subtitle of this book is "Game Development for the PC, Xbox 360, and Windows Phone 7". It doesn't really focus on any one of the platforms so if you really want a book about programming Window Phone 7 you might do better looking elsewhere. However, it is worth saying now that this is a very good book on the general subject of using XNA and on the specifics of creating games using it.
The first chapter is a only useful if already know some XNA and need to find out what is new in version 4.0. This probably should be moved to the end of the book. Chapter 2 is where most readers get started. It tells you what you need and gets you to write your first XNA program. The book has the courage to really start with the simplest program you could create - which simply displays a blank screen. Many books would have made the first program something more exciting but much more complicated. The simple approach is best and the author does try his best to be humorous about how little has been achieved. It may not look much but you have learned a lot!
Chapter 3 starts a short look at 2D graphics and games. Again the examples are very simple but they are on topic and well designed to get you started. Chapter 4 discusses collision detection which is something that many books ignore or relegate to a later chapter but in a book on game writing collision detection is a fundamental technique.
Chapter 5 is a little tutorial on object-oriented programming - it sounds boring but it is well explained and relevant. The next chapter brings us back to directly practical things with a look at sound effects and audio - mostly using XACT. The 2D section of the book rounds off with a strange chapter titled "Basic Artificial Intelligence" and a more straightforward one called "Putting it all together". The chapter that is supposedly on AI isn't really. It's more about thinking up heuristic algorithms that make game play interesting. For example, how do you create a sprite that chases another or a sprite that evades a pursuer.
Chapter 9 is where the big jump from 2D to 3D comes. Not all readers will be up to following the book though this transition because there is no disputing that 3D is harder than 2D graphics. The book does its best to make things seem simple by explaining coordinate systems and so on but as soon as you hit matrix multiplication some readers are going to bail out. This is unavoidable as math is part of 3D programming. A nice touch however is that textures are discussed and demonstrated right at the start. From here we work our way though some of the standard topics of 3D programming - 3D models, creating a first person camera and 3D collision detection. The chapter on 3D models uses a model that was originally supplied with the DirectX SDK as an example. This is a very reasonable way to get started but there isn't any good discussion of what to use to create your own models. As in the 2D case it is nice to see 3D collisions treated so early. All-in-all this is a good introduction to basic 3D.
The final few chapters of the book are at a slightly more advanced level. Chapter 13 deals with HLSL basics. This is a tough topic but the chapter does manage to make it seem reasonable. Chapter 14 explains particle systems. Chapter 15 returns to a simpler topic - finishing a 3D game.
Next we have two chapters dealing with deployment to the Xbox, Windows Phone respectively - there is no need for a chapter on deployment to the PC of course. Finally chapter 18 covers multi-player and network games and at this point we more or less have a complete game to work with.
All the way through the book there are questions and summaries of what you have learned in each chapter. The final appendix gives the answers to these questions which is a welcome extra.
I can't promise that this book will get you to be an XNA expert if you are a complete beginner. You at least need to know how to program in C# before even thinking of opening its covers. If you can program in C# and are prepared to put some work into understanding how things work then this book will teach you quite a lot about 2D and 3D games construction.The book is clear and makes steady progress with relatively easy to follow examples - it even has a little humour to lighten the load.