Contents

Foreword

Acknowledgments

About the Authors

Introduction

So You Want to be a Game Developer?

A Brief History of XNA Game Studio

What Is Available in Game Studio 4.0?

Why This Book?

1. Getting Started

Installing XNA Game Studio 4.0

Downloading the Tools

App Hub Membership

XNA Game Studio Connect

Writing Your First Game

Your First XNA Game Studio Windows Game

Your First XNA Game Studio XNA Xbox 360 Game

Your First XNA Game Studio Windows Phone 7 Game

Download Samples

Summary

2. Sprites and 2D Graphics

What Does 2D Mean?

Show Me Something on Screen

Spritebatch

Drawing

Moving Things Around

Animation

Controlling State

Rendering Text

Summary

3. The Game Object and the Default Game Loop

What Is in a New Project?

The Game Class

Virtual Methods

Methods

Properties

GameTime

Game Loop

Update and Draw

Components

GameComponents

Summary

4. Introduction to 3D Graphics

3D Graphics in XNA Game Studio

What Are 3D Graphics?

Makeup of a 3D Image

3D Math Basics

Coordinate Systems

Vectors in 3D Graphics

Matrix

Graphics Pipeline

Graphics Card

Vertex Shader

Backface Culling

Viewport Clipping

Rasterization

Pixel Shader

Pixel Tests

Blending

Final Output

Reach and HiDef Graphics Profiles

Graphics Profiles Define Platform Capabilities

The Reach Profile

The HiDef Profile

Let the 3D Rendering Start

GraphicsAdapter

GraphicsDevice

Drawing with Primitives

Summary

5. Lights, Camera, Action!

Why Do I See What I See?

View Matrix

Projection Matrix

Perspective

Orthographic

Camera Types

Static Cameras

Models

What Is a Model?

Rendering Models

Summary

6. Built-In Shader Effects

Using BasicEffect

Basic Lighting

Textures, Vertex Colors, and Fog

Using the Effect Interfaces

Using DualTextureEffect

Using AlphaTestEffect

Using EnvironmentMapEffect

Using SkinnedEffect

Summary

7. States, Blending, and Textures

Device States

BlendState

DepthStencilState

Render Targets

Faking a Shadow with a Depth Buffer and Render Targets

Back to Device States

The Stencil Buffer

RasterizerState

SamplerStates

Other Texture Types

Summary

8. Introduction to Custom Effects

What Is a Custom Effect?

High Level Shading Language

Creating Your First Custom Effect

Parts of an Effect File

Global Variables

Vertex Structures

Drawing with a Custom Effect

Vertex Color

Texturing

Setting Sampler States in Effect File

Textures Repeating

Lighting

Ambient Lighting

Triangle Normals

Diffuse Lighting

Emissive Lighting

Specular Lighting

Fog

Point Lights

Effect States

Alpha Blending Using Effect States

Summary

9. Using the Content Pipeline

Tracing Content Through the Build System

Content Processors

Content Importers

Combining It All and Building Assets

Combining What You Learned So Far

Summary

10. Having Fun with Avatars

Introduction to Avatars

Accessing Avatar Information Using AvatarDescription

Loading Avatar Animations with AvatarAnimation

Drawing the Avatar Using AvatarRenderer

Modifying Avatar Lighting

Playing Multiple Animations

Blending Between Animations

Interacting with Objects

2D Avatars Using Render Targets

Custom Avatar Animations

Creating the Custom Animation

Building the Custom Animation Type

Creating the Content Processor

Adding the Custom Animation to Your Game

Updating Your Game to Use the Custom Animation

Summary

11. Understanding Performance

General Performance

Who Takes Out the Garbage?

Multithreading

Graphics Performance

Measuring Performance

Performance Measurement Tools

Cost of Built-In Shaders

Summary

12. Adding Interactivity with User Input

Using Input in XNA Game Studio

Polling versus Event-Based Input

The Many Keys Of A Keyboard

Reading Keyboard State

Moving Sprite Based on Keyboard Input

Onscreen Keyboard

Precision Control of a Mouse

Reading Mouse State

Moving Sprite Based on Mouse Input

Setting the Mouse Position

Xbox 360 Gamepad

Reading Gamepad State

Moving Sprites Based on Gamepad Input

Thumb Stick Dead Zones

Other Types of Controllers

Is the Gamepad Connected?

Multitouch Input For Windows Phones

Reading the TouchPanel Device State

Determine Number of Touch Points

TouchPanel Width, Height, and Orientation

Moving Sprite Based on Multitouch Input

Reading Gestures from the TouchPanel

Displaying GestureSample Data

Windows Phone Sensors and Feedback

Acceleration Data using the Accelerometer

Locating a Windows Phone with the Location Service

Providing User Feedback using Vibration

Summary

13. Turn Up the Volume

Playing Sound Effects

Using SoundEffect for Audio Playback

Microsoft Cross-Platform Audio Creations Tool (XACT)

Dynamic Sound Effects

Recording Audio with a Microphone

Generating Dynamic Sound Effects

Summary

14. Storage

What Is Storage?

Isolated Storage

Saving and Loading Data

The IsolatedStorageFile Object

XNA Game Studio Storage

Recreating the Project on Xbox

Devices and Containers

Getting a Device

Looking at the API

Loading Loose Files from Your Project

Summary

15. Gamer Services

GamerServicesComponent

Guide Class

Trial Mode

Now the Bad News

Platform-Specific Guide Functionality

Gamers and Profiles

GameDefaults

Presence

Privileges

With Friends Like This...

Summary

16. Multiplayer Networking

Multiplayer Games

Getting Ready for Networking Development

Main Menu and State Management

Creating a Network Session

Building a Game Lobby

Playing the Game

Searching for an Available Network Session

Joining an Available Network Session

Sending Player Invites

Simulating Real World Network Conditions

Summary

17. Using Media in XNA Game Studio

What Is Media?

Playing a Song

MediaPlayer

Songs and Metadata

Media Enumeration

Media Library

Video

Rendering a Video

Visualizations

Rendering Visualization Data

Summary

A. Reach vs. HiDef Chart

B. Using the Windows Phone FMRadio

C. Windows Phone 7 Launchers and Choosers

D. Dealing with Tombstoning

Index

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

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