Jan 9, 2013

Goodbye XNA, Hello SharpDX

I've been using XNA since the beginning. I liked this platform a lot because it allows me to write something that runs both on PC and Xbox 360.  And it is even possible to monetize your games on Xbox 360 Indie Games channel.  However, the importance of XNA games on Xbox Live turned out to be very minimal, and MS changed XNA a lot to support Windows Phone 7.0.  From that moment, (XNA 4.0 I believe), XNA became somewhat awkward.  PC and Xbox 360 became second-class citizens, i think.

Still I used XNA quite often.  It was a great tool to prototype anything. Its contents pipeline and ability to use DirectX in C# really gave me a huge advantage to make any demo in it.  For example, I even made the demo for my SIGGRAPH presentation in XNA.

Now XNA is dead because Windows Phone 8's not gonna support it. WinRT is apparently the new winner....Also Visual Studio 2012 doesn't support XNA officially. (an unofficial way exists, but whatever?) Sure, one can still stay behind with Visual Studio 2010 and XNA 4.0, but now XNA, aftert being neglected for a while, has some limits.
  • no 64-bit support
  • only supports DirectX 9 (no DX11 support)
So now time to find an alternative.... The reasons why I liked XNA were:
  • C# support
  • contents pipeline

So I just need to find an alternative which covers these two... right?

C# Support

There are two major libraries that supports DirectX in C#, or any .NET language:  SharpDX and SlimDX. Both libraries have almost identical API, thus the usage is very similar. Furthermore, both supports 64 bit. I needed 64-bit support for my recent work, so I tried both libraries, and decided to go with SharDX for following reasons:

  • SharpDX is faster (less overhead on API calls)
  • it's easier to install SharpDX(simple DLL file copies)
So with SharpDX, C# support issue is covered

Contents Pipeline
Honestly, I still don't see anything that's comparable to XNA's contents pipeline yet.  Texture is not a big issue since both C# and SharpDX's DX calls support textures pretty well. When it comes to other asset types, such as audio and mesh, it's still not that easy.

One good news is that Visual Studio 2012 contains an example which loads FBX files, I heard, and I believe Microsoft will enhance this side for WinRT, if they are really betting on Windows Phone 8. So maybe it's just matter of time?

I wish I had some time to make pretty solid contents pipeline for SharpDX or something.... But by looking at my schedule for this year, I don't think I'll ever get to do it.

My Conclusion - SharpDX
So I decided to live with SharpDX for now. My main reason was the 64-bit support.  My prototype's already using more memory than what 32-bit application can handle. I'm not worried too much about textures and mesh support... For other contents types, I'll solve the problems when I need them.

Update - Jan 12, 2013
Nicolas just told me his Assimp.NET can handle some asset import/export and it's actually used by SharpDX too. So if you need an asset pipeline check it out at http://code.google.com/p/assimp-net/ Apparently FBX files are not supported yet, but since there's already FBX SDK from autodesk for free, I would think it's just a matter of time.


  1. SharpDX is fantastic!

    Without it MonoGame wouldn't be running on Windows 8 and Windows Phone 8.

    1. didn't know monogame was using sharpdx.. good to know!

  2. You could also try Unity 4, with DX9 & DX11 (and more!) support, C# etc. etc. But I'm biased ;)

    1. I love unity 4 actually. If it was to make a game, I'd use Unity for sure. For my own prototypes and quick proof of concept.. sharpdx cuz I prefer HLSL more than Unity shader langauge :)

  3. C# is great for iteration, I can see why you'd want to stay with it.

  4. I know that the author of SharpDX has been working on a XNA-like toolkit, including something of a content pipeline. For assets like models, he's using my wrapper "AssimpNet" for the C/C++ Assimp model import/export library (http://code.google.com/p/assimp-net/).

    Unfortunately the FBX file format isn't supported by Assimp

    1. Nice.. I'll try that when I need asset pipeline. Also updating my main article with this info too.

    2. Actually, the guys at Assimp have been working last year during GSCO 2012 on bringing a FBX text/binary loader (I guess that they can't really use FBX SDK for license reasons). The main developer did merge/rebase recently his work on his branch (https://github.com/acgessler/assimp-gsoc2012-fbx). Not tested yet, it is not fully supporting all FBX features but It is great to see it part of assimp. This will simplify a lot asset conversion for casual projects.

      Concerning SharpDX.Toolkit and model loading supports, It has been started, hopefully released later this year.

    3. That's great news, I was afraid the FBX initiative for Assimp was abandoned long ago per to what I've seen on their forums.

  5. Love the article and moving in this direction. But Windows Phone 8 does support it. it's the only way to do XNA in VS 2012. Download the Windows Phone 8 sdk.