views:

1256

answers:

6

Hi, I have been wanting to give game programming ago for a long while and never got round to it, and i have finally decided to give it ago. I have decided to try and create a simple to 2D platform game. I have had a quick play with XNA and I do like it. What i am looking for tho is a comparison between XNA,directx,OpenGL. mainly the strengths and weakness between them. I have been a .net developer for the last 4 years and that's were my knowledge mainly is.

Any help to help me choose would be grateful.

+9  A: 

If you want to do Direct X, say hello to Win32 and COM as your new best buddies. You'll be spending lots of time early on learning ins and outs of the win32 API. DirectX with Win32 provides you all the features needed for sound, game input, and graphics display. You'll also be writing in C or C++, and you'll get to learn all about memory management and the C mindset - not something you should consider giving up lightly. Learning and using C as a language for a major project can be very illuminating, and make you thankful for modern programming language features and design elements. You aren't actually forced to use C or C++ for development here; there are various .NET wrappers and other language wrappers for Direct X, but if you've got .NET experience, you might as well use the framework made for .NET: XNA.

XNA is a much newer, .NET based set of tools. It provides many of the same features that straight use of Win32 and DirectX does (sound, input, etc) but natively on a managed platform. For most games (especially one when just starting out) you can get great framerates with an XNA game (even though a native app can give you more), and is very good for learning the ins and outs of game development -- you can't really go wrong. Most of the fundamental data structures you'll need (quad/oct trees, Model-view-controller architecture, handling of events, structure of your program) you will still need to learn and implement yourself, and doing it in .NET will most certainly be easier than in C and C++. As a nice side bonus, if you have an Xbox 360, XNA community games can, with some work, be released through Xbox Live marketplace. Basically, as a .NET developer, you would probably feel most comfortable here.

OpenGL is a cross-platoform library for drawing polygons. It has a different framework and API from Direct X, and does not provide any any OS interaction tools. There's packages that let you program in OGL in many different languages. However, as others have said, this will probably be just as much work as writing with Win32 and DirectX. For other features besides graphics (keyboard, mouse, joystick, audio) you could consider using a framework like SDL some of the missing DirectX features. There's a pretty decent community surrounding the library that can give you pointers and tips if you go this route.

More thoughts on this can be found in an almost identical article, here: Suggested Gaming Platform to Learn direct-x, C Open GL, or XNA.

Robert P
-1, The framerates are a non issue, until you make a AAA game that has the muscles to stress the hell out of the CPU and Video card. I've seen XNA demos running at 1000+ frames per second with great graphics (mainly because they used heavy shader programming, native code won't speed up your shaders)
Pop Catalin
Thanks for the comment. I'll clarify; I didn't mean to imply that you can't have a good framerate with an XNA based game.
Robert P
@Robert P, I've changed my vote, your edits and remarks about XNA performance are now "politically correct" :).
Pop Catalin
+2  A: 

If your experience has been mostly with .NET as you say, XNA would have the shortest barrier to entry although you won't get quite as good of performance as you can with other options. As you say that you're planning on making a 2D platformer, however (assuming that the implication here is "non-hardware intensive"), then XNA would be more than sufficient and probably the most suitable choice for your project.

rmz
+2  A: 

DirectX doesnt mean you have to use native code, theres several managed wrappers out there. The performance loss is somewhere in the range of 1-3% of native DirectX, but considering you will save hours and hours of dev time, and likely will never need that last 2% anyways, managed is the way to go.

for example SlimDX - fully managed wrapper for DirectX in C#

Neil N
Managed DirectX is deprecated in favor of XNA
toast
You didnt read my post. I wasnt talking about the managed DX from MS.
Neil N
But XNA requires tons of god-damn runtimes for the end-user to install... so for starting, why not MDX 1.1? (or SlimDX for that matter when you've gotten up to spec a bit)
Oskar Duveborn
+3  A: 

XNA is going to be the easiest/quickest way to get a game up and running for the 360 or Windows platforms. It will allow you to continue developing in a way that you are already familiar (C#.NET) and it will provide you with a sizable framework that will take care of the commonly used stuff automatically. With this ease comes some limitations though, as you will be limited to only the aforementioned platforms and due to it being a large framework there will be a lot of overhead that will go largely unused causing performance hits, however with a simple 2D platformer, this probably isn't going to be an issue.

DirectX is going to limit you in platform as well, and is going to be a lot more complicated to learn and develop in. Also you will most likely be programming in C or C++ here. The advantages will be in performance, since you are handling everything you will be in control of everything and able to optimize everything for what you need. I would think that for a first game, you're going to be much better off starting with XNA and moving to DirectX after you've "outgrown" XNA. Especially with the goal of creating a simple 2D platformer.

OpenGL will allow your game to run on most platforms but will be as complicated (if not moreso) as DirectX (although I should mention there are graphic engines for OpenGL which are pretty simple to use like OGRE. You'll also be developing in C/C++ for OpenGL. Again I would think XNA would be the better choice until you feel you're ready for the next step.

Zemm
+1  A: 

One option is to write your engine in .NET but implement the renderer with C++/CLI. I'm doing this for one of my projects. XNA, OpenGL and DX are all too low-level for what I want. I don't want to write a renderer, I want to use an existing one. The Ogre3D wrapper, Mogre, appears to be a complete mess (not sure if it's the design of Mogre, Ogre3D or both), and most other wrappers are hopelessly out of date. Instead I'm implementing the renderer using C++/CLI and Irrlicht, which seems to be faster and more well designed than Ogre3D.

You may consider doing something like this.

Matt Olenik
+1  A: 

I started out using DirectX but have now moved on to XNA, mainly because I want to be able to focus more on the actual gameplay and less on the technology behind the game. Sure, you'll still have to do some engine coding, but it helps out alot to have a framework that supplies ready made functions specifically made for game programming.

shakazed