Home > Store

XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360

Register your product to gain access to bonus material or receive a coupon.

XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360

eBook (Watermarked)

  • Your Price: $34.39
  • List Price: $42.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2011
  • Dimensions: 7" x 9"
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-262016-2
  • ISBN-13: 978-0-13-262016-1

Get Started Fast with XNA Game Studio 4.0–and Build Great Games for Both Windows® Phone 7 and Xbox 360®

This is the industry’s best reference and tutorial for all aspects of XNA Game Studio 4.0 programming on all supported platforms, from Xbox 360 to Windows Phone 7 and Windows PCs. The only game development book authored by Microsoft XNA development team members, it offers deep insider insights you won’t get anywhere else–including thorough coverage of new Windows Phone APIs for mobile game development.

You’ll quickly build simple games and get comfortable with Microsoft’s powerful XNA Game Studio 4.0 toolset. Next, you’ll drill down into every area of XNA, including graphics, input, audio, video, storage, GamerServices, and networking. Miller and Johnson present especially thorough coverage of 3D graphics, from Reach and HiDef to textures, effects, and avatars. Throughout, they introduce new concepts with downloadable code examples designed to help you jumpstart your own projects. Coverage includes

  • Downloading, installing, and getting started with XNA Game Studio 4
  • Building on capabilities provided in the default game template
  • Using 2D sprites, textures, sprite operations, blending, and SpriteFonts
  • Creating high-performance 3D graphics with XNA’s newly simplified APIs
  • Loading, generating, recording, and playing audio
  • Supporting keyboards, mice, Xbox 360 controllers, Touch, accelerometer, and GPS inputs
  • Managing all types of XNA storage
  • Using avatars as characters in your games
  • Utilizing gamer types, player profiles, presence information, and other GamerServices
  • Supporting Xbox LIVE and networked games
  • Creating higher-level input systems that seamlessly manage cross-platform issues

From Windows Phone 7 mobile gaming to Xbox 360, XNA Game Studio 4.0 creates huge new opportunities for experienced Microsoft developers. This book helps you build on skills you already have, to create the compelling games millions of users are searching for.

Sample Content

Table of Contents

Introduction    1

So You Want to be a Game Developer?    1

A Brief History of XNA Game Studio    1

What Is Available in Game Studio    4.0?    3

Why This Book?    4

1  Getting Started    5

Installing XNA Game Studio    4.0    5

Downloading the Tools    6

App Hub Membership    6

XNA Game Studio Connect    9

Writing Your First Game    11

Your First XNA Game Studio Windows Game    11

Your First XNA Game Studio XNA Xbox    360 Game    11

Your First XNA Game Studio Windows Phone    7

Game    12

Download Samples    12

Summary    12

2  Sprites and    2D Graphics    13

What Does    2D Mean?    13

Show Me Something on Screen    14

Spritebatch    16

Drawing    16

Moving Things Around    19

Animation    20

Controlling State    21

Rendering Text    25

Summary    27

3  The Game Object and the Default Game Loop    29

What Is in a New Project?    29

The Game Class    32

Virtual Methods    32

Methods    33

Properties    34

GameTime    34

Game Loop    36

Update and Draw    36

Components    38

GameComponents    38

Summary    40

4  Introduction to    3D Graphics    41

3D Graphics in XNA Game Studio    41

What Are    3D Graphics?    42

Makeup of a    3D Image    42

3D Math Basics    43

Coordinate Systems    44

Vectors in    3D Graphics    46

Matrix    53

Graphics Pipeline    61

Graphics Card    62

Vertex Shader    62

Backface Culling    63

Viewport Clipping    63

Rasterization    64

Pixel Shader    64

Pixel Tests    64

Blending    65

Final Output    65

Reach and HiDef Graphics Profiles    65

Graphics Profiles Define Platform Capabilities    66

The Reach Profile    66

The HiDef Profile    66

Let the    3D Rendering Start    67

GraphicsAdapter    67

GraphicsDevice    69

Drawing with Primitives    71

Summary    83

5  Lights, Camera, Action!    85

Why Do I See What I See?    85

View Matrix    87

Projection Matrix    88

Perspective    89

Orthographic    93

Camera Types    93

Static Cameras    94

Models    95

What Is a Model?    95

Rendering Models    99

Summary    103

6  Built-In Shader Effects    105

Using BasicEffect    106

Basic Lighting    108

Textures, Vertex Colors, and Fog    114

Using the Effect Interfaces    121

Using DualTextureEffect    122

Using AlphaTestEffect    124

Using EnvironmentMapEffect    124

Using SkinnedEffect    127

Summary    140

States, Blending, and Textures    141

Device States    141

BlendState    142

DepthStencilState    149

Render Targets    155

Faking a Shadow with a Depth Buffer and Render

Targets    158

Back to Device States    161

The Stencil Buffer    161

RasterizerState    164

SamplerStates    166

Other Texture Types    169

Summary    170

8  Introduction to Custom Effects    171

What Is a Custom Effect?    171

High Level Shading Language    172

Creating Your First Custom Effect    172

Parts of an Effect File    173

Global Variables    174

Vertex Structures    174

Drawing with a Custom Effect    177

Vertex Color    179

Texturing    180

Setting Sampler States in Effect File    183

Textures Repeating    184

Lighting    186

Ambient Lighting    186

Triangle Normals    190

Diffuse Lighting    192

Emissive Lighting    198

Specular Lighting    199

Fog    202

Point Lights    206

Effect States    209

Alpha Blending Using Effect States    211

Summary    213

9  Using the Content Pipeline    215

Tracing Content Through the Build System    215

Content Processors    216

Content Importers    223

Combining It All and Building Assets    226

Combining What You Learned So Far    235

Summary    238

10  Having Fun with Avatars    239

Introduction to Avatars    239

Accessing Avatar Information Using

AvatarDescription    240

Loading Avatar Animations with AvatarAnimation    243

Drawing the Avatar Using AvatarRenderer    246

Modifying Avatar Lighting    248

Playing Multiple Animations    249

Blending Between Animations    253

Interacting with Objects    260

2D Avatars Using Render Targets    263

Custom Avatar Animations    265

Creating the Custom Animation    266

Building the Custom Animation Type    267

Creating the Content Processor    273

Adding the Custom Animation to Your Game    283

Updating Your Game to Use the Custom

Animation    284

Summary    285

11  Understanding Performance    287

General Performance    287

Who Takes Out the Garbage?    289

Multithreading    292

Graphics Performance    293

Measuring Performance    295

Performance Measurement Tools    306

Cost of Built-In Shaders    307

Summary    309

12  Adding Interactivity with User Input    311

Using Input in XNA Game Studio    311

Polling versus Event-Based Input    312

The Many Keys Of A Keyboard    312

Reading Keyboard State    313

Moving Sprite Based on Keyboard Input    315

Onscreen Keyboard    316

Precision Control of a Mouse    320

Reading Mouse State    320

Moving Sprite Based on Mouse Input    322

Setting the Mouse Position    324

Xbox    360 Gamepad    324

Reading Gamepad State    325

Moving Sprites Based on Gamepad Input    329

Thumb Stick Dead Zones    332

Other Types of Controllers    332

Is the Gamepad Connected?    333

Multitouch Input For Windows Phones    334

Reading the TouchPanel Device State    334

Determine Number of Touch Points    336

TouchPanel Width, Height, and Orientation    337

Moving Sprite Based on Multitouch Input    337

Reading Gestures from the TouchPanel    339

Displaying GestureSample Data    341

Windows Phone Sensors and Feedback    342

Acceleration Data using the Accelerometer    344

Locating a Windows Phone with the Location

Service    348

Providing User Feedback using Vibration    351

Summary    351

13  Turn Up the Volume    353

Playing Sound Effects    353

Using SoundEffect for Audio Playback    354

Microsoft Cross-Platform Audio Creations

Tool (XACT)    360

Dynamic Sound Effects    368

Recording Audio with a Microphone    368

Generating Dynamic Sound Effects    371

Summary    374

14  Storage    375

What Is Storage?    375

Isolated Storage    375

Saving and Loading Data    377

The IsolatedStorageFile Object    379

XNA Game Studio Storage    380

Recreating the Project on Xbox    380

Devices and Containers    382

Getting a Device    383

Looking at the API    387

Loading Loose Files from Your Project    388

Summary    390

15  Gamer Services    391

GamerServicesComponent    391

Guide Class    392

Trial Mode    392

Now the Bad News    397

Platform-Specific Guide Functionality    397

Gamers and Profiles    402

GameDefaults    405

Presence    406

Privileges    406

With Friends Like This...    407

Summary    408

16  Multiplayer Networking    409

Multiplayer Games    409

Getting Ready for Networking Development    410

Main Menu and State Management    412

Creating a Network Session    416

Building a Game Lobby    423

Playing the Game    425

Searching for an Available Network Session    430

Joining an Available Network Session    435

Sending Player Invites    438

Simulating Real World Network Conditions    439

Summary    440

17  Using Media in XNA Game Studio    441

What Is Media?    441

Playing a Song    441

MediaPlayer    442

Songs and Metadata    443

Media Enumeration    444

Media Library    444

Video    448

Rendering a Video    448

Visualizations    451

Rendering Visualization Data    451

Summary    453

A  Reach vs. HiDef Chart    455

B  Using the Windows Phone FMRadio    459

C  Windows Phone    7 Launchers and Choosers    463

D  Dealing with Tombstoning    479

Index    487

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020