The Battle for XNA Part 2: Why C++/DirectX isn't the Replacement
Yesterday, I posted about how XNA was being retired. The challenge, then, for those of us who use XNA is to find an alternative that isn’t being retired. This analysis is my take on what many people are suggesting is the right path: C++/DirectX. (I even mentioned this alternative in my original post.)
Many are calling for XNA game developers to just move over to C++ and DirectX. The stated reason is that all of the big game studios are using this combination. They’ll often throw in something about XNA basically being the equivalent of a toy for newbies to play with.
But allow me to explain why I don’t think C++ and DirectX is the next step.
C++/DirectX is not Ubiquitous
Sure, a lot of the high end AAA games use it. But part of that is that they’ve invested so much in C++ and DirectX based engines that they’re not willing to give up their advantage and start from scratch. Lots of other game companies, especially indie game developers and smaller studios, do not. There are plenty of other alternatives that they use, including Flash, web (HTML5/JS/CSS3), OpenGL, Objective-C, SharpDX/SlimDX, MonoGame, and yes, even XNA.
C#/XNA Replaced C++/DirectX
By that I don’t mean C# was intended to replace C++ in all cases, and XNA was not intended to replace DirectX in all cases. But Java, and then C# soon after, were invented because programming applications in C++ was tedious and frustrating. So was DirectX. So Microsoft got smart and said, “Hey, we can bring in all of these indie game developers to our side if we make tools that work for them!” They did, and XNA was born.
But here’s the thing: C# and XNA were invented to fix holes in the development process of C++ and DirectX. Those holes, for the most part, are still there. To say we should all just go back to C++ and DirectX is taking a step backward, not forward. C++ and DirectX can’t be the “spiritual successor” to XNA, because they came before XNA.
C++ and DirectX aren’t Fun
Granted, that’s an opinion. But it’s my opinion, and I reserve the right to defend it. And I think if you ask around, you’ll see that many other indie/hobbyist/student/new game developers will tell you the same thing.
I learned C++ in high school and in college. I had all sorts of people tell me that if you don’t know C++, you probably don’t truly know how to program. (I disagree on that point, but it is still said a lot.) I was just fine with using C++ for the rest of my life if I needed to. Until one day, I got a job as a research assistant, programming in Java. It took me a few days to get the hang of it, and a few months to start to become really proficient in it, but at that point, I just knew that I was done writing any C++ code that I didn’t have to. The reason: I could actually get stuff done in a reasonable amount of time. Soon after, I learned C#, and I was sold on the fact that I will never write another line of C++ code, unless I truly need to.
One time, I decided to learn DirectX over spring break one year. (Us nerds know how to party!) I spent the entire week not at a beach in Florida, but instead, trying to draw a ladybug model. It took days to get the right DLLs downloaded and loaded in my project. Days more to get my 3D model loaded. And days more to get my drawing code working. Except even after all of that, I still couldn’t see the freakin’ thing! My code looked right. It seemed like my matrices held the correct data. It seemed like my data buffer contained some 3D points. It seemed like I was drawing the right number of primitives. But all I saw was blackness! I was going insane. Then on my 913th Google search, I came to the realization that there was a lighting system and I needed to turn the lights on. I was drawing my ladybug in the dark. I forgot to turn the lights on! I’m an idiot.
But in XNA, this wouldn’t have been a problem: cornflower blue. They made the default background this odd shade of blue. Had I been drawing a ladybug in the dark in XNA, I’d see a black ladybug, but I would have seen it, because it would have stood out from the blue background.
For most of us, programming in C++ and DirectX is tedious. We spend way too much time doing things besides making our game. Writing deconstructors and reading files and so on. We’ve tried it and don’t like it. That’s why we’re doing C# and XNA in the first place.
To wrap things up, let me say this. There are some people who will love making the jump to C++ and DirectX. That’s fine for them. They were probably going to do it, whether there was more XNA or not. But for most of the rest of us, C++ and DirectX is just not enjoyable, and we think that making games should be as much fun as playing them. Wherever we go next has to have this quality.