DirectX or Managed DirectX ?

Hello, it's my first post here ;)
I've been developing in DirectX for several years (using c++). I am thinking if it's worth to move to the "managed world"
I can do everything in c++ and directx but creating apps in c# and mdx is much faster and simpler. What is your opinion Is it huge performance penalty making 3D games in c# and mdx



Answer this question

DirectX or Managed DirectX ?

  • Motris

    You have some excellent points there Tom, I like hearing your opinion on these topics!

    I would like to point out that the LaMothe comment quoted above is 13 months old, I'd like to believe that Andre would have some different comments based on the progress of MDX and the incredible work MDX developers are producing.

    In regards to the portability of software to multiple platforms, I imagine a company writing a game in a managed language...once...one set of code.  And using a compiler to make a specific exe for each platform.  Or have a CLR package for each platform

    What's the possibility of this Tom Others

     


  • gmcbay

    Check this link out for cool flight simulator that was written in c# using managed dx and what is possible.
    http://www.white-clouds.org/ShowPost.aspx PostID=23


  • Pedro.net

    Welcome,

    Tom Miller put together an article for MSDN, http://msdn.microsoft.com/msdnmag/issues/05/08/EndBracket/default.aspx, the article is on Performance in Managed DirectX. You might want to have a read of that.

  • Darkdog

    That's really part of the problem - people need to stop thinking that your language preference somehow bestows a level of smartness on you.

    I've been around for more years than I care to mention and I've seen both terrible and amazing programmers in every language. The amazing programmers can of course do slightly more in C++ than they can in VB or C# but the terrible ones can do so much more damage. Every time you think C++ programmers don't make mistakes just say to yourself 'buffer overrun'.

    Making fast and complex games sometimes requires the edge that C++ gives you.

    Use unmanaged code if....
    * you need to optimise your code to the ultimate level such as CPU cycles, memory cache hits etc
    * C++ is your language of choice anyway (though consider managed C++) - if so the productivity gains of managed code may not be big enough to outweigh your efficiency
    * you prefer your API to be more stable (Sorry Tom, but MDX changing often does upset some folk) as the C++ API has been around longer and is more mature
    * you want to go cross platform or consoles
    * you believe the stigma of managed directx will cause your game not to sell or be published
    * you want to get a job programming games with a big game studio in the near future (being realistic here - I just don't see managed DirectX in the jobs wanted ads at the moment)

    Otherwise managed code is a valid choice.

    If you are a beginner then I think managed code is a very smart choice - as Jack said you can concentrate on getting the algorithms and 3d stuff done rather than worrying about which pointer goes where.

    For the most part when it comes to performance it comes down to smart algorithms. The top complex games are fast because of the occlusion and culling algorithms and the brains that design them, not because of great C++ skills. C++ may help fine tune those algorithms and they would beat C# in a head to head race, but no language will help you if you are trying to draw 200 million polygons per frame.

     





  • devdept

    I won't add into the discussion on which is better, or which to use as I'm naturally biased.  I will say that some of the (for lack of a better word) 'conclusions' reached here dishearten me.  Not for the opinions stated, but the utter lack of research (or factual information) in them.  If you feel strongly about your opinion, please, back it up with *actual* information, rather than made up stories and innuendo. 

    Oh, and for the record, I've visited EA, and guess what, they use C# for quite a bit of stuff.  Go get the Game Developer Magazine, find the post-mortem for Sims 2.  Look at the technologies they use for that title.  Surprise surprise, the .NET Framework.  While I agree with the assertion that if you want to be a game programmer 'NOW', you'd be best suited to learn C++, the fact is, unless you can learn all the nuances of that language instantaneously (good luck with that), you still won't be ready for a good time.  Mr LaMothe has written a large number of books, and I respect his knowledge on the subject of 3d graphics, however, his advice in this instance appears to be dubious at best.

    In reality, the biggest 'barrier' to entry for C# game development more-so than anything else is the lack of availability on non-windows platforms, specifically consoles.  Don't confuse that sentence to believe I mean 'microsoft platforms', since as we are all well aware of, even the Microsoft consoles do not yet have support for managed languages.  So, if you are EA, and you sell millions of games to people split across 6-7 different platforms made by 3-4 different companies using numerous types of hardware architecture, it only makes sense to use a language that is portable to each of these platforms. 

    A majority of these big companies however do much of the development in Windows, and use managed code (and Managed DirectX) in the tools they develop for the game.  Being a tool developer is often the easiest way to get your 'foot in the door' and knowing managed code isn't a hindrance for that, in fact, it probably helps.  Do I expect to see EA release a game written in managed code in the near future   No.  Do I expect to see them continue to use managed code for the titles they do ship behind the scenes   Yes.  Do I expect many other companies to do the same   Yes.

    Will we see a 'big name developer' release a game written in Managed DirectX   Depends on your definition of 'big name', but anyone that wants to maximize revenue potential (read: ship on mulitple platforms, ie, consoles) currently won't have that option.  For the immediate future, any managed games will be Windows platform only.  (and for the record, yes, i've seen quite compelling managed games in development, along with unbelievable toolsets)

    Oh, and for the link to the elder scrolls picture, and then the comments about the HADDD videos.  First, the work those guys have done is fantastic, attempting to belittle it is neither constructive nor helpful.  Second, do you realize that the features they show off in that little room are many of the *exact* same features you see in the elder scrolls screenshot   GIve those guys the same art team and budget (or myself) and I guarantee you they could produce an equally visually stunning screenshot.  I haven't played Elder Scrolls yet, so I don't know if it's a good game, but I really wish people would start paying more attention to how a game played (and if it was fun) than how many bells and whistles it had.  Besides, what you're trying to compare is art teams, not API's.  Please don't confuse the two.

    Wow.. I type entirely too much when i'm on vacation.. I should get back to enjoying it.  It's late, sorry for any spelling/grammar errors.



  • Gareth Welch

     Mykre wrote:

    Tom Miller put together an article for MSDN, http://msdn.microsoft.com/msdnmag/issues/05/08/EndBracket/default.aspx, the article is on Performance in Managed DirectX. You might want to have a read of that.


    This article is quite nice but I think that no one among c++ programmers would make mistakes like that.


  • Saqib Ullah

    The HAD3 Engine looks impressive at first. At a closer glance, it's a simple room with a few given objects. I can do that in Java if you want me to, and I'll darken the rooms to make it look immersive and make a cool video of it. It's a nice effort, though.


  • Andy Lambert

    Jeremy, remember a few things:

    GameSDK, later known as DirectX, was recognized when it was faster than DOS32. A transition was made. DOOM was recognized heavily as well, even by Microsoft who later got into the game. Managed DirectX had nothing to gain recognition for except for the noobs having a tough time with the real iron. For example, take a look at this screenshot made in DirectX 9:

    http://morrowind.com/images/art/ob_xbox360/obx12B.jpg

    Can Managed DirectX do this Got anything to show for it It's not recognized when it was released, so don't expect companies using it other than for easier toolmaking. Stick with C++/DirectX for your games of tomarrow, and leave the rest for the low-paid programmers who can't help you anywhere with heavy optimization. Btw, C# won't get anywhere as Java had tried for 10 years. It didn't get anywhere in the industry besides some simple web and toolmaking apps. You're a game programmer - act like one. Speed is important. 


  • Radvis

    Use C# and Managed DirectX.  You won't be dissapointed. Start here:

    http://gosub.com/OpenSource/DirectXControl/DirectXControl.htm

    -Jeremy

  • Ralph Rivas

    For the OP, here's a quote from Andre' LaMothe, a well known book author on game development. Decide for yourself :)

    Topic on C#/MDX for gaming:

    "No, definitely not. By the time another language is ready to be accepted C# will be long gone, C++ is just now getting into its prime, many game developers still use C, so C++ will reach maximum saturation in 3-5 years, and then in 3-5 more people will start experimenting with other languages. But, for other types of games, web based, portable, its possible to see this happen faster and C# might catch that wave -- But, you have to realize that games releasing today have the next versions in dev already which are in the same language and will take 2-3 years to develop, so there isn't "time" really to change languages, and what motivation would there be for the new set of vars, unknowns etc. So if you want to be a game programmer NOW or in the near future, I would master C/C++ and learn C# for web stuff, etc. but, don't expect to use it at EA."

    http://205.158.110.70/ubbcgi/ultimatebb.cgi ubb=get_topic&f=20&t=000019


  • Kevin C. Kelly

     SirMike wrote:
    Hello, it's my first post here ;)

    Welcome Smile

     SirMike wrote:
    I've been developing in DirectX for several years (using c++). I am thinking if it's worth to move to the "managed world"

    Fair enough... but before I go any further... remember that you can always use both "versions". Not necessarily at the same time, but if you're jumping to C# it doesn't mean you need to completely leave C++ and all related stuff behind...

     SirMike wrote:
    creating apps in c# and mdx is much faster and simpler. What is your opinion

    I started DirectX programming in VB6 - I loved (and still do) the "RAD" ideas. I could learn faster and generally do more things quickly if I could think about the problem rather than the implementation. This is especially true when it comes to making GUI-based applications... I've yet to find anything that rivals the so-easy-my-grandmother-could-do-it VB6 GUI creation Smile

    On the other hand, C++ being the more dominant language makes for much more available resources/documentation/articles as well as a bigger community to ask questions in. I also find that C++ to be more expressive than some other HLL's, such that I can create a neater and more concise solution to my problem and know exactly what is going on. Maybe I'm old fashioned in some ways, but I like to know what's going on "behind the scenes" - something that is harder to do when you've got something huge like the JVM or .NET framework in place.

    With reference to what I said to start with... have a go with C# and MDX, see how it suits you. Give it a few months to learn how it works (I've heard a lot of people say that programming C# in the style of C++ is a bad idea. You need to program C# as if it were C#) and write some demo/practice apps. If it works for you, great - if not then you've still got your C++ skills to fall back on.

     SirMike wrote:
    Is it huge performance penalty making 3D games in c# and mdx

    Hmm, age old question here... you'll be unlikely to find a conclusive answer. It pretty much depends what you're trying to do. Making a Doom3/UE3 beating application in C# will be very hard (if not impossible); making a "lesser" 3D game would definitely be possible...

    I seem to remember that the performance goals for MDX were 97% of the speed of C++; and that they came close to that - 95% or 96% I think ( ). However, none of that reflects the differences between the underlying languages (and their respective libraries).

    hth
    Jack


  • RobertPalmer

    I haven't yet used managed version, but I'v heard some good and some bad about it. My opinion is almost same as Mr. LaMothe. Okay, we have seen this before (haven't we ), basic languages, java, and so on. All of them promised a new glorious programming language that will change everything..

    This is the trend I could say. New languages always come and go.

    Well, it will be interesting to see, is this different. :)


  • Dorian A

    Of course managed DirectX can do that - its DirectX, it makes exactly the same API calls as Native DirectX. Could it do it at the same rate - probably not because a scene like that is probably tuned to use every last cent of the CPU and optimises memory for best cache hits and that just not possible in .Net. But I bet it wouldn't be half as slow and that means that for any game other than one with graphics like that Managed DirectX is totally a viable option. Making a scene like that has very little to do with the API that you choose and more to do with smart algorithms.

    Can I show you someone doing graphics like that today - no, because none of the large studios that are capable of putting together something of that quality are doing managed directX. The Haddd videos are probably the best demo there is today http://www.thezbuffer.com/articles/191.aspx.

    Should you use ManagedDirectX or native DirectX See my list earlier in this thread.

    [yes I know I'm biased, but the native guys like Jack will correct me if I'm wrong]



  • ecardenas

     Jack Hoxley wrote:

    Hmm, age old question here... you'll be unlikely to find a conclusive answer. It pretty much depends what you're trying to do. Making a Doom3/UE3 beating application in C# will be very hard (if not impossible); making a "lesser" 3D game would definitely be possible...


    Thanks for the answer. Ofcourse I am not going to write Doom4 ;) I just want to write a game with 3D Graphics. Using shaders, dynamic lighting and shadows. You're right, I will try and see if it works for me :)


  • DirectX or Managed DirectX ?