Sign in to follow this  

Should I use Managed DirectX?

This topic is 4759 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

Perhaps you should lay out the pros and cons of converting your enigne to C#:

Pros:
- Less memory management
- Faster development after the initial transition
- Setting up your engine for the future (Longhorn and DX10 will be more .NET-oriented)
- Expanding your skillset to include C# and Managed DX

Cons:
- You already have an existing (and functional) codebase in C++
- Time spent converting to C#
- As of now, Managed-DX is just a wrapper that sits on top of unmanaged-DX9. You aren't bringing anything new except for functional overhead.
- If your users don't have the Managed Runtime, they will need to download it. This is especially restrictive if you are relying on the shareware community - nobody wants to spend the time to download that entire thing for one app.

Share this post


Link to post
Share on other sites
Also, you should take into account performance considerations. With Managed DX, you have the added overhead of accessing DirectX through the wrapper classes and marshalling data between the CLR and native code boundaries. More importantly, however, your code will be executing within the CLR. The CLR is fast enough for most purposes, but it can't hold a candle the raw efficiency of a native-compiled C++ application.

Still, it is easier to code in C# (in my opinion), so it all depends on what you want to use it for.

Share this post


Link to post
Share on other sites
Quote:
Original post by nimrand
...The CLR is fast enough for most purposes, but it can't hold a candle the raw efficiency of a native-compiled C++ application.

Still, it is easier to code in C# (in my opinion), so it all depends on what you want to use it for.


95-98% is close enough that it shouldn't really make a difference. The framework's speed shouldn't be an issue unless you're trying to make Doom 4.

Share this post


Link to post
Share on other sites
If you're doing it to make your engine more accessible, please do. Otherwise, I don't see the point.

I'm using C# and Managed DirectX because I don't know C++ but I do know C# so it's easier for me. C# is way easier to learn the C++.

As far as performance and graphics are concerned with games, the time to think about performance as at the beginning, at the middle and at the end, so C++ is the way to go, even for 5%.

Share this post


Link to post
Share on other sites
When people say to use C++ over C# because of performance, I always shudder.

Let's say that C# is 85% of the performance of C++. In reality it is more like 90-95% depending upon the application.

So if your engine on C++ get 100FPS, then on C# it will be 85FPS (in general)... however, this will depend on whether your game is cpu dependent or gpu. If GPU, the performance of C# will be *very* close to C++. If not, then you will see the sample 85% noted.

The key here to realize that this is on a given hardware platform. How many weeks will it take before a new processor comes out and nullifies the original difference? Of course, the C++ version will always be faster, but *how* fast is enough?

If your C# version get 60FPS, and your C++ version gets 70FPS... well then it just isn't going to matter to the consumer much - and it won't matter to you either - except your massive productivity gains by using C#.

Now, if your engine is only turning 30FPS with C# and 40FPS with C++, well, maybe you have a point. But, again, by the time you are finished with your game, technology will have caught up once again.

Your game or engine isn't going to sell (or not) on a 15% (max) difference in FPS, it will be many other things.

C# offers so many productivity improvements over C++ there isn't time for me to list them. Others have listed the major points. I will note that Microsoft is moving towards managed code in LongHorn... and you will see much more cool stuff with WinFX, Avalon, etc. *and* tighter integration (meaning more performance) with the OS (no more wrappers).

If you like C++, there is nothing wrong with that. However, if you are writing for Windows, C# is the future. Look for the XBox soon to support WinFX :) (my prediction only - not from MS)

-Todd

Share this post


Link to post
Share on other sites
Like the guy said above. If you're largely into (or near completing) your engine then don't bother converting. The only reason I would consider converting it to C++ is for compatibility issues. It seems that unless you're programming in C# most people dont have Managed DX installed and people bitch endlessly when you tell them they need to get it to be able to play your game -- I speak out of experience. Apparently a small download is too much hastle. So if you're going for accessibiliy you may have to convert (I'm looking to do the same once I get the engine done in C#)

Share this post


Link to post
Share on other sites
Quote:
Original post by Toddk
Look for the XBox soon to support WinFX :) (my prediction only - not from MS)
Unfortunately, I do not believe that the Xbox2 will support the managed DX and .NET architectures. IMO, supporting .NET on the Xbox2 would be a very logical move - game developers could quickly develop their games for both the Xbox and the PC. However, any developer that would need to port to other consoles, such as PS2 or PS3, wouldn't be able to use it.

Perhaps Xbox3 will be more supportive of managed DX, after Longhorn and WGF2 is released.

Share this post


Link to post
Share on other sites
If anything I expect C# will be phased in rather slowly. Most experienced game programmers out there are best familiar with older languages so C# is likely only to start coming in when younger programmers start in. Luckily, the IT industry moves pretty quickly so it'll take less time than most other industries take to phase stuff in. Don't expect any changes over night tho.

Share this post


Link to post
Share on other sites
I would say yes, do it. Convert.

I started developing my engine in C++. Worked on it for . . . almost 2 years. Sure, I was learning and it was sloppy, so it wasn't complete. However, I just switched to C# almost a year ago. I feel like kissing the guy that originally convinced me to do it. My productivity is so much better. It's weird how just a few things like garbage cleanup, the string type, and neat Collection classes can really boost your performance.

Again, I repeat do it. C# is not only a great language, but it's getting better constantly, as 2005 should bring about some awesome improvements.

--Vic--

Share this post


Link to post
Share on other sites
First I'm sorry for absence, I'm busy for couple days.

I start learning C++ about 1 year ago. After 3 months, I'd begun to coding my engine. First I use OpenGL and then converted to DirectX.

I've been coding and learning so my engine isn't well and RELIES MOST ON CPU (I've created some wrapper class and it's ready to take advantages of new GPU technologies. I'll re-coding as soon as I know).

My knowlegde about C++ is also poor (I often encountered errors that I don't understand what it's about. I depends most on MSDN & DxSDK. I'M LOOKING FOR A GOOD BOOK ABOUT C++).

I've been programming (and learning) C# for 3 months and like it much.

---------------------

A small question :) Why does C# process Exception so slow?

Share this post


Link to post
Share on other sites
"First I'm sorry for absence, I'm busy for couple days.

I start learning C++ about 1 year ago. After 3 months, I'd begun to coding my engine. First I use OpenGL and then converted to DirectX.

I've been coding and learning so my engine isn't well and RELIES MOST ON CPU (I've created some wrapper class and it's ready to take advantages of new GPU technologies. I'll re-coding as soon as I know).

My knowlegde about C++ is also poor (I often encountered errors that I don't understand what it's about. I depends most on MSDN & DxSDK. I'M LOOKING FOR A GOOD BOOK ABOUT C++).

I've been programming (and learning) C# for 3 months and like it much."

No more suggestion?

Share this post


Link to post
Share on other sites

This topic is 4759 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this