Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

XNA 2.0 Game Programming Recipes: A Problem-Solution Approach / Edition 1

XNA 2.0 Game Programming Recipes: A Problem-Solution Approach / Edition 1

by Riemer Grootjans

ISBN-10: 159059925X

ISBN-13: 9781590599259

Pub. Date: 07/01/2008

Publisher: Apress

Join the game development revolution today! XNA greatly simplifies the development of your own games, lowering the barrier for programmers to get into game development. In XNA, you can start coding your games from the very start, a true revelation compared to other game programming environments. XNA doesn't sacrifice power for this ease of use - it is built


Join the game development revolution today! XNA greatly simplifies the development of your own games, lowering the barrier for programmers to get into game development. In XNA, you can start coding your games from the very start, a true revelation compared to other game programming environments. XNA doesn't sacrifice power for this ease of use - it is built entirely on DirectX technology.

XNA expert Riemer Grootjans brings together a selection of the hottest recipes in XNA programming for the Windows PC and Xbox360 console. Advanced XNA programmers, experienced coders new to games development, and even complete beginners will find XNA 2.0 Game Programming Recipes an invaluable companion when building games for fun or as commercial products.

What you’ll learn

XNA 2.0 Game Programming Recipes covers virtually every feature of the XNA 2.0 framework. It focuses primarily on 2D and 3D graphics programming, but other game programming features such as Audio playback and Networking are also discussed in detail.

These are some of the topics that are being covered in-depth:

  • How to create 2D graphics
  • 3D rendering techniques at various levels of difficulty
  • Loading, rendering and animating 3D Models
  • To read input devices: Keyboard, Mouse, Xbox360 Controller
  • Use Audio to spice up your game
  • Add Networking to your game to challenge your friends
  • Learn about the architectural XNA features, such as GameComponents
  • The Content pipeline: one of the 3 major components in XNA Game Development
  • A whole list of HLSL techniques!

Who this book is for

This book is for everyone! Whatever your experience, you will find a recipe to suit your need and skill. Great care has been taken to ensure the easier recipes provide a great deal of detail so they can be followed by readers without a great deal of programming experience. Each chapter gradually builds in difficulty so you will be able to progress through it as your XNA coding improves and you want to move on to more sophisticated techniques.

Product Details

Publication date:
Edition description:
1st Corrected ed. 2008. Corr. 4th printing 2008
Product dimensions:
7.00(w) x 9.20(h) x 1.40(d)

Related Subjects

Table of Contents

About the Author     xi
About the Technical Reviewer     xiii
Acknowledgments     xv
Introduction     xvii
Getting Started with XNA 2.0     1
Install XNA Game Studio 2.0     1
Start Your First XNA 2.0 Project     3
Deploy Your XNA2.0 Game on Xbox 360     6
Deploy Your XNA2.0 Game on Another PC     8
Customize Game Loop Timing     10
Make Your Code Plug-and-Play Using GameComponents     11
Allow Your GameComponents to Communicate with Each Other by Implementing GameServices     15
Save and Load Data to/from a File     19
Setting Up Different Camera Modes in Your 3D World     25
Set Up the Camera: Position, Target, and View Frustum     25
Specify the Target of Your Camera     33
Create a First-Person Shooter Camera: A Quake-Style Camera     39
Create a Freelancer-Style Camera: Full 3D Rotation Using Quaternions     45
Check Whether an Object Is in Sight of the Camera     52
Detect Camera Collision Against Models, Walls, or Terrains     57
Create a Camera Fly-by Action     60
Remove the Solid Background Color: Skybox     70
Draw Only the Parts of the Scene That Are in Sight of theCamera: Octree     82
Use a Quadtree to Hide Parts of a Grid That Are Not in Sight     104
Set Up a Post-Processing Framework     113
Create a Blur/Glow Post-Processing Effect     125
Define an Orthogonal Projection Matrix to Generate a Depth Map of the Scene     135
Working with 2D Images/Textures in XNA 2.0     145
Display 2D Images: Load and Render Images Using the SpriteBatch Class     146
Rotate, Scale, and Mirror an Image     151
Render Transparent Images Using Layers     153
Consider Performance When Using the SpriteBatch Class     157
Display Text     160
Create a 2D Menu Interface     162
Create a Texture, Define the Color of Each Pixel, Save a Texture to a File     176
Render the Scene into a Texture     178
Extend the Image Content Processor     182
Extend the Image Content Processor: Grayscale Conversion and Processor Parameters     195
Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera     199
Create a 3D Explosion Effect/Simple Particle System     220
Create a Mirror: Projective Texturing     233
Working with Models     247
Load and Render a Model Using the BasicEffect Class     248
Set Different World Matrices for Different Objects, Combining World Matrices     252
Find the Rotation Angle Corresponding to a Direction     258
Use Acceleration to Control Velocity     260
Construct the Global BoundingSphere Around a Model     265
Scale the Model to a Predefined Size     267
Render a Model Using Custom Effects and Custom Textures (Easy Approach)     269
Visualize the Bone Structure of a Model     274
Make the Bones Move Individually: Model Animation     281
Use BoundingSpheres for Basic Model Collision Detection     286
Use Ray-Traced Collision Detection for Small/Fast Objects     292
Extend the Model Content Processor to Load Custom Effects (Clean Approach)     295
Gain Direct Access to Vertex Position Data by Extending the Model Processor     302
Gain Direct Access to Vertex Position Data of Each ModelMesh by Extending the Model Processor     307
Gain Direct Access to Vertex Position Data by Defining a Custom TypeWriter and TypeReader     312
Store Multiple Objects in the Tag Property by Defining a Custom TypeWriter and TypeReader     322
Correctly Tilt a Model Corresponding to the Terrain Underneath     329
Detect Ray-Model Collisions Using Per-Triangle Checks      340
Detect Whether the Pointer Is Over a Model     349
Getting the Most Out of Vertices     355
Render Triangles, Lines, and Points in a 3D World     356
Apply a Texture to Your Triangles     367
Remove Redundant Vertices Using Indices     375
Store Your Vertices and Indices in the Memory of Your Graphics Card Using a VertexBuffer and an IndexBuffer     379
Store Your Vertices in a DynamicVertexBuffer for Frequently Updated Data     384
Enable Backface Culling: What It Is and What It Can Do for You     387
Automatically Calculate the Normals for All Vertices in a VertexBuffer     391
Create a Terrain Based on a VertexBuffer and an IndexBuffer     397
Calculate the Exact Height of a Terrain Between Vertices Using Bilinear Interpolation     407
Calculate the Collision Point Between the Pointer and the Terrain: Surface Picking     413
Extend the TextureProcessor to Generate a Terrain Object from an Image: Advanced DOM Objects     420
Write a Custom Content Importer: Loading a Terrain from a CSV File     432
Load Data from an XML File     439
Create Your Own Vertex Format     445
Introducing Bump Mapping: Fixed Normal     455
Adding Per-Pixel Detail by Bump Mapping in Tangent Space     460
Add an Ocean to Your 3D World     472
Apply Catmull-Rom Interpolation in 3D to Generate Additional Vertices     485
Create the Vertices for a Racing Track     489
Adding Light to Your Scene in XNA 2.0     499
Define Normals and Use the BasicEffect     500
Share Normals Between Vertices     506
Add Higher Detail to Your Lighting: Per-Pixel Lighting     511
Add Specular Highlights to Reflective Surfaces     514
Add HLSL Vertex Shading     516
Define a Point Light Using HLSL     522
Add HLSL Per-Pixel Lighting     524
Define a Spotlight Using HLSL     528
Add HLSL Specular Highlights     530
Add Multiple Lights to Your Scene Using Deferred Shading     535
Add Shadowing Capability to Your Deferred Shading Engine     551
Adding Sounds to Your XNA 2.0 Project     559
Play Simple .wav Sound Files     559
Loop Sounds     563
Play Sounds from a 3D Location Relative to the Camera: 3D Sound     567
Networking in XNA 2.0     571
Sign In for Networking Services     571
Create a Network Session     574
Join a Networking Session     579
Send/Receive Data Over the Network      584
Search for Networking Sessions Asynchronously     592
Move from the Lobby to the Actual Game     595
Index     599

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews