Sign in to follow this  
WebsiteWill

Managed graphics engine

Recommended Posts

This may get moved to the DirectX forum but I am posting it here because the question itself is very generic. I am looking for a reasonably definitive guide to the speeds of Managed over unmanaged code. I have some GUI code written in C++ unmanaged DirectX and, while it works fine so far, I am now thinking of redoing it in Managed DirectX using C#. The reason for this is simply for the fact that managed languages provide faster development time. I'm pretty new to .NET and so far I am loving it. Writing VB.NET codebehind at work for ASP.NET web apps is a pure joy. I've always preferred object oriented code in C++ and so I figured it may be a good idea to move onto C#. I've read the old arguments about managed is slower, c++ is always faster, no it isn't, yes it is...blah blah... Not that I don't discount them, it's just that a lot of what is out there seems like nothing more than opinions based on personal tests (at best). I just compared the C++ samples to the Managed samples in the DirectX SDK and they seem fairly equal in framerates on my PC with an ATI Radeon 9800, 2.8GHz, 1GB ram. For some, managed was faster, for others, C++ was faster. I guess the main question is, would it be feasable to design a game solely around managed code because it seems that the shortened development time would more than make up for a little bit lost in framerates? This is of course assuming I do not plan to write the worlds next ELITE game that pushes every ounce of energy out of the CPU and GPU. We're talking basics here. I'm guessing that by the time I get anywhere with the project, the managed code compilers will be optimized pretty well. Just looking for other's thoughts and maybe someone who has links to some REAL benchmarks between C++ and C# with DirectX. Thanks, Webby

Share this post


Link to post
Share on other sites
. Net is perfectly capable of achieving this. The main speed problem with VB is bad coding practices. The programmer can get away without declaring variables, using variants, etc. These problems can be overcome by good coding practices.

.NET is going to be slightly slower than unmanaged, just because it is another layer of abstraction. This isn't really an issue unless you are really pumping the hardware. I am using .NET and I love the style and ease of it.

Share this post


Link to post
Share on other sites
Thanks for the input. I'd like to here some from those using C# as I don't plan to use VB in my game since there are definite and obvious speed boosts to be had with using C# or C++.

My main decision is whether the ease of development in C# would be greater than the few potential frames per second. Right now my guess is that it would be. Especially if planning a game for current hardware that is more capable of utilizing the features of .NET.

Webby

Share this post


Link to post
Share on other sites
I use both c# and VB. I like both, and I really choose which to use based on how lazy I am (I can get sloppy in VB with auto-complete, capitalization, etc). They will more or less compile to the same code, so there won't be any major speed differences.

As I said, managed DX is perfectly suited for game development. If you plan on making a 2D game, managed DX definately fast enough and is much easier to code in. If you want to make 3D, iot really depends on the game. I am making a simple 3D space shooter (think space invaders in 3D), and it has no speed problems so far (runs at over 150 FPS on my pathetic P3, Radeon 9200).

Anyway, good luck with your coding!

Share this post


Link to post
Share on other sites

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