Introduction

This Goal of This Book

Gaming on the move has become very popular during recent years. With the arrival of the Nintendo Gameboy, people realized that they could take their games out and about with them, and as technology has become more sophisticated these games have grown, too. They now encompass complex game mechanics, advanced 2D and 3D graphics, and engrossing stories and game worlds that the player can literally become lost in.

Alongside this phenomenon is the explosion in popularity of mobile communication devices. Nearly everyone carries a phone with them every time they leave the house. These devices have become much more than just phones, however; they provide contact management, e-mail, web browsing, satellite navigation, and entertainment.

Writing games for mobile devices allows both these trends to be brought together into the same place. It is very easy for people to "pick up and play" a game on their mobile device as they always have it in their pocket—whether they are progressing through a sprawling role-playing game on a train or simply want the few minutes of casual diversion that mobile gaming can provide while waiting for an appointment.

Windows Phone 7 Game Development aims to bring you the knowledge and techniques that you will need to create your own games for devices running the Microsoft's powerful Windows Phone 7 operating system. Starting with the basics of the platform and its development environment, and progressing through to advanced topics such as 3D graphics, it will guide you step by step toward creating a simple and manageable environment into which you can write your own mobile games and distribute them to the world for fun or profit. Example projects are provided to demonstrate all the techniques discussed and are ideal as a basis for experimentation.

Both of the application environments supported by Windows Phone 7 are addressed, exploring how games can be produced in the dedicated gaming environment, XNA, and also in the more general-purpose and user-interface-driven Silverlight.

Who This Book Is For

This book is written for those who are already familiar with programming one of the two main managed Visual Studio languages: C# or Visual Basic.NET. It is assumed that you already have a grasp of the fundamentals of programming and are familiar with using the environment for PC-based application development. This is not an introduction to programming or to Visual Studio itself.

You will, however, be given a complete guide to setting up the development environment for Windows Phone 7 programming, getting your first programs to compile, and interactively debugging your games as they run either on the Windows Phone 7 emulator included with the phone's free software development kit or on a real device.

In order to develop software for your device, you will need to use the Visual Studio 2010 development environment. If you already have Visual Studio 2010, you can integrate the Windows Phone 7 development tools into your existing environment; if you do not have it, you can obtain Visual Studio 2010 Express for Windows Phone free of charge via a simple download from the Microsoft web site.

Although most of the projects in the book can be developed using the provided emulator, it is strongly recommended that you also have access to a real device to test your games.

The examples in this book are all written using C#, the only development language fully supported for Windows Phone 7 development. Developers who are more familiar with VB.NET should find that the language code and concepts translate over to C# fairly easily, so this should not present too much of a barrier to entry.

Chapter Overview

The following is a brief description of each chapter. The chapters tend to build on one another, so it is recommended that you read them in sequence to avoid knowledge gaps in later chapters.

Chapter 1 introduces Windows Phone 7 and using the Visual Studio 2010 development environment to create Windows Phone 7 games and applications. It explains how to set up simple .NET projects running against the emulator and real devices, explores debugging techniques, and begins to look at the two application environments: XNA and Silverlight.

Chapter 2 dives into XNA, exploring in detail the structure of XNA projects, the approach to displaying and updating graphics, how sprites can be used to create complex 2D graphics output, and how to work with fonts and text.

Chapter 3 takes the concepts explored so far and builds them into a simple reusable game framework that simplifies many of the tedious elements of setting up a game project. This allows you to focus on the game itself rather than getting weighed down with object management. This chapter also introduces the first of the example game projects in this book: Cosmic Rocks.

Chapter 4 covers the subject of user input. All sorts of input devices are available on Windows Phone 7 devices, from touch screens and keyboards through to accelerometers, and they are explored in detail to show how they can be used to allow your games to be controlled.

Chapter 5 turns up the volume and reveals the options for game audio. Covering simple sound effects to MP3 music playback, everything you need to know about sound for your games can be found here.

Chapter 6 begins to explore rendering with vertices and matrices instead of using sprites. Matrix transformations are uncovered and explained so that graphics can be rotated, scaled, and translated; and concepts such as texture mapping, blending, and alpha effects in this environment are explored.

Chapter 7 lifts the XNA feature set up into the third dimension, explaining how to create 3D game worlds. Subjects covered include perspective and orthographic projections, the depth buffer, and lighting so that your scenes really come to life.

Chapter 8 continues the exploration of XNA in the third dimension and introduces a number of useful new rendering features. These features include importing 3D objects from third-party modeling packages, moving and manipulating the camera within a game world, using particle effects, creating background imagery with sky boxes, applying fog to a 3D scene, and using XNA's Effect objects to add new features and capabilities to your game.

Chapter 9 provides some useful reusable components that can be used in any game. A simple mechanism for loading and saving user settings and a high-score table implementation are provided to allow you to focus on writing your game rather than having to reinvent these features yourself.

Chapter 10 exposes the Windows Phone 7 application life cycle and tombstoning, an essential topic that you will need to get to grips with so that your game can live side by side with other applications that the user chooses to open on their device.

Chapter 11 moves away from XNA and begins to explore Windows Phone 7's other application environment: Silverlight. While not specifically geared around games, Silverlight still has plenty of capabilities and great potential for game development. This chapter introduces the environment and explores how it is used.

Chapter 12 takes a more detailed look at the controls that are available for use in Silverlight projects, and also explores topics such as page navigation, orientation, and full-screen mode.

Chapter 13 focuses on game development in Silverlight, building a simple but flexible sprite control, and covering topics such as hardware acceleration, storyboard animation, game timing, and user input. It also begins development of this book's second example game project: Diamond Lines.

Chapter 14 steps through a series of additional Silverlight topics, exploring subjects including navigation through the different stages of a game, music and sound effects, game settings, high-score tables, and Silverlight's view of the application life cycle.

Chapter 15 sets up shop inside the Windows Phone Marketplace. This is the outlet that you need to use to distribute your game to the rest of the world, and possibly make some money from it, too. The chapter contains a guide to the Marketplace submission requirements, as well as tips on testing your game, managing versions, creating trial versions, and promoting your game to encourage people to try it.

Chapter 16 brings things to a close by stepping back from the phone and looking at how both XNA and Silverlight games can be brought to life on other platforms. XNA games can be played on Windows PCs (as well as the Xbox 360), and Silverlight games can be run in a variety of web browsers. This chapter shows you how to painlessly convert your games so that they run in these environments.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.222.149