« Centripetal = Centrifugal | Main | Trick Shots »

Microsoft's XNA Game Studio Express Beta

I just installed Microsoft’s XNA Game Studio Express (beta). This is a highly anticipated game developer toolkit which allows you to write games for both Windows and XBox 360.

What XNA provides is an application framework so you don’t have to write a bunch of boilerplate code to get stuff done. Your main Game class derives from a framework class called Microsoft.Xna.Framework.Game. This class provides you with a few simple overrides such as:

  • OnStarting() so you can initialize your objects. Their example code seems to suggest this is the best time to subscribe to the DeviceReset event. This is the event called when your graphics device is reset such as when you change color depth or screen size. I test this and yes, it’s true.
  • Update() so you can update your on-screen sprites or game state depending on what’s happening
  • Draw() so you can render all of your graphics

I’m sure the framework does a whole lot more than that, but I’ll write about that at another time.

The first tutorial they show you is a simple bouncing ball (no physics here). They asked me to create my own graphic so I borrowed my easy glass button:

Green

The results are as follows, a simple bouncing ball:

By default, the default render did not honor the transparency in my png file. I had to modify the sample code by adding a SpriteBlendMode.AlphaBlend to the SpriteBatch Begin() method. Also, to make the video smaller than the default window size, I modified the AllowUserResizing property on the Game1 object to true. This was not straightforward to do:

Xna_screen1

I noticed that the game framerate was quite smooth on my 2.7GHz Pentium 4 (w/HT), 2GB of RAM and a ATI Radeon 9800 Pro 128MB graphics card. However, framerate immediately collapsed when I did anything on my machine. Strangely, the game never actually ate cpu. Must be some kind of graphics/bus IO contention going on somewhere.

There is an excellent help system that installs itself. Hitting F1 on a framework class name brings up the framework documentation in a jiffy.

Strangely, the SDK only works with Visual C# Express Edition. That’s kind of strange to me, since I figured it would work with any flavor of Visual Studio 2005.

I hope to experiment more with the XNA SDK in the coming weeks. Sadly, I’m still more excited about posting some of the work I’ve been doing in WPF, Microsoft’s new graphics layer that runs Vista and will be available for XP later this year.

Fun times ahead.

TrackBack

TrackBack URL for this entry:
http://www.primordia.com/blog/mt-tb.cgi/617