Author: Rob Miles
Publisher: Microsoft Press, 2011
Aimed at: Complete beginners
Cons: Perhaps too simple!
Reviewed by: Ian Elliot
In the Learn Programming Now! series this has the flag "Design and build your own games for Xbox 360, Windows Phone 7 or your PC".
This is a book for complete beginners and it aims to make getting started with XNA as easy as possible. As such it demands no prior knowledge of programming or C# in particular. It also only deals with the XNA in 2D - if you want to work in 3D you need a different book.
It is divided into four parts of increasing sophistication. Part 1 is about getting started and it explains how to download, install and work with XNA studio with a PC, Xbox and a Windows Phone. The first program is the default application created by the template and it just shows a blue screen and involves no coding. There are lots of screen dumps complete with arrows showing you which buttons to press to make it all work. This approach is aimed at the complete beginner but you can't help wondering if a complete beginner who has to have the run button pointed out is going to make it to creating a game.
Chapter 2 is called Programs, Data and Pretty Colors, which to me sounds a bit feeble but the project is a "mood" light so it is perhaps justified. The example is explained in a sort of do-this, do-that style and it leaves a lot unexplained - for example:
".. you can ignore the protected override void part for now"
It does introduce many of the basic ideas of programming but they are well hidden in the text so don't be tempted to skip anything and read it carefully. You are learning about programming while constructing an example. It even starts to introduce object-oriented ideas but I'm not convinced that "Classes as Offices" is a good metaphor. This is also the part that introduces the If statement. Chapter 3 continues the programming tutorial by extending the example to using input devices - game pad and keyboard.
At the end of Part I you should have a rough idea of what using XNA is all about and have acquired some, but far from all, of the ideas of programming. Part II Images Sound and Text continues the exploration. It works its way though a set of task-oriented tutorials, one per chapter - displaying images, text, multiplayer games, playing sounds, creating a timer and reading text input. As before programming ideas are introduced as we go along - the For loop in Chapter 5:Writing Text, arrays in Chapter 8:Creating a Time and so on. Again these aren't the stars of the show and are introduced as part of getting the example built.
Part III ramps up the level yet again as its title "Writing Proper Games" would suggest - although exactly what a "proper game" is isn't quite clear. It is more that in this section the programming comes to the fore. Chapter 10 is about using methods to solve problems. Here things start to get technical - types, compiler and casting. expression types and so on. Chapter 11: A game as a C# program raises the question of what else could it be? But in fact it takes a look a the organisation of a project using folders and resources and covers sprites. static methods and things that are now getting quite advanced. Chapter 12: Games, Objects and State is even more sophisticated and Chapter 13 looks at finishing a game.
Chapter 14 really moves into programming with a look at classes, objects and games. Here any pretense at simplicity starts to slip and we have accounts of encapsulation, coupling, messages, containers, structures, value and type references and of course inheritance. The final few chapters return to some practical issues - creating game components and multiplayer games.
Part IV is all about Windows Phone 7 and it specializes what you have already learned to this particular environment with a chapter on motion sensitive games, touch input and the differences between mobile games and full games.
This is a relatively short book on a big subject so it isn't going to tell you everything about XNA or C#. If you last to the end of the book you will need another book to expand you horizons but this isn't necessarily a bad thing.
Overall this isn't a bad way to learn XNA but it isn't going to suit every reader. If you know how to program in C# then this book is going to irritate you in the way that it dribbles out information. It certainly isn't the way to find out about XNA programming.
If you really are a beginner then you are going to have to work quite hard to scale the heights of the final chapters. Even when you do get to the end you are only going to have a very rough idea of what programming is all about. With luck it might propel you in the direct of a good book on programming to get it straight. If you like learning by example and you want to make a start with XNA then this might be the place to start.