Part One, Building Blocks

This section introduces the basic concepts behind writing cross-platform XNA games. As you work through this section, be sure to experiment with the example code. Don’t just read the chapter text and follow the examples verbatim. You’ll do your best learning when you test your assumptions, and find them to be invalid. Working through issues will ingrain what you’ve learned much better than merely reading some printed text.

As you read each chapter in this section, don’t focus too much on how something was done, try to understand why it was done a certain way. In programming, there are many paths that lead to the same result, each with its own pros and cons. You may think of a better way to accomplish a given task. Use the code from these chapters as a starting point for your own creations.

As you progress in your understanding of XNA and of writing managed code, take this concept a step further and try to understand why the Framework APIs were designed using the interfaces that you see. What do you think those APIs are doing with your data? How do you think they’re processing your requests? How would you have written the API? What interfaces would you have used to expose that functionality to other developers? Why do you think the XNA Framework developers made the design decisions that they made?

Chapter 1, Overview of XNA

Chapter 1 provides a good overview of the technologies upon which XNA Game Studio Express is based. XNA, Visual Studio, Direct X, and the .NET Common Language Runtime are introduced, and each component’s role in the game development process is described.

Chapter 2, Setting Up Your Development PC

Chapter 2 takes you through the steps of configuring your development environment and making sure that everything is working properly. This chapter also discusses several content creation tools that you can install and use to generate audio, graphics, and 3D models for your games.

Chapter 3, Visual Studio

Chapter 3 walks you through the basic features of Visual C# 2005 Express Edition. In this chapter, you will learn how Visual Studio solutions and projects are laid out, how to build your games, and how to identify and troubleshoot problems within your game code.

Chapter 4, Using XNA Graphics for Basic 2D

Chapter 4 introduces you to the basic features of 2D graphics within the XNA Framework. The example code for this chapter demonstrates loading images from the hard disk and using the graphics APIs of the XNA Framework to draw those images to the screen. Along the way, you’ll learn how to manipulate your game images by scaling, rotating, tinting, animating, and tiling them, and how to vary their opacity (transparency).

Click here to: See the video.

Chapter 5, Using XNA Graphics for More Advanced 2D

Chapter 5 expands on the previous chapter by introducing some more advanced 2D graphics concepts. In this chapter, you will learn how to capture the game screen into an off-screen buffer and process it, pixel-by-pixel, to derive new images. The example code for this chapter captures the game screen, converts it to a black-and-white image, and then applies a warp effect, similar to the refraction of water.

Click here to: See the video.

Chapter 6, Using XNA Graphics for Basic 3D

Chapter 6 introduces the topic of 3D graphics programming in XNA. The example code for this chapter captures loads in several 3D meshes, animates them, and renders them using several different HLSL shaders. The player is able to navigate this virtual world using a free-moving camera which they can manipulate using their Xbox 360 controller or keyboard.

Click here to: See the video.

Chapter 7, Using XNA Input for Gamepads

Chapter 7 shows you how to write code that allows the player to interact with your XNA games using the Xbox 360 controller (for Windows or Xbox 360). Within this chapter, you’ll develop an XNA game that allows the player to pilot a ship within an infinite grid. The state of all the controller buttons (except the media button, which is reserved for system use) is displayed on the game screen, and the player can engage the controller’s vibration motors by pressing the A button.

Click here to: See the video.

Chapter 8, Using XNA Input for Keyboards

Chapter 8 shows you how to write code that allows the player to interact with your XNA games using the keyboard. Within this chapter, you’ll develop an XNA game that allows the player to pilot a ship within an infinite grid, shooting photon torpedoes at will. (Tell me again, which one’s Will?)

Click here to: See the video.

Chapter 9, Using XNA Input for Mice

Chapter 9 shows you how to write code that allows the player to interact with your (Windows-only) XNA games using the mouse. Within this chapter, you’ll develop an XNA game that responds to mouse movement and mouse clicks, allowing the user to manipulate a grid of colored cells.

Click here to: See the video.

Chapter 10, Using XNA Audio

Chapter 10 explains how you can use the Cross-Platform Audio Creation Tool (XACT) and the audio APIs of the XNA Framework to add music and sound effects to your XNA games. The example code for this chapter demonstrates basic audio programming concepts by playing, and allowing the player to manipulate, three audio cues. The first is a background music clip that loops indefinitely. The second is an audio clip of my eldest girl telling a story that the listener can play, pause, stop, and restart. The third is a cheesy laser effect that plays whenever the player presses the A button on their controller. The laser effect was designed in XACT so that each time it’s played, the pitch and volume of the effect vary slightly. The player can adjust the volume of the music loop and sound effects independently.

Click here to: See the video.

Chapter 11, Using XNA Storage

Chapter 11 demonstrates the storage APIs of the XNA Framework. The example code for this chapter lets the player design an image by stamping flowers all around the screen, then provides a way for them to save and load their artwork.

Click here to: See the video.

Chapter 12, Xbox 360 Considerations

Chapter 12 describes the issues surrounding writing games for the Xbox 360 game console. The text walks you through the steps of establishing a connection to your console from your development PC for deploying and debugging your XNA games on the Xbox 360.

Source Code

Click one of the buttons below to download the source code for these chapters.


without CH10 – Audio

CH10 – Audio

[Click here to return to the main article.]

Leave a Reply

Your email address will not be published. Required fields are marked *

*