Why Beginners Should Start with XNA
Today, I watched an interesting discussion on gamedev.net where someone asked why everyone is recommending beginners to start off with XNA and C# whereas the entire gaming industry is based on C/C++.
I would have expected to read something along the lines of
“We recommend XNA because it’s very easy to learn and you will hit the ground running fast. It teaches beginners the kind of thinking required to lay out the logic of a program and doesn’t discourage them by forcing them to write boring console applications for months until they know the semantics of the language well enough to use a graphics library such as SDL, DirectX or OpenGL. Some people may not even want to enter the industry, so C# and XNA is a fine choice for them. Those that do can switch over to C/C++ after they’re fluent in C# and it will be a mostly easy going, incremental learning process.”
Instead, an ugly mess resulted with people firmly stating that .NET/Mono is the way to go for games, that the gaming industry is using it for prototyping, scripting and development tools and that the only reasons for not adopting C# yet are legacy code bases and unwillingness by developers to learn new stuff or to change proven ways. People began dissecting each other’s posts one by one and, well, if you’ve been on the internet some time, you can probably imagine how it turns out.
So, why do I think beginners should start with C#/XNA?
Mainly for the reasons I already wrote in the wished-for response at the beginning of this article. C# allows beginners to concentrate on learning programming itself whereas C++ requires a good understanding of the toolchain first. You can misplace include files, link to the wrong libraries, then get error messages that don’t indicate either of them (if you are a beginner) and run into the countless traps just waiting in the language for beginners.
Will the gaming industry adopt anytime soon?
Knowing C# is still a good idea. It’s booming in the desktop application and server markets and I’ve heard quite often that tools such as level editors, game scripting, model converters and code generators are being written in .NET. It wouldn’t surprise me if games written in .NET would slowly begin to pop up every now and then. But .NET isn’t mainstream in the gaming industry and probably won’t be for a long time to come.
What about open source and hobbyist projects?
Open Source people still seem to be wary of using Mono – mostly out of fear that Microsoft might have other intentions behind the C#/.NET ECMA standardization and that they may well be in a position to sue anyone using Mono to hell and back, which would cause major damage once the adoption of Mono for linux apps increased. That, and the fact that linux is an overwhelmingly huge collection of libraries whose only common ground is that their APIs talk C. You won’t hear the developers of libpng saying “aw, let’s do the next version of the library in .NET, guys.” So the current state that most important software libraries being written in C/C++ for C/C++ won’t change soon.
Assuming Microsoft indeed has honorable intentions (which I do), adoption will likely increase over time, but the change will be a slow process. Much slower than we might expect from the IT business.
That’s my take on the situation. I’m doing C#/.NET/XNA because I like it better than C++, because the Agile/TDD methodology has taken hold much more firmly on this platform and because as an independent developer, I’m not going to develop for the PS2, the only major platform I can’t reach with .NET.