Book Image

Building your First Mobile Game using XNA 4.0

By : Brecht Kets, Thomas Goussaert
Book Image

Building your First Mobile Game using XNA 4.0

By: Brecht Kets, Thomas Goussaert

Overview of this book

With the dawn of the Windows Phone 7 platform, Microsoft has offered us an easy way to create 3D mobile games. In this book, we will build a 3D game for Windows Phone 7 together, taking full advantage of the graphics and touch capabilities, along with the sensors of the platform."Building your First Mobile Game using XNA 4.0" is the book for starting game development on the Windows Phone 7 platform. This book will go over the technical aspects of building games along with designing your own framework. Finally we'll build an actual game together from the ground up! This book will set future mobile game developers in the right direction.The XNA framework empowers us to build 2D and 3D games for PC, Xbox 360 and Windows Phone 7. We will use those capabilities to create stunning 3D games for the Windows Phone 7 platform. We will start by covering the basics like drawing graphics, followed by building a custom framework and end with building a game together!In this book, we will cover drawing 2D and 3D graphics, both static and animations. We will also cover the various ways of handling user input and help set the mood of our game playing both 2D and 3D sound, and accessing the user's media library. The only thing left before building a game is covering several techniques created for making our life easier while building the game, whilst building a framework to do just that. Finally, we'll build a 3D game together that will run on the Windows Phone 7 platform."Building your First Mobile Game using XNA 4.0" is the book you need to get started with mobile game development for Windows Phone 7. Its hands on approach will set you on your way in no time. Let's build some games!
Table of Contents (16 chapters)

Preface

Welcome to the world of mobile game development. By purchasing this book, you've made the first step towards building your first game for the Windows Phone platform.

In this book, we will first go over the technical stuff, like installing the tools, drawing 2D and 3D images, and end up building a 3D game for Windows Phone 7 together! Let's get started!

What this book covers

Chapter 1, Getting Started, is an introductory chapter where we define how we can build games for Windows Phone, install the necessary tools, and create our first project.

Chapter 2, 2D Graphics, covers drawing 2D images to the screen, moving them, and playing animations. We will also start creating a basic framework for our future game here.

Chapter 3, 3D Graphics, gives us more information about drawing 3D models, along with playing animations. The chapter also covers the concept of World, View, and Projection, and the concept of a camera.

Chapter 4, Input, will help us to add player interaction to our game, covering touch input, keyboard, and the accelerometer.

Chapter 5, Sound, will help us set the mood for our game. In this chapter, we will learn how to play sounds and apply effects to them, play 3D sound, and play songs.

Chapter 6, Building a Basic Framework, teaches us how to finalize our framework, so we are ready for building our game. This chapter introduces the concepts of a scene graph, a scene manager, and collision detection. It also shows us how to build menus.

Chapter 7, Building a Game, is the chapter where we build a game from scratch!

Chapter 8, Releasing our Game, gives us information on what to do after we finish our game. It gives information on how to release the game to the Windows Phone Marketplace and the certification process.

What you need for this book

Beside a healthy interest in building games, this book expects that you have knowledge about C# and some basic knowledge about math. Besides that, the book explains everything from the ground up.

You also need a computer with Windows Vista or newer (all editions except Starter Edition), 4 GB of free disk space, 3 GB RAM, and a DirectX10 or above capable graphics card.

Who this book is for

In this mini book, we won't have time to cover everything, so we assume you already have some experience with object-oriented programming. This book will cover the basics of building a game for Windows Phone, but we won't explain the C# programming language itself, nor object-oriented programming.

We will however explain the aspects of game development thoroughly, so don't worry if you have never written a (3D) game. We will cover all the basics here, including the much dreaded math. However, don't expect to write triple-A games, when you've finished this book, but you'll be off in the world of indie game development.

This is the right book for anyone, regardless of age and gender, if:

  • You are interested in game development

  • You want to start building games for Windows Phone

  • You have some programming knowledge

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

public class RenderContext
{
    public SpriteBatch SpriteBatch { get; set; }
    public GraphicsDevice GraphicsDevice { get; set; }
    public GameTime GameTime { get; set; }
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output.

You can download this file from http://www.packtpub.com/sites/default/files/downloads/7744EN_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.