Why You Should Use XNA

XNA has been around for a while and just recently hit version 2.0 (XNA Game Studio 2.0). It’s now ready for proper use and below is a list of reasons why you should give XNA a try, and even start using it as your primary development environment.
Before I begin, I’ll list a few groups of people who XNA isn’t really designed for so they can move on and go back to C++ and DirectX (C++DX). If you’re a hardcore engine developer or you want to become one (eg. the next Carmack) then XNA isn’t for you. The main reasons for this are that low-level, hardcore engines like id tech 5 and the source engine will have to be written in C++DX (or OpenGL) for the time being. The other group are people wanting to make games for anything other than PC and Xbox. Everyone else (students, small studios, hobbyists) will gain something from at least trying out XNA. Read on to find out exactly what XNA can do for you.
It’s all about RAD baby
Rapid Application Development (RAD) is really where it’s at for games at the moment. We need to get prototypes up and running in no time at all so the “fun factor” can be sorted out before the first million is sunk into the project. XNA has this at a number of levels. Firstly it uses C#, a managed language which takes away a lot of the hassles of software development. I’ve been using C# almost exclusively over the past few months (in ASP.NET and playing with XNA) and I love it. If you’ve been through the gruelling hours of fixing access violations and memory leaks (and weren’t the one causing them) then you obviously know your stuff, and you deserve to move onto the next generation of language. It’s easier to use, cleaner, and feels so much like C++ it’s a breeze to step into.
The second RAD feature of XNA is in the XNA library itself. Rendering a 2D sprite of 3D model can be done in a few lines of code. All the hassle and crap of DX is hidden away, and you just load the model and render it. You still have complete control over how it’s rendered using .fx files (HLSL) however that’s all you need to worry about. Basically, XNA moves us a step higher in the level of abstraction. Instead of worrying about how to get the computer to render a 3D model, you worry about how the 3D model should look. It’s taking a more user focussed view on the problem of rendering a 3D model, rather than a software development view of how to actually get the 3D data onto the screen. This is just one example of how much nicer development is using the XNA libraries.
The third RAD feature is the build process. Most indie’s or hobbyists never worry too much about build processes as they just want to get the basics up and running. With XNA, they still don’t need to worry about it because there’s a build process already there for them. Build processes can take up a lot of development time on a medium to large scale project, having the ground work laid out will make life a lot easier for anyone requiring a more complex build process.
Getting in on the ground floor
Now for the hardcore coders out there, this is probably enough reason to at least try out XNA. However, I’d like to look further into XNA and see why this ease of development is not the biggest reason you should be switching over to it. I have one word for you, Microsoft. When Microsoft gets behind something, you really notice it, and Microsoft are placing themselves firmly behind XNA. Managed DX (MDX) disappeared of the radar a while ago and we’ve since learnt that XNA was its replacement. Anyone who spent any time using MDX may be a little pissed that their time was wasted, however they can rest assured that MS isn’t looking like doing the same thing for XNA.
With the release of XGS 2.0, XNA is now at a point where it can be taken seriously and people can start making “real” games with it. With networking support, and a simpler way of sharing games with others on XBL, it’s becoming a reality for anyone to start making games of the same quality as any XBLA game out there (and actually having them run on the Xbox). The fact that this has only just become the case now means that we are all standing on the ground floor and there’s only so much room in the elevator to the top. I can guarantee you from experience that there’s going to be a LOT of people trying to get into the XBL action when it becomes available and being one of the first is going to be the best way to stand out.
So what is the XBL action? Well, Microsoft is pitching XNA as being the “YouTube for games”. This sounds kinda cool, as it means that anyone can release their small game and have millions of people around the world play it, and possibly pay for it. This is great news for Microsoft as it’s going to encourage great games, and be another area that the Xbox stand out amongst the other consoles. As with YouTube, this will become very crowded quickly, so getting in their first will prove a valuable way of getting noticed.
It’s good for your future!
I’m going to have to put on my cynical hat for this section. The games industry, for many people, isn’t forever. Some people reading this may not want to get into the industry, others may only stay for 5 years (the average at the moment), and others still may find themselves unemployed just before Christmas. While this is part of why the game industry is in trouble at the moment, it’s actually advantageous for people thinking of switching to XNA.
The reason for this is that your skills are transferrable. Working solely on C++ will make it quite hard to find a “real job” out in the business world. Looking over business jobs, very few are looking for straight C++ programmers. C# on the other hand (and .NET in general) is in high demand. Having exposure to C# is going to give you a step up in the event that you find yourself not working in the games industry, for whatever reason.
It’s also inevitable that the games industry will one day move on from C++ into a next generation language. There are two main reasons for this. Firstly, as projects grow larger it becomes increasingly difficult to handle such a complex system without having some of the latest features that languages like C# boast. The second reason is that as we move into a world with crazy numbers of cores to work with (16+), we’re going to have free cores just sitting around with not a lot to do. The speed limitations of newer languages than C# can be offset by this extra processing power. Take garbage collection for example. Would you rather have an extra 100 blades of grass rendered on the horizon, or use a core to do your garbage collection so the performance hit isn’t noticeable? I don’t see this happening just yet, but it is inevitable, and C# is looking like a good contender for the next language.
For the naysayers
I’ve heard quite a bit of opposition to XNA, and C# and I’d like to address some of it now. Up until recently I wasn’t sold on XNA either, and I’ve had a lot of discussions with people about the pros and cons of languages like C# in the past. Below is just a quick list of reasons I’ve heard against XNA/C# and some counter arguments:
.NET/C# is just too slow
Version 1.0 of .NET had some performance problems; however a lot of these have been fixed. I can’t find any specifics of performance comparisons, but I’m hearing it is only 10% slower than C++ in some cases. C# is NOT interpreted; it is complied down to IL code and JIT’ed to machine code before being run.
A lot of people are using scripting languages for parts of their gameplay already. C# is MUCH faster than scripting languages such as python, LUA or game monkey script. Games using the Unreal 3 engine are written almost entirely in unreal script.
As with all coding, it’s more about the algorithms used than just the language. No matter how much faster or slower a language is if you don’t write good, optimized code then you’re never going to hit the 60 fps mark.
Learning XNA will put you at a disadvantage
A big question students will want answered is whether they should learn XNA to get a job in the games industry. The short answer is yes, but with a caveat. Every studio I know uses C++DX and so you’ll need to know this if you want a job with them. If you rock up to an interview knowing on XNA then you’re unlikely to get a job. However, if you turn up with a lot of XNA knowledge, and a few C++DX to show you know your stuff then you are a in a great position. Use XNA for rapid development on larger tech demos or an entire game or two. Just use C++DX for small tech demos to show you understand the tech.
The reason for this is that knowing XNA shows that you know 85% of what’s required for game development. You know all the theory behind it, you can write the shaders, and you can write all the gameplay code. The only thing you’re missing is the last 15% which involves some specific C++ stuff, and the basics of DX. Also, if you don’t want anything to do with graphics you can take the DX part out of the equation as well which means you know about 90% of what is required for game development by using XNA alone.
Many studios have C++ programming tests. If you can pass these then you can show that you’re a competent programmer. Personally, I’d look more favourably on a hardcore C# programmer that can also do really well on a C++ test, it shows they are a versatile programmer.
So, in the short term, learning XNA will put you at a slight disadvantage as you’ll need to learn C++DX as well. However, in the mid to long term, you’ll be at a great advantage. You can rapidly create games and tech in XNA to show off your skills, and you’ll generally pick up “game programming” faster as you won’t get bogged down as much. C++DX has a fairly steep learning curve, so using XNA will free you up to just becoming a better game programmer.
Conclusion
I’d highly recommend you download the XGS 2.0, follow the first couple of tutorials and see how easy it is to get a simple 2D sprite and a 3D model working with full Xbox 360 controller support. My next article will be more focussed on where I think Microsoft should be taking XNA in the coming year.
Big thanks to Shauno for doing the comic for this post.











Awesome article! Makes me feel like I should definitely be learning this… some time.
But now I’m gonna buy me some iPod accessories.
While once in strong opposition to .Net, I’m now warming more to the language, especially the C# side. I used to care entirely about performance, creating all my own code and ensuring everything was perfect (at least in my mind).
These days I just can’t find the time to go to that level. I waste time writing the perfect rendering function when instead I could be adding features that users will actually notice.
The only thing holding me back from XNA at the moment is a Scene/World Editor, similar to the one in NeoAxis (http://www.neoaxisgroup.com/). I may be in luck, XNA support is in the Roadmap
I do wonder if we’ll see the next Xbox support C# more natively, it will definitely secure the language a lot stronger for many studios. There are some studios out there who avoid C++ and stick to C. One can only imagine the giant step they will have to take if Microsoft force C# on the next Xbox (which I doubt will happen).
Nice article Alistair, you’re definitely trying your best to convert me, and maybe, just maybe its working
Cliff
Cliff-
I’m glad to hear your coming around, just don’t tell Walter
. Cliff, Walter and I used to have long debates about C# and .NET back when 1.0 (and then again when 2.0) were released. NeoAxis does look fairly cool from what I’ve seen. As I mentioned earlier, I’ll be discussing what I think MS should do with XNA in the coming year, and a world/scene editor is definitely one thing.
“I used to care entirely about performance, creating all my own code and ensuring everything was perfect (at least in my mind).”
It’s interesting you should say this. I’m also working on a blog about writing perfect code. I look forward to hearing your thoughts.
Great synopsis!
Since my current “day job” involves work with ASP.NET and C# in general, I would love to try out an XNA-based project for actual sale. My only “sticky” point which always seems to rear its head whenever I think about actually pursuing this (over a DX/C++ combo) is how easy is it to get an XNA-based game deployed on a customer’s machine.
With C++ you might only have to worry about the Visual C++ dll, but with XNA you’ve not only got the .NET runtime but also the XNA layer to distribute. Though that being said, I haven’t checked out the documentation lately to find out if this all has been fixed to give us an easier way to deploy it as a one-stop-single-install for the customer vs. pointing them to various download links on the Microsoft site…
Wazoo-
I wouldn’t let this stop you developing games. If you make a good game that people want to play, most people won’t mind at all having the have the .NET framework installed (if it’s not already). With game demos now often being measured in the gigabytes, having an extra 30MB or so is hardly going to be noticeable.
Having said that, it’s still an issue of making sure everything is on the customers PC and it’s something I have thought about. My best idea so far is just to roll everything into the installer together by default, and having an advanced option where people can download just the game. My other idea is to write a small app that checks the users PC for the required components and only downloads them as necessary.
I’ll keep you posted on what I find.
Thanks man, much appreciated..
I’ve been closely watching the DirectX Dev newsgroup at Microsoft and there’s a few…”gotchas” with respects to C# / XNA that maybe belong in this discussion as well..(not trying to blogjack you man…bash this comment if it’s interpreted that way).
Since the XBox360 doesn’t support D3D10, there is no planned support for D3D10 in XNA. Looks like you’re almost permanently locked to D3D9. Note that the official Microsoft position on a managed D3D10 solution is to spin up your own COM interop library (like seriously?)
During one of the XNA / D3D10 discussions, the following 2 projects sprung up as alternatives:
1. SlimDX (http://slimdx.mdxinfo.com/)
An impressive open source implementation of managed DirectX, quite similar to MDX (1 and 2). DX9 and DX10, but currently DX9 support is more complete.
2. MD3D10 (http://www.codeplex.com/MD3D10)
Another open source managed DirectX implementation, mostly DX10.
Wazoo-
As far as D3D10 is concerned, I have no problem not supporting it. I’d like to know of any feature that it supports that is really necessary in a small-medium sized game. The main thing here is that your game can run on both PC and Xbox 360, there’s no need for DX10 for either of these.
I’d much rather use XNA than which is now officially supported than anything that wraps the now unsupported Managed DirectX.
Having said all that, you’re right that there are some “gotchas” with XNA that people should be aware of. So long as you are happy with them then I think it’s safe to go all out with XNA.
Doolwind-
I agree with you 100%, I don’t see the benefits of DX10 for smaller games myself either.
Anyways, it sounds exciting and I look forward to reading more about your XNA thoughts / experiences!
I have to disagree on a few points, you say about C#
“It’s easier to use, cleaner, and feels so much like C++ it’s a breeze to step into.” which I agree with – plenty of guys at my work do C# with only a manual to learn from.
But then you say “Working solely on C++ will make it quite hard to find a “real job” out in the business world.” (with managed code) which contradicts your first statement of C# being a breeze to step into.
I also feel you are under emphasizing the importance of REALLY knowing C++ – knowledge that only comes from creating real apps with it. As you said, you can go from C++ -> C# easily, the reverse requires major training. A programmer that only learned enough C++ to pass a programmer test would not last at a games company.
Anyway, I use Managed C++ (C++/CLI) at work a lot and apparently this compiler eats the C# compiler for breakfast. (you also have all sorts of neat things like destructors, consts and scoping rules)
I also think the “youtube” for games will come from browser based flash/shockwave arena – there are already several sites but none that have really reached a critical mass yet.
sqrt[-1] –
“which contradicts your first statement of C# being a breeze to step into.”
Unfortunately, there’s a difference between being able to just walk into C# and having someone hire you. Many bosses/managers will simply not hire a programmer without C# experience. WE (as programmers) know that a C++ programmer moving into C# is probably going to end up being better, but to managers all they think is that you won’t be able to do the work.
“I also feel you are under emphasizing the importance of REALLY knowing C++”
Yes, I agree that I may have under emphasized this a little. If you are going for more than just a junior role then you’ll need a very strong knowledge of C++. I don’t believe though that just doing C++ day in day out is the best way to come up the required level. Making games for a job, or just simply using C++ to make games will often have you performing repetitive tasks reducing the amount you are learning. If you spend your C++ time focussed on learning it I think it can be achieved a lot more quickly. The main point is that I believe disconnecting the learning of “game development” from that of learning “hardcore c++ development” will give you a choice as to what language you learn for the “game development” part.
“I use Managed C++ (C++/CLI) at work a lot and apparently this compiler eats the C# compiler for breakfast.”
I’m also BIG fan of C++/CLI. When I met an XNA guy from Microsoft at Game Connect I asked whether C++/CLI would be supported on the Xbox any time soon. Unfortunately, he couldn’t answer my question. I’ve also heard that the compiler is much better. I’d like to know why both languages can’t be supported.
“I also think the “youtube” for games will come from browser based flash/shockwave arena”
My next article on XNA will be discussing what I think MS should do with it. This includes the fact that the “youtube” analogy isn’t quite right. The main thing here is that content providers don’t make money from youtube. Flash games DO fit the youtube analogy well as they are quick to play and are free. The main draw card for XNA is the fact you may be able to generate income from your games. Allowing you to live the dream of just making games in your garage.
Yeah……, no-one ever made money from those flash games..
http://www.escapistmagazine.com/articles/view/editorials/zeropunctuation/2280-Zero-Punctuation-Peggle
I am a pretty hard core C++ programmer, but I think what Dools says is valid and reasonable. Remember that non-managed DirectX is part of XNA. I currently use C# for tools and applications but I see it as only time before it is used seriosly in games, and if your target platforms are PC and XBox, and you don’t have specific incompatible needs, why not use it now? Native C/C++ can be abused or used well, just as with C#. The biggest issue I see at present is that XNA and C# may lock you in to a Microsoft world. Even hobbyists or Indie developers know that targetting multiple platforms efficiently can greately increase your market potential. As always, no matter what language, APIs and SDKs you use, the more you know about compilers and the underlying hardware, the better high level coder you will be.
As a young developer, I grew up writing mods in C++. I’m now working on software for a network-testing application – specifically in the platform area. I work with COM and DCOM and have worked extensively to provide .NET wrappers for our developers to work with. Somehow, I’ve become an “expert” in COM/RPC/IDL and .NET/C#.
As I’m only 22, the expert label should be taken with a grain of salt, but I feel that the poignancy of a “graduate” being an expert in these specific technologies after 3 years will not be lost on you. For some reason, the previous generation of (business?) software engineers fear “new” or specific technologies irrationally. For my colleagues to avoid learning the intricacies of COM after working on a COM-based product for 5-10 years disgusts me.
So you can imagine the blow-back I received when suggesting that we actively support a migration to the .NET framework (WinForms can replace our monolithic MFC GUI, for example).
So here I am, with 3 years real-world experience (going on 4) and a Software Engineering degree. I’ve not worked on my hobby games for a while (since writing some LUA games for the PSP) and I’m keen to give XNA a go, now that we’re in 2.0. It may not be surprising to hear that I’m considering a change of employment…
What would you suggest I build in XNA as a worthy learning experience & demonstration of my game design (not just coding) skills? I tend to over-engineer my hobby projects, for example:
– I want to make a 2d, side-scrolling platformer
– Ah crap, I need to make a world builder
– Ah crap, I need to make a tool to manage objects in my world
– … etc.
I can whip-up a space invaders clone in a matter of minutes (it’s my “hello world”) but I’d like to attempt something more adventurous. Do you have any suggestions on approaching this from a different angle (say, where I don’t need to reinvent the wheel by creating a fully fledged tool chain for a simple tech demo)?
Josh-
I know your pain of convincing people to change up to newer technologies and I’m glad that now I’m in a position to run my own business I can make the decisions and live out the consequences. I’d encourage you to continue to “push the envelope” with those around you and continue to debate with them the advantages of change. I’d also recommend moving on if you find to much conflict as it’s possible to waste your entire life explaining to bad programmers why they should change.
On to your question…..
I’ll tackle your problem with two solutions to solve the different facets of it. Firstly, the way I get around reinventing the wheel and creating a full tool chain is through procedurally generating everything I need. The best way is to take an example:
I’m playing around with a little archery game in XNA at the moment. I’d like a bunch of levels but don’t want to make a level editor. I’m going to get my artist to make a bunch of “blocks” that represent different types of terrain. I’ll also get some different trees and a few pieces of a castle. I then procedurally put these together using a small set of rules to generate an unlimited number of levels for people to play. I did a similar thing with the levels in my 1 day game recently.
The other way I get around this is making the game itself the editor. Have a key combination that brings you into editor mode that lets you simple place or move objects, even in a rudimentary way. I did a similar thing with my RTS, where you clicked a button and could change the height or terrain or add Tiberium* anywhere you want. You could then save out the level and load it in later. This is slightly more work as you are in effect making part of an editor, but its less time than a fully fledged editor.
The second part of your problem I see is the design part. An easy way to do this is to take a common game style and either mix it in with a new style, or take a completely different approach to it. There are a couple of different levels of game design and you need to decide which you want to explore (or both). The first level is the micro decisions that are made. It doesn’t matter what game you are making (even a 2D side scroller) you’ll always get to make these decisions and they can be unique even with a tried and true genre. For example you may make a 2D side-scroller where you control two characters at once, one on each 360 thumbstick.
The second level of design is the macro decisions you make. This is the actual game itself you want to make. I’d recommend that for a tech demo you don’t worry to much about this. It’s extremely hard to come up with a brand new game or genre of game, and you don’t gain a great deal by doing it. I’d say that designers will look more at your micro decisions when hiring a designer. The main reason for this is that you generally don’t get to make the macro decisions when working for a game company. You get given a game to make, and all you can do is make the micro design decisions to mold that overall game into your dream.
I would say though that XNA is a perfect for your needs. If you are looking for more specifics let me know, or if you want to get in touch with a game designer I can hook you up to get more thoughts.
@Josh – Your scenerio does strike some similarities with mine..the only exception being I’m in an environment where every problem is a nail to be solved by the Java Hammer. *wink*
I’m already well experienced with C++ but just to keep my skillset a little more marketable, I’m attempting to use my project as a way to sit down and finally learn C# for things. I was impressed by the release of Fastcrawl (http://www.pawleyscape.com/fastcrawl/) a 2D RPG which plays just fine for me and the type of game I’m looking at making.
I’m hoping that as Windows Vista slowly permeates itself into the consumer market, it will be less of a problem making sure the necessary .NET components are on your customer’s machine and hopefully things at that point will “just work”. *cross fingers*
Plus “investigative” blogs about .NET packaging in “The Real World” which Doolwind mentions wanting to write about will be very interesting indeed!
[...] chap called Doolwind has written a nice “Why you should use XNA” handy guide for all you folks still trapped in boring old C / C++ land (that’s like, [...]
[...] that I’ve discussed why you should be using XNA, I’d like to look from the other side and talk about what Microsoft should do with XNA to [...]
XNA is fine if you want to write basic XBox games but is very limiting in relation to true windows games.
It only support a subset of the Net framework, and offers LITTLE or NO support for things like low level audio, any non XBox controllers, DirectX 10 etc as well as NOT supporting many Windows APIs and Windows interface. No MP3, or OGG support. etc etc.
It limits the develper to strictly XBox or compatable games.
XNA is okay for the hobbyest and is okay for basic intro to DirectX but serious developers limits them to MS XBox 360 compatable technologies only.
“It limits the develper to strictly XBox or compatable games.”
I disagree Dazza. When you say “or compatible games” that means PC games. Personally I don’t have an issue with most small shops writing games for Xbox and PC only. The fact that you CAN write for a console is just an advantage on top of the fact you can develop PC games using an excellent framework.
With regard to having no low level audio, xbox controllers etc, there’s no reason you can’t add support for this yourself. C# can call through to native DLL’s/code that does this if needed. I don’t realistically see using XNA as being as limiting as you say.
[...] ytterligare konkreta skäl till varför även du bör prova på XNA Game Studio så läs gärna den här artikeln som summerar det [...]
I am a business app dev which I am very familiar with the inner workings and I am huge gaming fan as well and know some of the inner workings but not a great deal.So that here is what I see from my view point.
Business world: Innovators to Early adopters
Gaming Industry: Late Adopters to laggards
It should be the exact opposite!
I feel very confident that .Net will become a gaming platform standard rather soon in fact with the multi-core coding being abstracted in .Net
CORRECTION:
Business: Innovators Adopters to Late Adopters
gaming: industry later Adopters to laggards.
Although its rare we have a client that is planning to use sliverlight for a major internal application which is something I never saw coming, I consider that very innovative for the business world