Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ElegantSol

C++ vs C# for Directx Development

This topic is 5230 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is C# as capable as C++ for directx development? I have done some Java and some C++ in the past. Would C# be recommended for someone that is less experienced? My needs are specificaly in the area of direcinput.

Share this post


Link to post
Share on other sites
Advertisement
Simply yes. Aparently DirectX under c# with all the .net stuff runs 7% slower than none-net hence most people will probably use unmanaged C++. However if rapid development with .net is as advertised the 7% drop may be acceptable

Share this post


Link to post
Share on other sites
Yes I think going with C# is the right way. I really depends on your performance requirments, but when the people at microsoft say that productivity is increased, they aren''t lying. But I know how Game Programmers will often die for that extra 7%(Me included), so you may want to wait till longhorn comes out. Then, Managed Code will be built into the operating system, so the performance decrease should get smaller, so that it is only 1% slower than Native code.

Sagar.Indurkhya

Share this post


Link to post
Share on other sites
c# is slightly slower than unmanaged c++ now, but experts thinks it maybe faster than c++ in a few years (because of JIT compilation)

and the productivity gain is HUGE. trust me, or better try it !

Share this post


Link to post
Share on other sites
I agree with everyone here. I have just started learning directx and c/c++ 3 months ago and starting out with c# would have been much easier and faster. If you are that worried about native code you can also switch back to using it in the c# code because it allows for both. C# is also much easier to learn than c++.

CS Teacher-"Game Design? Why would you want to do that?"
Me-"Because it involves some of the most advanced programming with the hardest problems ever seen."
CS Teacher-"I know that! Why don''t you take my programming classes then?"
Me-"Sorry, but frankly, your classes suck."

Share this post


Link to post
Share on other sites
Before you read: No flamewars please, eh?

- C# is a huge time-saver (cuts your development time significantly). You don't want to micromanage memory for lots of parts of your code, and garbage collection handles that for you. For parts that you want to micromanage, or if you think garbage collection's bad, you can always use unsafe code.

My point is: In talented hands, C# can be fast enough. Perhaps not as C++ because of JIT compilation, but:
* That (JIT compilation) only happens once
* It's continually improving
* It allows optimization on execution, i.e. say a new technology (SSE3) comes out, the JIT compiler would then optimize the code using it without your intervention. Of course compilers aren't that perfect at optimization, but still, the time-saving is huge, and the optimization should be good enough (how often do you have to code something in assembly?).

- Managed DX is just a thin wrapper around the unmanaged API. As such, you'll almost never be limited by Managed DX itself. You'd be limited by other parts of your engine, *if* you're not good enough at C#.

- The problems we see with managedDX:
1. Requires good-to-excellent C# knowledge in order to get things running as smooth as possible (required for games, and differs with the kind of game. e.g. FPS vs Puzzle). C# is a new language, and we're not good enough at it yet.

2. There's so much C++ knowledge and resources available around (sometimes referred to as C++ inertia). This isn't a big deal, IMO, because the switch from C++ to C# is very easy.

3. For downloadable games, you're kind of limited by the size of .NET (~20 MB). Most indie games are downloadable, and using .NET would render that impossible (and many users haven't even heard of .NET yet , it seems.). Broadband and Longhorn are our saviours here.

What do other guys think about this?

Muhammad Haggag
Bitwise account: MHaggag -

[edited by - Coder on March 20, 2004 6:27:20 AM]

Share this post


Link to post
Share on other sites
hey
that some good info there but what im looking for is having the Directx stuff and all the performance critical stuff in C++ and then having C# as a Scripting language/control agent that interacts with the C++ code but doens;t run any Directx calls its self. I don;t really want to port all my C++ code that i have at the momment into c#. im just looking to integrate a scripting language of sorts and just thought C# would be nice


Eul0gy^

Share this post


Link to post
Share on other sites
quote:
Original post by Eul0gy
hey
that some good info there but what im looking for is having the Directx stuff and all the performance critical stuff in C++ and then having C# as a Scripting language/control agent that interacts with the C++ code but doens;t run any Directx calls its self. I don;t really want to port all my C++ code that i have at the momment into c#. im just looking to integrate a scripting language of sorts and just thought C# would be nice


Eul0gy^

We currently don''t want to port our C++ code to C# as well (for the aforementioned reasons). What we do, however, is create every part of our engine as a COM component. That way, we can access it easily through C#. So if we write the editor in C#, we can use the core of the engine through COM interop. And if we decide to port the C++ engine to C# someday, we don''t start from scratch. We just convert component by component.

Muhammad Haggag
Bitwise account: MHaggag -

Share this post


Link to post
Share on other sites
i use c++ because i don''t want to be locked in, but its stupid because i don''t really know anything else about c++ apart from using directx.

if you don''t care about being dependent on microsoft , c# n directx is fine

Share this post


Link to post
Share on other sites
quote:
Original post by johnnyBravo
if you don''t care about being dependent on microsoft , c# n directx is fine

That''s one big misconception about dotNET. dotNET is a standard now, and there are two open-source implementations under development: dotGNU, and Mono



Muhammad Haggag
Bitwise account: MHaggag -

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!