Jump to content

  • Log In with Google      Sign In   
  • Create Account

Managed DirectX vs C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
34 replies to this topic

#1 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 24 June 2005 - 10:04 PM

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.

Sponsor:

#2 AvengerDr   Members   -  Reputation: 751

Like
0Likes
Like

Posted 25 June 2005 - 01:20 AM

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..


#3 demonkoryu   Members   -  Reputation: 976

Like
0Likes
Like

Posted 25 June 2005 - 01:26 AM

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.


#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 25 June 2005 - 02:01 AM

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!

#5 jollyjeffers   Crossbones+   -  Reputation: 1542

Like
0Likes
Like

Posted 25 June 2005 - 02:10 AM

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>

#6 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 June 2005 - 02:32 AM

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

#7 Muhammad Haggag   Moderators   -  Reputation: 1357

Like
0Likes
Like

Posted 25 June 2005 - 05:21 AM

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#.

#8 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 June 2005 - 06:08 AM

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.

#9 joew   Crossbones+   -  Reputation: 3679

Like
0Likes
Like

Posted 25 June 2005 - 06:18 AM

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]

#10 CProgrammer   Members   -  Reputation: 303

Like
0Likes
Like

Posted 25 June 2005 - 07:10 AM

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

#11 joew   Crossbones+   -  Reputation: 3679

Like
0Likes
Like

Posted 25 June 2005 - 07:16 AM

I should have also mentioned a little more about the engine I have been working on after work. As I stated the engine is written in native C++ but you could code the game in either C++ or C# and the tools such as the world editor, etc are actually built in C#.

Why? Because it is currently aimed at the PC / XBox and hopefully the Xenon if I can aquire licensing mid-2006.

Our project at work is PC only and therefore using a full C# engine was definately the way to go. If we were looking to put this title on consoles though it would have been a whole other ballgame. But even then it would be quite easy to port the engine to C++ if needed.. I mean its not like the language and coding is the hard part of building an engine by any means.

Also I don't quite agree with:
Quote:
Original post by CProgrammer
Hehe yeah nobody likes change in the industry.

Because quite honestly I could name off 10 large studios that love change as long as it makes them more productive.. and the number of small-medium development houses enjoying it is probably staggering. A large portion of studios have actually already ported or have started porting all of their tools to C#.

#12 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 June 2005 - 07:41 AM

Yes, very good points.

C# is optimized internally from the start. Making C++ optimized is a challenge.

C++ will not be going away anytime soon. Look at PHP and PERL in the linux world. Perl is just used too much in so many areas for Perl to just be pushed off the shelves because of another language. It IS a matter of choice.

However, It is very nice to know, since I am learning here more about C# and what it CAN do. That C# will become more of a standard and common place in all areas where C++ was concerned, including Game programming.

Since, games are the most complex, intense programming one can do, ( which you account for sound, graphics, user controls, hardware compatitbily and frame rates ) it is a great way to see just how POWERFUL and EFFICENT a language actually is.

Well, Im loving it when it comes to C#. Looks like its the way to go for all types of programming where C++ used to be.

C++ however is a beautiful langugage in itself. However, C# is just a wonderful evolution to C++. First A, B, C, C++, now the wonder which is C#.

Thanks for all the replies.. code on my friends! ANd good luck with all your projects.


Regards,Matt - digipanel.com

#13 demonkoryu   Members   -  Reputation: 976

Like
0Likes
Like

Posted 25 June 2005 - 08:03 AM

Quote:
Original post by Saruman
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#.


Ok [looksaround]
I was saying that from a technological purists viewpoint ("C++ as high level assembler"). C# requires the .NET runtime with its minor drawbacks (another install, more memory needed at runtime). It isn't as portable as C++ (ok, there's MONO... but how mature is that?) I do believe it will be still a few years until C++ isn't used anymore for most AAA titles.

#14 joew   Crossbones+   -  Reputation: 3679

Like
0Likes
Like

Posted 25 June 2005 - 08:10 AM

Quote:
Original post by Konfusius
C# requires the .NET runtime with its minor drawbacks (another install, more memory needed at runtime).

Totally correct on these points. Although if the memory needed to boot the .NET framework is an issue for you than I'm not sure how you're going to even boot a native game unless you are trying to squeek real low min specs :)

I do highly agree with a drawback being the need to install the .NET framework on machines that do not already have it, and also something you did not mention but along the same lines which is getting the correct managed DirectX version installed. This is a moot point due to the bootstrapper and being able to install these things, but for games that are distributed online this does bump up the download package size.

Quote:

It isn't as portable as C++ (ok, there's MONO... but how mature is that?)

Please note the following is my personal opinion and not a fact, but I believe C# is meant for Windows application development and thats it. If I am making a game for PC only there is absolutely zero reason not to build it in C#.. but the second I need to cross platform than using C# or the .NET framework for that matter is no longer an option to me.

On another note you should read into what you are talking about first, as MONO is a very mature implementation of the .NET framework.

Quote:

I do believe it will be still a few years until C++ isn't used anymore for most AAA titles.

It really depends. I mean if the AAA titles are meant to be cross platform you are dead right, because targeting C# for development in that case is the wrong choice. On the other hand for studios making Windows PC only games my opinion is that C# is the only way to go in the future unless you are a large established company with backing and existing technology.

#15 mtrudder   Members   -  Reputation: 129

Like
0Likes
Like

Posted 25 June 2005 - 08:35 AM

It's great to see how many people are backing C# for game development. I've been looking at integrating C# into my projects for awhile now, but it's usually been limited to tools programming as my school coursework requires C++ for projects.

It's great that you mention Reality Engine, Saruman. I was fortunate enough to sit through a demo of the engine at a presentation at school given by the President of Artificial Studios. I was ecstatic to see how well C# worked in a professional development environment.

Anyways, I've got a quick question as well, hopefully Saruman can field this one. I've been planning an engine for awhile, built using C++ but with the ability to be extended using C# or C++. I've yet to find any information about how to join the two together, whether it be extending the engine with C# or the other way around - embedding the engine in a C# tool like a level editor.

I'm assuming the answer to the latter is to access the engine in a DLL from a C# application, but as for accessing C# from C++, I have no idea where to begin. Any suggestions would be greatly helpful.

Thanks,
Matt Rudder

#16 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 June 2005 - 09:43 AM

You in luck. C# does not use pointers by default. However you can use C++ code in C# code simply by assigning blocks of code with the keyword unsafe { C++ pointers and code here } and whoalla you have C++ code in C# application.

C# allows you to code with C# rules however you can at anytime move out of that with unsafe { } etc... check it out.
Regards,Matt - digipanel.com

#17 DuFaceTheBass   Members   -  Reputation: 208

Like
0Likes
Like

Posted 25 June 2005 - 10:07 AM

Correct me if I'm wrong, but isn't the .NET runtime written in C/C++? And isn't ManagedDX is just a .NET wrapper for the C++ based DirectX? So surely there must be a slight performance issue when using the two languages, surely C++ and DirectX would be faster than C# and ManagedDX?

In terms of development ease, I appreciate that C# is probably quicker as you don't have to reinvent the wheel each time you want to make something.

#18 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 25 June 2005 - 10:36 AM

Personally, I'd love to get into some serious C# game development, but online distribution of the .NET Framework and the proper version of Managed DirectX is the brick wall that's stopping me. As mentioned above, the sizable amount that these add to the filesize of a game is enough to cut down your potential audience by a fair bit (dial-up users and other low-bandwidth folks).

Once Microsoft gets their helmet on straight and comes up with a better way for redistributing MDX, you'll definitely be seeing me on the C# gamedev scene. :)

#19 mtrudder   Members   -  Reputation: 129

Like
0Likes
Like

Posted 25 June 2005 - 01:22 PM

That's my big problem. I don't want to use Managed DX. I'd like to stick to C++ to do all the base architecture - Graphics, Sound, Physics, etc. I want to be able to consume my engine from a C# Application (World Builder) and support the language for scripting. The Reality Engine does this exceptionally well. I've tried to make contact with the developers about how they used the .NET Framework to acheive this, but I've yet to hear back.

#20 nulled   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 June 2005 - 02:50 PM

Yes, Im sure that future releases of the windows OS will of course have Managed Direct X built in.. it just needs time to become standardized.. all the complaining about it now makes no sense to me as we all know that C# is something good and WILL become standard over the years.. it just takes time.

For now the larger downloads and care take to make sure your C# game runs properly, or at all, is just standard procedure for any NEW technology.

sheeesh!


Regards,Matt - digipanel.com




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS