Friday, March 2, 2007

XNA Framework

I started using the XNA Framework about a month ago, and thought I would share some of my opinions with you.

The first game I wrote was a version of Pong in Pascal at college, just as I was learning to program. I thought that if I really wanted to program games, I should start near the beginning. Shortly after I got a working version of Tetris up and running, which felt incredible at the time. In the second year we moved onto C++, and my one true love, object oriented programming! I spent that final year learning as much as possible, finally handing in a tile map demo as my final project. At university I was using DirectX to write 2D and 3D games, as well as simple online games in Java.

Now back to the XNA Framework. Considering my background in C++ and DirectX, I was reluctant to even give it a try. I'm sure lots of people feel the same, that they would lose control over their high performance game engine, and that C# could never compare to the speed offered by C++. I have to admit, I was very wrong.

The average hobbyist isn't going to be creating incredibly complex games, that would make the speed difference a serious issue. It's even been speculated that XNA games can be comparable in performance to a C++/DirectX equivalent. Regardless of whether that's true or not, the fact remains that this is a great platform for people who want to learn to make games, without having to handle all the technical details from day one.

From my perspective, I was sick of having to deal with every low-level technical detail required by game engines. Game studios have large teams working to achieve similar things. Can one person working part-time on a project reproduce that much work? Sometimes, but not often.

XNA allows programmers to concentrate more on the actual game, rather than developing the complex libraries used to traditionally program games. The integrated content pipeline is sheer genius, making game assets just as much a part of the project as the source files. I haven't dealt much with this side of the framework yet, but loading textures is a breeze!

I would recommend anybody thinking of learning game programming to give C# and the XNA Framework a try. It can take a lot of the complicated stuff out of the picture, but provide more advanced features if they are required, mainly though shaders.

I have a warning for people who might think that XNA makes programming games easy, like a click and play game creator. It doesn't. You still have to learn most of the same theory, and have a fair amount of experience with object oriented programming. Having said that, C# is a good place to start learning good object oriented design. For some reason C++ lures people into writing bad C-style code.

I think I'm rambling now, but I'd just like to say that people with games programming experience should also give it a try. If it can make you more productive by removing unnecessary details, think of what you could produce in the amount of time a C++ project might take. As a learning project I've been working on an XNA GUI for several weeks. I'm really pleased with the results, but can't wait to start making some games!