Sign in to follow this  
paste42

DirectX vs XNA

Recommended Posts

So, I'm a game developer, and I've been using XNA for about 8 months now for programming games. When I started, I also heard a lot of about DirectX, and was considering going with that, and might've if it weren't for the advice of a friend. I also have a decent amount of skill with C++, which is why I was leaning toward DirectX. My questions are: at this point, is there any point in learning DirectX? What are the benefits of learning DirectX over XNA and vice versa? Thanks Paste

Share this post


Link to post
Share on other sites
XNA for Windows is built on top of DirectX 9. Basically it is a managed wrapper on top of the native DirectX libraries. In a sense, you are already working with DirectX and learning the basic concepts of how it works.

XNA takes care of alot of the tedious grunt work you generally need to manage yourself when creating a DirectX application from scratch (Such as window creation, loosing the device context, etc). If your confortable with XNA already, you will probably be able to pump out a game much more quickly.

It really comes down to what you want to learn about. XNA is currently based on DirectX 9. Therefore, you will not be able to take advantage of the new features that have been included with DirectX 10 & 11. So if you want to learn about geometry shaders, or some of the other new features, it may be worth diving into DirectX or OpenGL. Personally, I'd recommend sticking to the manage route and check out the SlimDX library if you interested in next gen API's.

So here's a question for you. What do you intend to do with XNA, DirectX, etc? What kind of games are you interested in creating?

There honestly is no right answer to your question. If your comfortable with XNA, I'd suggest sticking with it and at least finish the development of a game before moving onto something else. Finished projects look better then unfinished projects :)

Share this post


Link to post
Share on other sites
Quote:
Original post by paste42
My questions are: at this point, is there any point in learning DirectX? What are the benefits of learning DirectX over XNA and vice versa?
If your just programming as a hobby, or making small games, there is no point in learning it, unless you just want to learn it for the hell of it.

Content makes a game. Not APIs or shader models.

You already know how to use the API you chose. Now make a game. The amount of APIs you learn means nothing. Put out a game. ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by Billr17
So here's a question for you. What do you intend to do with XNA, DirectX, etc? What kind of games are you interested in creating?


Well I've been using XNA in the fellowship I'm in because it's sponsored by Microsoft and that's what they want us to use. I want to learn the intricacies of graphics programming, but I'm going to be taking a graphics class next semester that teaches and makes use of OpenGL. Outside of school, though, I want to make some games independently, primarily 2D, some small-scale, some larger.

I think part of the reason I wanted to explore other avenues (e.g. DirectX) was because XNA seems somewhat inflexible in some things. For example, DirectX run-times come packaged with Windows, right? I don't like making people have to install the XNA framework redistributable for some reason. It makes the game seem unprofessional maybe. It also makes it a little harder to install than just download-and-click.

Share this post


Link to post
Share on other sites
Quote:
Original post by paste42
I don't like making people have to install the XNA framework redistributable for some reason. It makes the game seem unprofessional maybe. It also makes it a little harder to install than just download-and-click.

Installing the XNA Framework redist in no different than installing any other piece of a game. This argument is silly. It's 7MB, so it's not really a burden to add to the game's install and it's a one time thing, just like the DX redist.

Oh, and just for the record, XNA is not a product. [wink] There's the XNA Framework and XNA Game Studio. If you're using DirectX you're using part of XNA.

Share this post


Link to post
Share on other sites
Quote:
Original post by paste42
It makes the game seem unprofessional maybe. It also makes it a little harder to install than just download-and-click.


Every program is built on top of something that has to be installed.

Anything written in VSC++ is linked against whatever version of the C++ runtime, and might require a download of an updated runtime dll.

DirectX 9.0+ comes installed on all recent copies of windows. But there have been numerous updates, requiring the user to download.

The .NET framework is installed on recent versions of windows. Any .NET program may require an update to a later version.

The XNA runtime is not installed by default.

None of this makes much of a difference. The installer will take care of it if need be. The user only needs a small XNA runtime dll, and not the whole framework/gamestudio package.

Any game installer will need to make sure that the correct C#/C++ runtime version, DX version, etc... is all there, and handle them in case they are not. It's all the same, and the ClickOnce installer set up in the IDE is set up to handle this for you.

As for the intricacies of graphics programming. It's done with Shaders. XNA/D3D/OpenGL just bind shaders, and set up arrays of vertices to be drawn. You'll either write them in HLSL or GLSL.

So API doesn't matter much. XNA isn't unprofessional, it's just bindings to use D3D9 in C#, with a few helpful extras.

Share this post


Link to post
Share on other sites
Quote:
Original post by Daaark
Every program is built on top of something that has to be installed.

...

Any game installer will need to make sure that the correct C#/C++ runtime version, DX version, etc... is all there, and handle them in case they are not. It's all the same, and the ClickOnce installer set up in the IDE is set up to handle this for you.

...

So API doesn't matter much. XNA isn't unprofessional, it's just bindings to use D3D9 in C#, with a few helpful extras.


Yeah, I realized later that I don't find the necessary installation unprofessional; it's more that I just get slightly annoyed whenever I run a game I made in XNAGS and it displays that little window that says "Verifying application req's..." when I'd really rather prefer that if there was a load screen, it was one that I made. Any ideas on that one, or is a topic for a different thread?

Also, thanks to everyone for their input.

Share this post


Link to post
Share on other sites
Quote:
Original post by paste42
Yeah, I realized later that I don't find the necessary installation unprofessional; it's more that I just get slightly annoyed whenever I run a game I made in XNAGS and it displays that little window that says "Verifying application req's..." when I'd really rather prefer that if there was a load screen, it was one that I made. Any ideas on that one, or is a topic for a different thread?

Also, thanks to everyone for their input.
I don't think I've ever encountered that. It may be just for the first run of the program, since the installable C# apps are compiled on first execution on the user's machine. But think of the C++ alternative, where the app simply crashes back to desktop with a page fault or a missing dll error.

With the C++ runtime, you often get a mysterious, unhelpful error if it's missing. With C# you get a nice "You are missing something, this installer will download the required update, then compile the app for you optimized for your machine."

And then it's gone and forgotten about.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this