Freitag, November 10, 2006

DEV302 Microsoft XNA and the Future of Game Development

Rob Miles
XNA represents a major milestone in the field of game development, bringing game creators a unified platform and the safety of managed code. It also greatly reduces the difficulties faced when starting out in game development, closing the gap between idea and working implementation. The recent release of XNA Express gives programmers a chance to get to grips with the XNA framework and use it to create content for both the PC and the XBOX 360.Beginning with an overview of the XNA platform and the XNA Express development tools, this demo packed presentation then moves into the ‘nitty gritty’ of game development using XNA, leading to a fully realised casual game running on an XBOX 360. Whether you are a seasoned games coder, or a programmer thinking of moving into game development this session will give you plenty of food for thought and information to get you started.

Freitag morgen, ich hab nicht wirklich eine Session gefunden heute, aus der ich einen Business Value ziehen kann. Deshalb schaue ich auch ein wenig für mich…und zuviel wissen kann man ja nie ;-)

The Video Game Business
The scale of the enterprise

• Bigger than the movies?
• Some people say that video games are now bigger money spinners than the movies:
• The game “GoldenEye” made more money than the film. And cost a lot less to produce.
• Set to grow even more?
• The potential of a connected, high performance, easy to program gaming appliance in millions of homes is bound to lead to new opportunities.
• Just about anything is amenable to some form of gaming tie-in
○ "Casual" games are a huge growth area

Game Developer Challenges
Big Games are hard to make

• A modern, full price game is extremely complex to create
• It contains not just code, but a huge number of additional resources produced by a range of specialists
• Managing these is very difficult
• You need to ensure that all elements are up to date
• You need to track dependencies
• You need to determine which elements are part of the game
• Game developers do not have the time to develop appropriate management tools
• Software development tools are inappropriate

Small teams can’t cut it any more

• Writing games for sale to the mass market has become the province of specialist games houses
• There are niche markets for things like the mobile platform, but the cost of developing, marketing and delivering a modern game is prohibitive for the small developer
• With the huge cost of game production, the publishers are much less likely to pursue novel gaming ideas
• New games are often tied to movies or TV
• Games are often sequels of older ones

XNA for the Game Studio
Managing the content with a pipeline

• The XNA content “pipeline” provides a unified mechanism for the storage, processing and retrieval of resource items
• A set of “importers” are provided for standard resource types
• Developers can make their own importers if they want to expand the range of these
• Content items are held in a typesafe manner within the repository and can be extracted and processed appropriately as part of the build process

XNA for the Games Studio
Making a nice place to work

• One of my rules when starting a new project is:
Make yourself a nice place to work
• By this I mean that it should be easy to deploy, test and debug code as I write it
• No manual intervention to build the system
• Fully automated and instrumented tests
• Good code management and re-factoring support
• XNA is based on Visual Studio 2005 Team Foundation Server
• Good for "Agile Development"

XNA and Agile Development

• The rich, integrated toolset that you get with XNA is very amenable to Agile Development
• Pair programming
• Rapid iteration (test – code – re-factor)
• Test driven development
• Has been shown to improve programmer productivity and reduce burnout
• Has great potential in the games industry

XNA ist based on .net und die games werden in C#2.0 geschrieben, Alles ist managed Code. Ich entwickle und teste im Visual Studio 2005 und kann direkt zur Xbox360 Deployen !

Es kommt jetzt eine Demo, einfaches Spiel (“Hot Salad Death with Cheese”), aber anschaulich wie der Weg is und wie das geht
Folgende vorgehensweise ist grundlegend:

1. Initialise all the resources at the start
2. fetch all textures, models, scripts etc
3. Repeatedly run the game loop:
4. Update the game engine
○ read the controllers, update the state and position of game elements
5. Draw the game environment
○ render the game elements on the viewing device


partial class Game1 : Microsoft.Xna.Framework.Game
public Game1() {
graphics = new GraphicsDeviceManager(this);
content = new ContentManager(Services);
protected override void LoadGraphicsContent(bool loadAllContent) {
protected override void Update(GameTime gameTime) {
protected override void Draw(GameTime gameTime) {


Texture2D cheeseTexture;
SpriteBatch spriteBatch;
protected override void LoadGraphicsContent(bool loadAllContent) {
if (loadAllContent)
cheeseTexture = content.Load("cheese");
spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

• LoadGraphicsContent is called when our game starts
• It creates our cheese texture and loads an image into it
• It also creates a SpriteBatch instance to manage the drawing process

Die Content Pipeline managed den Content als Resources. Jede Ressource bekommt einen Asset Name. Die Load Methode der ContentManager gibt uns den Zugang zu den Ressourcen.

Jetzt kommt das Drawing:

protected override void Draw(GameTime gameTime)
new Rectangle(
cheeseX, cheeseY,
cheeseTexture.Width, cheeseTexture.Height),
Color.White );

Und jetzt noch das Game Update:

protected override void Update()
cheeseX = cheeseX + cheeseXSpeed;
if ((cheeseX <= 0) ||
(cheeseX + cheeseTexture.Width > Window.ClientBounds.Width))
cheeseXSpeed *= -1;
// repeat for Y
// Let the GameComponents update

Nun haben wir einen Käse, der auf dem Bildschirm herum bounced. ;-)

• XNA provides support for keyboard, mouse and XBOX 360 controller
• You can plug a controller into an PC and it will just work
• A wireless PC controller interface will be available later
• The game controller buttons are polled during the update method

Ich vezichte auf den Code, der für den Xbox Kontroller eingefügt wurde. Sieht sehr einfach aus, im Stil von, wenn links gedrückt wurde, fahre nach Links ;-)

Ich kann alle Blöcke als Komponents "rausnehmen" ähnlich wie Components bei WinForms. So kann ich die immer wieder verwenden, kann sie auch unabhängig behandeln. Z.B. den Hintergrund ändern als Component, ohne dass ich alles anpassen muss.

Nun fügen wir dem ganzen einen Background hinzu. Geht auch sehr einfach.
We just have to extend the DrawableGameComponent class and implement LoadContent, Update and Draw methods. This is directly analogous to components in Windows Forms

Display Text:

• The XNA framework does not support text rendering directly
• I render a set of characters to a bitmap and then copy the characters from the bitmap into the display area
• I have implemented this as another component
• This gets the text to be displayed from the game instance and then draws it on the screen
• I can get different font sizes by scaling the text as I render it

Adding Sound:

• Sound makes a huge difference to a game
• XNA has very powerful sound creation facilities
• The Microsoft Cross Platform Audio Creation Tool (XACT) is used to create soundbanks which are loaded by the game
• This tool is provided as part of the XNA Express distribution
• The sound banks are managed by the content manager

Nun ist das Game fertig. Scheint wirklich alles sehr einfach zu gehen.

Es folgt die Empfehlung, dass wenn man neu ist im Game Programming, soll man mit 2D Games anfangen. Es ist einfacher, später auf 3D zu switchen.

Xna in the Future:

• The current XNA Express Beta 2 lets you use Visual Studio Express to write XNA games for the PC
• In December it will be possible to create them for the XBOX itself
• To write games for the XBOX 360 you will have to pay an annual fee
• Then the content manager and build tools will be made available

Three reasons why we should all be writing games

• It is easy
• XNA and .NET lower the difficulty bar and make it possible to target a range of platforms in one shot
• Using .NET as the underlying platform gives games integrity and reliability right out of the box
• You can make money
• There is a market for “casual” games which are quick to play
• XBOX Live will provide a means by which such games can be sold
• It is fun!
• Any developer can write viable games and enjoy doing it

Gute Session, erstaunlich auch, dass ich natürlich das gesamte .net nutzen kann. Ich kann Games entwickeln, die auf eine Xbox360 und auf einem Pocket PC laufen.

Wieder etwas, wo ich sagen muss, hät ich nur mehr Zeit…

XNA Blog

Keine Kommentare: