XNA Games Programming

XNA is a Microsoft framework of libraries and code to support the creation of games running on the PC, the Xbox 360 and the Zune. You program for it using Visual Studio and C#.

Note: these notes are current;y being updated to XNA 4.0, those that have been are indicated below otherwise they refer to XNA 3.0

XNA Notes Index

  • Introduction to XNA
  • XNA Getting Started
    • First XNA Application
    • XNA Simple Triangle
    • XNA Displaying Text
  • XNA Debugging
  • XNA Graphics
    • XNA Matrix
    • XNA Camera
    • XNA Models
      • XNA Skybox XNA 4.0
      • XNA Bounding Box XNA 4.0
      • XNA Model Collisions
    • XNA Terrain
  • XNA Brief Answers

Introduction to XNA

XNA is a very cool initiative from Microsoft that takes away the need for a lot of the low level coding normally required in the creation of a computer game. This is achieved by a set of libraries, tools and use of the C# programming language.

Are games really written using XNA?

The main target for XNA is hobbyists and for people learning to write games. Since it uses C# (a managed language that requires a runtime environment)  it runs a lot slower than equivalent C++ code (that compiles down to machine level code) so commercial PC and Xbox 360 games are typically written in C++. Having said this with the release of XNA 3.0 Microsoft have created a means of releasing your own game written using XNA online (via Xbox Live) and obtaining royalties for it (set at 70%). How profitable this is remains to be seen.

How do I get started with XNA?

To create XNA games for the PC is completely free. You just need to download the XNA Game Studio from Microsoft and you can use it with the free version of Visual Studio C# Express. If you already own the commercial Visual Studio 2008 that can (and should) be used instead as it adds more features.

To program for the Xbox 360 using XNA you need to get an XNA creators club premium membership (free to all students via the MSAA or DreamSpark programmes) that costs $99 per year. Once you get this membership you get a code that allows you to deploy your game to an attached and Internet linked Xbox 360.

XNA Creators Club – the main site for XNA where you can download XNA Game Studio and get support, samples etc.

Once started you should read my notes to create an initial application: First XNA Application before moving on to Drawing a Triangle

Why is it cool?

XNA takes away a lot of the pain of working with the graphics, input etc. on a PC, Xbox or Zune. It implements the .NET framework and comes with a number of tools for game creation. It supports graphics via managed Direct3D and the Xbox 360 controller (for Xbox or PC). It supports sound and includes a content creation tool for sound developers. From version 3.0 it includes multi player support. C# itself is a very nice language to program for.

What is really cool about it is that it takes very little time to get a game demo up and running on the PC or Xbox 360. Even if it were not to be used for a final game implementation it is a great way of quickly testing out game ideas.

Further Reading

  • C# notes
  • XNA Creators Club
  • XNA Start – First XNA Application