C++ vs C# for Directx Development

Started by
29 comments, last by ElegantSol 20 years ago
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.
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
------------------------See my games programming site at: www.toymaker.info
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
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 !
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."
--------------------------------------------------------------------------Michael Schuld
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]

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

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

This topic is closed to new replies.

Advertisement