Learning XNA 3.0

Book description

Do you have what it takes to become a game developer? With this hands-on book, you'll learn quickly and easily how to develop computer games with Microsoft's XNA 3.0 framework-not just for your PC, but for Xbox 360 and the Microsoft Zune as well.

Written by an experienced university-level game development instructor, Learning XNA 3.0 walks you through the framework in a clear and understandable step-by-step format. Each chapter offers a self-contained lesson with lots of illustrations and annotated examples to help you master key concepts. Once you finish the book, you'll know how to develop sophisticated games from start to finish.

  • Learn game development concepts from 2D animation to 3D cameras and effects
  • Delve into high-level shader language (HLSL) and introductory artificial intelligence concepts
  • Develop three complete and exciting games using 2D,3D and multiplayer concepts
  • Develop and deploy games to the Xbox 360 and the Microsoft Zune

While teaching XNA to beginning game developers, author Aaron Reed noticed that several key concepts were difficult for students to grasp. Learning XNA 3.0 was written specifically to address those issues. With this book, you can test your understanding and practice new skills as you go with unique "Test Your Knowledge" exercises and review questions in each chapter.

Why wait? Amaze your family and friends by building your own games for the PC, Xbox 360, and Zune-with Learning XNA 3.0.

"An outstanding book! Teaches you XNA development in a smart way, starting from 2D basics and going into 3D and shader development. What I really like is the 'peeling the onion' approach the author takes, which builds up knowledge from previous chapters."--David "LetsKillDave" Weller, CEO, Cogito Ergonomics, LLC, and former XNA program manager

Publisher resources

View/Submit Errata

Table of contents

  1. Learning XNA 3.0
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Preface
      1. Who This Book Is For
      2. How This Book Is Organized
      3. Support
      4. Conventions Used in This Book
      5. Using Code Examples
      6. We'd Like to Hear from You
      7. Safari® Books Online
      8. Acknowledgments
    4. 1. Getting Started
      1. System Requirements
      2. Additional Resources
      3. Installation
      4. Creating Your First XNA Application
      5. What You Just Did
      6. Summary
      7. Test Your Knowledge: Quiz
    5. 2. Fun with Sprites
      1. A Look Behind the Scenes
      2. Game Development Versus Polling
      3. Modifying Your Game
      4. Adding a Sprite to Your Project
      5. Loading and Drawing Your Sprite
      6. Transparency and Other Options
      7. Layer Depth
      8. Let's Move
      9. Animation
      10. Adjusting the Framerate
      11. Adjusting the Animation Speed
      12. What You Just Did
      13. Summary
      14. Test Your Knowledge: Quiz
      15. Test Your Knowledge: Exercise
    6. 3. User Input and Collision Detection
      1. More Sprites
      2. Keyboard Input
      3. Mouse Input
      4. Gamepad Input
      5. Keeping the Sprite in the Game Window
      6. Collision Detection
      7. What You Just Did
      8. Summary
      9. Test Your Knowledge: Quiz
      10. Test Your Knowledge: Exercise
    7. 4. Applying Some Object-Oriented Design
      1. Designing Your Classes
      2. Creating a Sprite Class
      3. Creating a User-Controlled Sprite Class
      4. Creating an Automated Sprite
      5. Game Components
      6. Coding the SpriteManager
      7. Cleaning Up
      8. Making Them Move
      9. What You Just Did
      10. Summary
      11. Test Your Knowledge: Quiz
      12. Test Your Knowledge: Exercise
    8. 5. Sound Effects and Audio
      1. Using XACT
      2. Implementing XACT Audio Files in Code
      3. Using the Simplified API for Sound and Audio
      4. Adding More Sound to Your Game
      5. What You Just Did
      6. Summary
      7. Test Your Knowledge: Quiz
      8. Test Your Knowledge: Exercise
    9. 6. Basic Artificial Intelligence
      1. The Turing Test
      2. Creating Sprites at Random Intervals
      3. Randomly Spawning Sprites
      4. Irrelevant Objects
      5. Creating a Chasing Sprite
      6. Creating an Evading Sprite
      7. What You Just Did
      8. Summary
      9. Test Your Knowledge: Quiz
      10. Test Your Knowledge: Exercise
    10. 7. Putting It All Together
      1. Drawing 2D Text
      2. Randomly Generating Different Sprite Types
      3. Adding Some Variety to Your Sprites
      4. Adding a Background Image
      5. Game Scoring
      6. Game States
      7. Enabling/Disabling GameComponents
      8. Game-Over Logic and the Game-Over Screen
      9. Fine-Tuning Gameplay
      10. Creating Power-Ups
      11. What You Just Did
      12. Summary
      13. Test Your Knowledge: Quiz
      14. Test Your Knowledge: Exercise
    11. 8. Deploying to the Microsoft Zune
      1. Setting Up Your Zune Device Connection
      2. Creating a Zune Project
      3. Input on the Zune
      4. Audio on the Zune
      5. Resolution and Gameplay Issues
      6. Converting the Collision Game from Windows to Zune
      7. Conditional Compilation Symbols
      8. Converting the Collision Game Audio
      9. Converting the Collision Game's Player Input Code
      10. Converting the Collision Game's Screen Size
      11. Zune Performance
      12. What You Just Did
      13. Summary
      14. Test Your Knowledge: Quiz
    12. 9. 3D Game Development
      1. Coordinate Systems
      2. Cameras
      3. Creating a 3D Camera
      4. Drawing Primitives
      5. Matrix Multiplication
      6. Movement and Rotation
      7. Backface Culling
      8. More on Rotations
      9. Even More Rotations
      10. Primitive Types
      11. Applying Textures
      12. What You Just Did
      13. Summary
      14. Test Your Knowledge: Quiz
      15. Test Your Knowledge: Exercise
    13. 10. 3D Models
      1. Using 3D Models
      2. Setting Up the Project
      3. Adding a Model to Your Project
      4. Drawing a Model Using a BasicModel Class
      5. Adding a Model Manager
      6. Rotating Your Model
      7. What You Just Did
      8. Summary
      9. Test Your Knowledge: Quiz
      10. Test Your Knowledge: Exercise
    14. 11. Creating a First-Person Camera
      1. Components of a Moving 3D Camera
      2. Moving in a First-Person Camera
      3. Rotations in a First-Person Camera
        1. Rotating a Camera in a Yaw
        2. Rotating a Camera in a Roll
        3. Rotating a Camera in a Pitch
      4. Coding the Camera for the 3D Game
      5. What You Just Did
      6. Summary
      7. Test Your Knowledge: Quiz
      8. Test Your Knowledge: Exercise
    15. 12. 3D Collision Detection and Shooting
      1. Creating a Moving Enemy
      2. Adding Some Game Logic
      3. Firing Shots
      4. 3D Collision Detection and Bounding Spheres
      5. Adding a Crosshair
      6. Adding Sound
      7. What You Just Did
      8. Summary
      9. Test Your Knowledge: Quiz
      10. Test Your Knowledge: Exercise
    16. 13. HLSL Basics
      1. HLSL Syntax
      2. Dissecting a Sample HLSL Effect File
      3. Applying an HLSL Effect in C#
      4. Applying HLSL Using Textures
      5. HLSL Effects: Creating a Negative
      6. HLSL Effects: Blur
      7. HLSL Effects: Grayscale
      8. What You Just Did
      9. Summary
      10. Test Your Knowledge: Quiz
      11. Test Your Knowledge: Exercise
    17. 14. Particle Systems
      1. Creating a Custom Vertex
      2. Creating a Particle Engine
      3. Adding a Particle Effect File
      4. Adding Your Particle Engine to Your Game
      5. Adding a Starfield
      6. What You Just Did
      7. Summary
      8. Test Your Knowledge: Quiz
    18. 15. Wrapping Up Your 3D Game
      1. Adding a Splash Screen Game Component
      2. Keeping Score
      3. Adding a Power-Up
      4. What You Just Did
      5. Test Your Knowledge: Exercise
    19. 16. Deploying to the Xbox 360
      1. Adding an Xbox 360 Device
      2. Converting a Project to Run on the Xbox 360
      3. Supporting Gamepad Input
      4. Deploying to the Xbox 360
      5. Xbox 360 Display Settings
      6. The Title Safe Region
      7. What You Just Did
      8. Summary
      9. Test Your Knowledge: Quiz
    20. 17. Multiplayer Games
      1. Split-Screen Functionality
      2. Network Game Development
      3. Network Configurations
      4. Writing an XNA Network Game
      5. Modifying the Sprite Class
      6. Modifying the UserControlledSprite Class
      7. Coding Your Game1 Class
      8. Adding Update Code
        1. Updating While in the SignIn Game State
        2. Updating While in the FindSession Game State
        3. Updating While in the CreateSession GameState
        4. Updating While in the Start Game State
          1. When the local player starts the game
          2. When the remote player starts the game
        5. Updating While in the InGame Game State
        6. Updating While in the GameOver Game State
      9. Adding Draw Code
      10. Adding Biohazard Bombs of Insanity!
      11. What You Just Did
      12. Summary
      13. Test Your Knowledge: Quiz
    21. A. Answers to Quizzes and Exercises
      1. Chapter 1: Getting Started
        1. Quiz Answers
      2. Chapter 2: Fun with Sprites
        1. Quiz Answers
        2. Exercise Answer
      3. Chapter 3: User Input and Collision Detection
        1. Quiz Answers
        2. Exercise Answer
      4. Chapter 4: Applying Some Object-Oriented Design
        1. Quiz Answers
        2. Exercise Answer
      5. Chapter 5: Sound Effects and Audio
        1. Quiz Answers
        2. Exercise Answer
      6. Chapter 6: Basic Artificial Intelligence
        1. Quiz Answers
        2. Exercise Answer
      7. Chapter 7: Putting It All Together
        1. Quiz Answers
        2. Exercise Answer
      8. Chapter 8: Deploying to the Microsoft Zune
        1. Quiz Answers
      9. Chapter 9: 3D Game Development
        1. Quiz Answers
        2. Exercise Answer
      10. Chapter 10: 3D Models
        1. Quiz Answers
        2. Exercise Answer
      11. Chapter 11: Creating a First-Person Camera
        1. Quiz Answers
        2. Exercise Answer
      12. Chapter 12: 3D Collision Detection and Shooting
        1. Quiz Answers
        2. Exercise Answer
      13. Chapter 13: HLSL Basics
        1. Quiz Answers
        2. Exercise Answer
      14. Chapter 14: Particle Systems
        1. Quiz Answers
      15. Chapter 15: Wrapping Up Your 3D Game
        1. Exercise Answer
      16. Chapter 16: Deploying to the Xbox 360
        1. Quiz Answers
      17. Chapter 17: Multiplayer Games
        1. Quiz Answers
    22. Index
    23. About the Author
    24. Colophon
    25. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Learning XNA 3.0
  • Author(s): Aaron Reed
  • Release date: November 2008
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596554293