References:

What XNA is not

It might sound a bit weird, starting stating what XNA is not. Last year we experienced a bit of confusion because after the first tutorials where everything was easy and nice, it was not really clear how far XNA went. Here we start describing XNA boundary with the hope you can get the big picture quickly. There will be a lot talking about XNA later, here we just introduce to you some of what you are going to do, as well as an overview of what XNA offers as "already there" stuff.

XNA is not a full game "Engine"

So you're going to create a game, right? In here we assume that you have already a fully described game design document, plus an artists team working on the game assets. (That's a joke, actually. You are asked to manage that stuff too, but for the time being let us consider only the programming part). If you want to program a game you will (partially) build a so called game engine.

First, let define roughly what a "game engine" is. Basically it's a piece of software which provides the technologies to run a specific game. Usually, it's much more: it simplifies the development with a set of tools (such as level builder applications, assets import tools, ...), it is composed by reusable technologies, it simplifies the transition to different platforms. Such engines are often called "middleware", in a business sense, because of the cost reduction granted by their flexibility and reusability which makes the manager happy and the game published.

The core functionalities (necessary for one game to run) typically are:
  • Rendering Engine
  • Physical Engine
  • Sound Scripting
  • Handling of Animation
  • Artificial Intelligence
  • Networking
  • Memory Management

So the question is, does XNA provide all of this? The answer is neighter no, nor yes. Maybe "only the basics" might express the concept, someway. In order to understand, imagine you create a new XNA Game project. Besides the libraries and utilities we will discuss in the future, XNA immediately presents to you a base class called "Game" which provides basic graphics device initialization, game logic, and rendering code. And if you follows the basic tutorials of XNA, you will be able to display a model on screen, make it move around with the gamepad, and even play sound, in say 45 minutes. That's gorgeous. Everything is already there! But... as you might expect, this holds as far as you stick to the tutrial stuff.

Let just give an example. A full rendering engine, or more generally speaking, graphical engine, must perform a lot of tasks. Even a simple one must handle things such as: a list of models (with geometry and associated textures, effects), a list of lights (with various properties), some particles emitters (with associated effects), the camera system, some environment such as game level model and eventually a skybox. It must do the rendering: in every step it must set the correct state of the GPU (enabling this rendering option and disabling that one), it has to pass the correct lights information for the model being rendered depending on some design criteria, and the order in which things are drawn must be correct with respect to possible transparencies or other different needs, such post processing effects applied to parts of the scene. Depending on the type of game you are building there will be specific problems to solve, and therefore the shape of your graphical engine might be quite complex, or have specific implementation meant to take care of a particular need (for instance, if your game will have 200 copies of the same model displayed, then it would be a good solution to have the geometry stored only once, and have some "Instance" class which contains the information of the single displayed object).

Again, does XNA provide all of this? The answer is quite short. No, and it's you who have to handle this stuff. XNA will help you, allowing for effects assignment, render states calls and so on, but if your second name is Stakhanov, don't worry, you will have the chance to struggle enough... (and "at the end there will be cake" - Portal). If you are familiar with Direct3D you will notice that in the graphics part, XNA seems just to wrap the DirectX calls setting XNA names. If you are an advanced software engineer, you might get headache because of the Game class constraints. If you are an hardcore guy who remembers his mother name thanks to some C++ convention nursery rhyme, than C# won't be your best friend. But, if you are a normal guy who likes videogames and want to get involved in game creation in order to exercise and acquire skills in many fields, then XNA is the platform for you.

To get back in track, let us give briefly a second example. We have talked about game engine. Let say that we have one. The next step is the game logic. The game logic must entail every single logic piece of the game (I sound smart, don't I?). It goes from the menus to the in game states and, depending of the game rules, the complexity can be quite high. Now, who is going to take care of this? You're right, it's you! Does XNA help? Not directly, but on the XNA official board you can find people who worked on this and many other problems, as well as samples on game logic, so the XNA community might help you (let say they will not for sure, if you don't ask ;).

Now, if you don't have any experience in game programming, or programming, or games (o_O?!), you might feel a bit lost. The rule number one is "Don't Panic". Rule number two is look around. We will provide in this twiki some useful resources (consider to help us, if you find useful resources!), and we will try to make the forum as useful as possible. The second place to look is the official XNA board. There is really a lot of stuff in there, starting from the starter kits down to the forum, passing trough the samples. Finally, come and ask to the assistants. Last year we had the problem that it was the first time the gaming lab was offered, and after a couple of week the students knew much more that the assistant did. This year, the assistants are students of the past year, so hopefully they will last for three or four weeks before you “outknowledge” them...

What is XNA then?

This session will just scratch the surface of XNA, and it's goal is introductory. First, some wikipedia definitions of three main concepts.

XNA Framework

The XNA Framework is based on the .NET Framework 2.0. It includes an extensive set of class libraries, specific to game development, to promote maximum code reuse across target platforms. The framework runs on a version of the Common Language Runtime that is optimized for gaming to provide a managed execution environment. The runtime is available for Windows XP, Windows Vista and Xbox 360.

XNA Framework Content Pipeline

The XNA Framework Content Pipeline is a set of tools focused on reducing the learning curve of 3D game development for small teams. Getting content from DCC* tools into a usable format for runtime consumption is a fundamental problem for 3D game developers. Consuming this content requires that the content be properly conditioned based on a diverse number of factors ranging from the breadth of DCC formats to optimizing content for different platforms (Windows, Xbox 360). The XNA Framework Content Pipeline aims to solve this problem by using Visual Studio as the key design point around organizing and consuming 3D content.

* DCC = Digital Content Creation: Tools that allows you create models, textures, sounds, shader files, i.e. the so called game "assets".

XNA Game Studio Express

XNA Game Studio Express is a new game development solution targeted primarily at students, hobbyists, and independent game developers. XNA Game Studio Express is based on Visual C# Express 2005 and lets developers create games for both Windows and Xbox 360. XNA Game Studio Express also contains a full set of documentation, how-tos, and starter kits that demonstrate how best to use the content pipeline and XNA Framework, and runs side-by-side with other versions of Visual Studio without interference.

Overview

XNA offers basically three things
  • Application model (class Game)
  • Content pipeline
  • Various libraries (math, graphics, sound, input)

As said before XNA models the base game application thanks to a basic class Game which acts as core for new games. In one hand this is a very useful base, in the other hand it also sets a set of constraints you will have to live with. Refer to the corresponding session on the twiki to further details.

The part that makes XNA the platform of choice for this class is the Content Pipeline. To put it simply, the Content Pipeline allows you to import game assets and process them in order to get the stuff inside the code, as well as get things organized as you want, and even create new data processing the existing one. There are default importer and processor which will serve you as far as you don't get fishing out of the valley (for more advanced input data, or data processing, you will need to modify/extend the existing ones, or simply take advanced custom importer/processor from the samples on the official board). This topic is treated in the corresponding session in the twiki and, as a sign for the complexity behind it, the official board forum has an whole session about it. Feel free to go and ask whatever you need. What is important that you understand at the moment is that getting an asset into the game code is quite easy and quick, and this is really a big help, especially for a semester project like this one.

XNA also offers a set of libraries. The input classes are quite simple and handy. You will experience that programming with the gamepad is really amusing. XNA supports gamepad, mouse and keyboard in an easy manageable way. XNA also handles the graphics device providing the functions you need to handle the game window, to handle the rendering, and to manage backbuffers, rendertargets and so on. As said, an expert of DirectX might smile seeing the eye candies of xna wrapping, but for a beginner the integration (and simplification) of Direct3D into XNA is quite a big help. XNA allows you to display things very quickly, concentrating in other interesting aspects rather than basic "how do I instantiate the damn window" stuff.

As a conclusion we can say that during last year we made some experience in terms of what kind of game XNA is appropriate, and what kind of stuff need very careful planning. We will treat this part quite at the beginning of the class, while you should still be in the planning phase, in order to forestall possible problems later on. Hazard can always occur, but being guinea pigs in this context, has some advantages in terms of freedom. This introduction ends here. The next chapter in this twiki will give you more information about the details of XNA. Feel free to ask about whatever you want to know.

Page URL: https://twiki.graphics.ethz.ch/bin/view/GameClass/WhatIsXNA
2025-08-02
© 2025 Eidgenössische Technische Hochschule Zürich