XNA 3.0 Game Programming Recipes: A Problem-Solution Approach

Book description

Join the game development revolution today! XNA 3.0 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.

Completely updated for XNA 3.0, expert Riemer Grootjans brings together a selection of the hottest recipes in XNA programming for the Xbox 360, PC, and Zune. Advanced XNA programmers, experienced coders new to game development, and even complete beginners will find XNA 3.0 Game Programming Recipes an invaluable companion whether building games for fun or as commercial products.

Table of contents

  1. XNA 3.0 Game Programming Recipes: A Problem-Solution Approach
    1. Title Page
    2. Copyright
    3. Dedication
    4. Contents at a Glance
    5. Contents
    6. About the Author
    7. About the Technical Reviewer
    8. Acknowledgments
    9. Introduction
    10. Chapter 1: Getting Started with XNA 3.0
      1. 1-1. Install XNA Game Studio 3.0
      2. 1-2. Start Your First XNA 3.0 Project
      3. 1-3. Deploy Your XNA 3.0 Game on Xbox 360
      4. 1-4. Deploy Your XNA 3.0 Game on the Zune
      5. 1-5. Deploy Your XNA 3.0 Game on Another PC
      6. 1-6. Customize Game Loop Timing
      7. 1-7. Make Your Code Plug-and-Play Using GameComponents
      8. 1-8. Allow Your GameComponents to Communicate with Each Other by Implementing GameServices
      9. 1-9. Save and Load Data to or from a File (1/2)
      10. 1-9. Save and Load Data to or from a File (2/2)
    11. Chapter 2: Setting Up Different Camera Modes in Your 3D World
      1. 2-1. Set Up the Camera: Position, Target, and View Frustum (1/2)
      2. 2-1. Set Up the Camera: Position, Target, and View Frustum (2/2)
      3. 2-2. Specify the Target of Your Camera (1/2)
      4. 2-2. Specify the Target of Your Camera (2/2)
      5. 2-3. Create a First-Person Shooter Camera: A Quake-Style Camera (1/2)
      6. 2-3. Create a First-Person Shooter Camera: A Quake-Style Camera (2/2)
      7. 2-4. Create a Freelancer-Style Camera: Full 3D Rotation Using Quaternions (1/2)
      8. 2-4. Create a Freelancer-Style Camera: Full 3D Rotation Using Quaternions (2/2)
      9. 2-5. Check Whether an Object Is in Sight of the Camera (1/2)
      10. 2-5. Check Whether an Object Is in Sight of the Camera (2/2)
      11. 2-6. Detect Camera Collision Against Models, Walls, or Terrains
      12. 2-7. Create a Camera Fly-by Action (1/2)
      13. 2-7. Create a Camera Fly-by Action (2/2)
      14. 2-8. Remove the Solid Background Color: Skybox (1/3)
      15. 2-8. Remove the Solid Background Color: Skybox (2/3)
      16. 2-8. Remove the Solid Background Color: Skybox (3/3)
      17. 2-9. Draw Only the Parts of the Scene That Are in Sight of the Camera: Octree (1/5)
      18. 2-9. Draw Only the Parts of the Scene That Are in Sight of the Camera: Octree (2/5)
      19. 2-9. Draw Only the Parts of the Scene That Are in Sight of the Camera: Octree (3/5)
      20. 2-9. Draw Only the Parts of the Scene That Are in Sight of the Camera: Octree (4/5)
      21. 2-9. Draw Only the Parts of the Scene That Are in Sight of the Camera: Octree (5/5)
      22. 2-10. Use a Quadtree to Hide Parts of a Grid That Are Not in Sight (1/2)
      23. 2-10. Use a Quadtree to Hide Parts of a Grid That Are Not in Sight (2/2)
      24. 2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain (1/5)
      25. 2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain (2/5)
      26. 2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain (3/5)
      27. 2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain (4/5)
      28. 2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain (5/5)
      29. 2-12. Set Up a Post-Processing Framework (1/3)
      30. 2-12. Set Up a Post-Processing Framework (2/3)
      31. 2-12. Set Up a Post-Processing Framework (3/3)
      32. 2-13. Create a Blur/Glow Post-Processing Effect (1/3)
      33. 2-13. Create a Blur/Glow Post-Processing Effect (2/3)
      34. 2-13. Create a Blur/Glow Post-Processing Effect (3/3)
      35. 2-14. Write a Custom Content Importer (1/2)
      36. 2-14. Write a Custom Content Importer (2/2)
    12. Chapter 3: Working with 2D Images/Textures in XNA 3.0
      1. 3-1. Display 2D Images: Load and Render Images Using the SpriteBatch Class (1/2)
      2. 3-1. Display 2D Images: Load and Render Images Using the SpriteBatch Class (2/2)
      3. 3-2. Rotate, Scale, and Mirror an Image
      4. 3-3. Render Transparent Images Using Layers
      5. 3-4. Consider Performance When Using the SpriteBatch Class
      6. 3-5. Display Text
      7. 3-6. Create a 2D Menu Interface (1/3)
      8. 3-6. Create a 2D Menu Interface (2/3)
      9. 3-6. Create a 2D Menu Interface (3/3)
      10. 3-7. Create a Texture, Define the Color of Each Pixel, Save a Texture to a File
      11. 3-8. Render the Scene into a Texture
      12. 3-9. Extend the Image Content Processor (1/3)
      13. 3-9. Extend the Image Content Processor (2/3)
      14. 3-9. Extend the Image Content Processor (3/3)
      15. 3-10. Extend the Image Content Processor: Grayscale Conversion and Processor Parameters
      16. 3-11. Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera (1/5)
      17. 3-11. Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera (2/5)
      18. 3-11. Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera (3/5)
      19. 3-11. Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera (4/5)
      20. 3-11. Make Your Scene More Impressive with Billboarding: Render 2D Images in a 3D World So They Always Face the Camera (5/5)
      21. 3-12. Create a 3D Explosion Effect/Simple Particle System (1/3)
      22. 3-12. Create a 3D Explosion Effect/Simple Particle System (2/3)
      23. 3-12. Create a 3D Explosion Effect/Simple Particle System (3/3)
      24. 3-13. Create a Mirror: Projective Texturing (1/3)
      25. 3-13. Create a Mirror: Projective Texturing (2/3)
      26. 3-13. Create a Mirror: Projective Texturing (3/3)
    13. Chapter 4: Working with Models
      1. 4-1. Load and Render a Model Using the BasicEffect Class
      2. 4-2. Set Different World Matrices for Different Objects, Combining World Matrices (1/2)
      3. 4-2. Set Different World Matrices for Different Objects, Combining World Matrices (2/2)
      4. 4-3. Find the Rotation Angle Corresponding to a Direction
      5. 4-4. Use Acceleration to Control Velocity
      6. 4-5. Construct the Global BoundingSphere Around a Model
      7. 4-6. Scale the Model to a Predefined Size
      8. 4-7. Render a Model Using Custom Effects and Custom Textures (Easy Approach)
      9. 4-8. Visualize the Bone Structure of a Model (1/2)
      10. 4-8. Visualize the Bone Structure of a Model (2/2)
      11. 4-9. Make the Bones Move Individually: Model Animation
      12. 4-10. Use BoundingSpheres for Basic Model Collision Detection (1/2)
      13. 4-10. Use BoundingSpheres for Basic Model Collision Detection (2/2)
      14. 4-11. Use Ray-Traced Collision Detection for Small/Fast Objects
      15. 4-12. Extend the Model Content Processor to Load Custom Effects (Clean Approach) (1/2)
      16. 4-12. Extend the Model Content Processor to Load Custom Effects (Clean Approach) (2/2)
      17. 4-13. Gain Direct Access to Vertex Position Data by Extending the Model Processor
      18. 4-14. Gain Direct Access to Vertex Position Data of Each ModelMesh by Extending the Model Processor
      19. 4-15. Gain Direct Access to Vertex Position Data by Defining a Custom TypeWriter and TypeReader (1/3)
      20. 4-15. Gain Direct Access to Vertex Position Data by Defining a Custom TypeWriter and TypeReader (2/3)
      21. 4-15. Gain Direct Access to Vertex Position Data by Defining a Custom TypeWriter and TypeReader (3/3)
      22. 4-16. Store Multiple Objects in the Tag Property by Defining a Custom TypeWriter and TypeReader (1/2)
      23. 4-16. Store Multiple Objects in the Tag Property by Defining a Custom TypeWriter and TypeReader (2/2)
      24. 4-17. Correctly Tilt a Model According to the Terrain Underneath (1/3)
      25. 4-17. Correctly Tilt a Model According to the Terrain Underneath (2/3)
      26. 4-17. Correctly Tilt a Model According to the Terrain Underneath (3/3)
      27. 4-18. Detect Ray-Model Collisions Using Per-Triangle Checks (1/2)
      28. 4-18. Detect Ray-Model Collisions Using Per-Triangle Checks (2/2)
      29. 4-19. Detect Whether the Pointer Is Over a Model
    14. Chapter 5: Getting the Most Out of Vertices
      1. 5-1. Render Triangles, Lines, and Points in a 3D World (1/3)
      2. 5-1. Render Triangles, Lines, and Points in a 3D World (2/3)
      3. 5-1. Render Triangles, Lines, and Points in a 3D World (3/3)
      4. 5-2. Apply a Texture to Your Triangles (1/2)
      5. 5-2. Apply a Texture to Your Triangles (2/2)
      6. 5-3. Remove Redundant Vertices Using Indices
      7. 5-4. Store Your Vertices and Indices in the Memory of Your Graphics Card Using a VertexBuffer and an IndexBuffer (1/2)
      8. 5-4. Store Your Vertices and Indices in the Memory of Your Graphics Card Using a VertexBuffer and an IndexBuffer (2/2)
      9. 5-5. Store Your Frequently Updated Vertices in a DynamicVertexBuffer
      10. 5-6. Enable Backface Culling: What It Is and What It Can Do for You
      11. 5-7. Automatically Calculate the Normals for All Vertices in a VertexBuffer (1/2)
      12. 5-7. Automatically Calculate the Normals for All Vertices in a VertexBuffer (2/2)
      13. 5-8. Create a Terrain Based on a VertexBuffer and an IndexBuffer (1/2)
      14. 5-8. Create a Terrain Based on a VertexBuffer and an IndexBuffer (2/2)
      15. 5-9. Calculate the Exact Height of a Terrain Between Vertices Using Bilinear Interpolation (1/2)
      16. 5-9. Calculate the Exact Height of a Terrain Between Vertices Using Bilinear Interpolation (2/2)
      17. 5-10. Calculate the Collision Point Between the Pointer and the Terrain: Surface Picking (1/2)
      18. 5-10. Calculate the Collision Point Between the Pointer and the Terrain: Surface Picking (2/2)
      19. 5-11. Load Data from an XML File (1/2)
      20. 5-11. Load Data from an XML File (2/2)
      21. 5-12. Create Your Own Vertex Format (1/2)
      22. 5-12. Create Your Own Vertex Format (2/2)
      23. 5-13. Work with Bump Mapping: Fixed Normal
      24. 5-14. Add Per-Pixel Detail by Bump Mapping in Tangent Space (1/3)
      25. 5-14. Add Per-Pixel Detail by Bump Mapping in Tangent Space (2/3)
      26. 5-14. Add Per-Pixel Detail by Bump Mapping in Tangent Space (3/3)
      27. 5-15. Add an Ocean to Your 3D World (1/3)
      28. 5-15. Add an Ocean to Your 3D World (2/3)
      29. 5-15. Add an Ocean to Your 3D World (3/3)
      30. 5-16. Apply Catmull-Rom Interpolation in 3D to Generate Additional Vertices
      31. 5-17. Create the Vertices for a Racing Track (1/2)
      32. 5-17. Create the Vertices for a Racing Track (2/2)
    15. Chapter 6: Adding Light to Your Scene in XNA 3.0
      1. 6-1. Define Normals and Use the BasicEffect (1/2)
      2. 6-1. Define Normals and Use the BasicEffect (2/2)
      3. 6-2. Share Normals Between Vertices
      4. 6-3. Add Higher Detail to Your Lighting: Per-Pixel Lighting
      5. 6-4. Add Specular Highlights to Reflective Surfaces
      6. 6-5. Add HLSL Vertex Shading (1/2)
      7. 6-5. Add HLSL Vertex Shading (2/2)
      8. 6-6. Define a Point Light Using HLSL
      9. 6-7. Add HLSL Per-Pixel Lighting
      10. 6-8. Define a Spotlight Using HLSL
      11. 6-9. Add HLSL Specular Highlights
      12. 6-10. Add Multiple Lights to Your Scene Using Deferred Shading (1/4)
      13. 6-10. Add Multiple Lights to Your Scene Using Deferred Shading (2/4)
      14. 6-10. Add Multiple Lights to Your Scene Using Deferred Shading (3/4)
      15. 6-10. Add Multiple Lights to Your Scene Using Deferred Shading (4/4)
      16. 6-11. Add Shadowing Capability to Your Deferred Shading Engine (1/2)
      17. 6-11. Add Shadowing Capability to Your Deferred Shading Engine (2/2)
    16. Chapter 7: Adding Sounds to Your XNA 3.0 Project
      1. 7-1. Play and Control Simple .wav Sound Files
      2. 7-2. Play MP3 or WMA Sound Files
      3. 7-3. Play Simple .wav Sound Files Through XAct
      4. 7-4. Loop Sounds
      5. 7-5. Play Sounds from a 3D Location Relative to the Camera: 3D Sound
    17. Chapter 8: Networking in XNA 3.0
      1. 8-1. Sign In for Networking Services
      2. 8-2. Create a Network Session (1/2)
      3. 8-2. Create a Network Session (2/2)
      4. 8-3. Join a Network Session (1/2)
      5. 8-3. Join a Network Session (2/2)
      6. 8-4. Send/Receive Data Over the Network (1/2)
      7. 8-4. Send/Receive Data Over the Network (2/2)
      8. 8-5. Search for Networking Sessions Asynchronously
      9. 8-6. Add Rich Presence Information
      10. 8-7. Move from the Lobby to the Actual Game
    18. Index (1/4)
    19. Index (2/4)
    20. Index (3/4)
    21. Index (4/4)

Product information

  • Title: XNA 3.0 Game Programming Recipes: A Problem-Solution Approach
  • Author(s): Riemer Grootjans
  • Release date: May 2009
  • Publisher(s): Apress
  • ISBN: 9781430218555