Developing with C#/XNA

When you’re going to begin development on a game, the very first questions that appear are “For what platforms?” and “What tools will we use?”

If you decide that Windows-based PCs are the best target, the options at your disposal are staggering. When we were trying to pick a development environment for “Dwarfs”, for each language, engine and wrapper, we asked ourselves:

  • How fast is development?
  • How much control does it take away?
  • How powerful is the tool?
  • How big is the user base and community?

Getting answers to these questions wasn’t exactly a walk in the park. After some pondering, we decided to use Microsoft XNA (http://en NULL.wikipedia to do some prototyping, since I had previous experience with C# and knew that at least the programming language was extremely optimized for fast development. After using XNA to develop Dwarfs for four months as a school side-project, I can attempt answering some of them.

How fast is development?

Extremely fast. It’s so fast that developing in C#/XNA almost feels rude towards other students, who are struggling with shoddy software such as Torque, or daunting tasks like writing their own engines from scratch. You can be up and running with XNA in literally minutes, if you know what you’re doing.

And yet…

How much control does it take away?

Surprisingly little. I would say XNA hits the balance perfectly between handing you the tools to build your game, and then backing away so that you may build it as you wish. How bold you’ll be when developing is entirely up to you, and XNA accomodates most scenarios. You don’t need to know what a shader is, for example, to efficiently render something to the screen using the GPU. If you want extra control (which you likely will), you can just replace the default shader with your own. Most parts of the engine (if you could call it that) is like this. If you don’t like a module, you can usually just rewrite it yourself, if you have the skill. I feel the most prominent loss of control is instead due to the C#-language. The Big Brother memory management is frustrating at times, but the ease of use more than makes up for this to me.

How powerful is the tool?

This is one of the questions that are difficult to answer. It’s certainly very efficient at what it does, with pretty optimized rendering and so on. You can’t access DX10 or above, though, and I imagine that many advanced programmers consider C# less powerful than C++. For development of the sort I’m doing (small scale indie), it’s perfectly suited.

How big is the user base and community?

Very big. This question might seem odd to some. The user base shouldn’t matter that much as long as the tools are good, right? Wrong. The process of developing a game is very complex, not only from a technical viewpoint, but also from a spiritual perspective. What I mean is that morale plays a huge part in how efficient and ultimately successful a team is. Results are the best source of morale. If you spend one day making something great, you’ll spend the next day making another great thing, because seeing your efforts bear fruit gives a great high.

While tangiable results are an awesome source of morale, one of the WORST drains are things not working. When you sit there wondering why in the nine hells your perfectly skinned model fails at compile time with some arbitrary error message, the sun isn’t shining quite as brightly as it did a few minutes ago. Having a significant community is key here, for several reasons. For one, a quick search on Google or the XNA Forums is likely to yield great results, and if you can’t find an answer that way, you can always post yourself. In the case of XNA, not only is there a strong community (http://creators NULL.xna ready to help, but the actual XNA Team is paid by Microsoft to hang around the official forums. Perhaps most notable is Shawn Hargreaves, whose blog (http://blogs NULL.msdn is an excellent source of good information.

But certainly there must be some drawbacks?

Up until this point, it must sound as if I’m being paid by Microsoft. I’m mainly positive to C#/XNA, because there is so much to be positive about. Among some minor issues, there is one big downside: compatibility. XNA is based on DirectX, and C# is developed by Microsoft. As such, games made in XNA will be played by no apple or penguin. Another slightly annoying thing is that any PC-user will need to download and install the redistributable. I’m fairly sure you can wrap it into your game installer pretty neatly, but still, I think those measly 8MB could be included in the DirectX-installation.

Well, that’s my first TL;DR-post, and I’m sure there’ll be more of them coming on relevant subjects! To anyone who stumbled in here wondering what language to learn if you’re new at programming and want to make games: I think C# / XNA would be perfect for you.

Leave a Reply