Managed DirectX vs C++

Started by
33 comments, last by Saruman 18 years, 9 months ago
Hello, I was wondering how much C# was taking off in regards to an alternative to C++ in the game programming areana. Is C# better than C++? I mean C# appears to be superior to C++ in regards to readability and the fact that LESS lines of code in C# can do the same job as double the lines of code in C++. Does C# have a performance hit due to the garbage collecting? I mean I know it takes alittle more time, but is it really meaningful to the over all picture? Wanting to know the thoughts of seasoned C++ programmed gone or currently converting to C#, game programmers out there. I for one LOVE C# and C++ is a wonderful language too.. however C# is SO damn elegant! regards, nulled the gamer.
Regards,Matt - digipanel.com
Advertisement
I believe that if you are not aiming to develop the next Doom or Unreal game, you'll not notice any serious difference. And the performance hit that there might be could still be reduced by taking advantege of today's technology such as shaders..
--Avengers UTD Chronicles - My game development blog
C++ is only really needed if you need the RAW power of your computer. Think of C++ as a high level assembly language.
C# should be fine for everything else except AAA titles.
Dammit! Just a year ago, all you could read about C# was: Crap, you'll never make a game with it! Now everybody swears: It's goddamn cooooool!
If C# does the job for you, use it - simple as that!

C# has it's uses as does C++ (+ other languages)... As mentioned, you probably don't want to use C# for a pedal-to-the-metal AAA title, but conversely, I wouldn't want to use C++ for a web applet type game (were Java and C#? might suit better).

Quote:Original post by Anonymous Poster
Dammit! Just a year ago, all you could read about C# was: Crap, you'll never make a game with it! Now everybody swears: It's goddamn cooooool!

[lol] Opinions change, nothing new there. C# was all new, innocent and unknown, but now it's lost a bit of it's shine and people are more familiar with it...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Damn it what if I WANT to use C# and make a AAA title? Possible? And use unsafe { } and asm for the parts that needed super optimization.

Alot like C++ _asm { } blocks.
Regards,Matt - digipanel.com
1) Nothing wrong with developing games in C# if it's going to be cost-effective (it can)

2) I'd forget about AAA titles for now. These are well beyond the abilities of independents, require a lot of money, talent, experience and even luck.

3) Saruman will hopefully chime in with a detailed answer. He develops commercial games with C#.

Cool thanks to all that bothered to reply. I have a DirectX7 ( old school direct Draw 7 ) bitmaps for a classic shooter game I may convert to C#. Its in C++ for now and its a mess/challenge to create being the sole programmer/designer, artist.

C# is so elegant and beautiful WIllling to spend the time to convert just because I love C# so much.
Regards,Matt - digipanel.com
Quote:Original post by Konfusius
C# should be fine for everything else except AAA titles.

Actually that is complete BS because if you look at the listing of the top selling AAA games the majority of them could have easily been built in C#. Although it is a moot point for an indie to ask because quite frankly if you don't have the money and resources you aren't going to make a AAA game no matter how much you wish for it.

Now also are we talking engines or games? I might see some people complain about engines if you need to use a lot of physics, etc (although you could just wrap and use Novodex) but games? I mean comon. If you look at Artificial Studios site you will notice that the Reality Engine was built in C++ but the games are actually written in C# 2.0. This is the exact same way the engine I am currently building at home is architected. Also I'm actually working on a commercial game developed in C# and just finished building the engine in managed code. It runs faster than our old C++ version because of better design, less bugs, etc.

Now if you have a purely 100% optimized C++ application compared to a purely optimized C# application.. the C# version should run at 97-98% of the performance unless you did something wrong. On top of that if you aren't a wizard with C++ you aren't going to be able to get that 2-3% difference anyways, and so far from my personal experience 9 times out of 10 the C# applications run faster because you can't make as many stupid mistakes... and I'm sorry to say there aren't many people that I would call 'expert' in the C++ language.

Now lets not get into the time it takes to develop in C# vs. C++ because I'm pretty sure that has been beaten to death. Our base engine took me 9 days at work to get both FFP/shader rendering pipelines, scenegraph, render queue, animation, input, etc completed. I have been working on it for another about 8-9 days and have it almost fully complete. That is a 100% feature complete commercial engine used in one of our upcoming games that will be completed in a full 20-24 day timeframe. On top of that I don't claim to be the best engine architect / developer in the world either as I am still learning a lot myself... get Sages or Washu to build one in C# and it would take half that amount of time.


EDIT: This is also built on .NET 1.1 due to our release date coming up before the actual release of VS2005 and the new framework. Once 2.0 is released you just see even better performance due to optimized floats, the ability to use generic containers, etc.

Quote:Original post by Coder
3) Saruman will hopefully chime in with a detailed answer. He develops commercial games with C#.

heh I just noticed this after I posted :)

[Edited by - Saruman on June 25, 2005 12:18:12 PM]
Hehe yeah nobody likes change in the industry. Its hard work, you have to adapt to a new language, and all the cool stuff youve made is in danger of bcoming a little less modern. (Although we all know that the algorithms are the important part at the end of the day).
Well I was sceptical with c#. I didnt like it that my in development c++ engine may be becoming outdated.
In my university we use c++ and c# for graphics programming although I must say c# and mdx take a big part. Its liked because its much faster, more readable and not only usefull to insiders. Even with c# its hard to get into someone elses code but with c++ its much more work and in a team effort that can become a problem in my opinion. And yes the university uses shaders to the full extent for performace and if using c# thats what I would definetely suggest (with c++ aswell offcorse).

Now I have no aopinion on c++ vs c#. I like them both, I probably tnd a bit more to c++ but thats probably just because I like doing things from scratch and have done so for 6+ years.

Bottom line: Learn both, use whatever you want.
But I definetely understand youre fear having to have the .net framwork and ... just bother you in the beginning :) (independance issue possibly)).

Oh and dont put to much emphisis on the garbage collector, in managed directx you still need to worry about disposing objects and if you dont the application will crash.
Another issue on speed is: Most people including myself are not aware of the inner workings of the .net framework and hence dont know whats effizient when. This can be a critical point.

-CProgrammer

This topic is closed to new replies.

Advertisement