Jump to content
  • Advertisement
Sign in to follow this  
pongping

.NET, is it better?

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

Hey, I've noticed that many people program in .net (C++.net or c#). What i was wondering is what is better about C++.net than normal native C++? And is C# not a lot slower than native C++ since games can't afford a loss of performance.

Share this post


Link to post
Share on other sites
Advertisement
.NET (among a few things) provides a very large library of code to draw from, and C# isn't really slow.

Share this post


Link to post
Share on other sites

C# and C++/CLI can be almost as fast as C++ if properly written. I would recommend getting a profiler that will profile your managed code to signal these performance gotchas clearly.

I have a newtork library for C++ that i have written based on the API for C# for sockets and other network realted tasks. IMHO, C# performs very well.

All that said. I still develope games in C++. The number of 3rd Party Libs and C++ is my "native tougue" are my only legit reasons.

FYI and not to gloat. I wrote a gamespy replacement in C# for a multiplayer game written in C++ so I have seen both sides.

Share this post


Link to post
Share on other sites
in short, yes .NET is better.
you only have to worry about speed if you're making a AAA title or you have a VERY VERY intensive Physics, AI, and/or rendering framework going. 98% of people don't. Even though they believe they do.

Share this post


Link to post
Share on other sites
Thanks for all the replies! And what is different between native C++ and managed C++? Is there like a difference in syntax for example?

Share this post


Link to post
Share on other sites
Benchmarks show that MC++ is much slower than anything else, It is not even recommended by MS unless you want to port some C++ code to .NET .

C# is decently fast, but it is not faster than C++ , the difference is not noticeable as long as you handle your memory usage with care.

.NET is not better than native it is not worse either, it is just something different. Different things for different objectives

Share this post


Link to post
Share on other sites
A while ago I took my native C++ game and profiled it and then ported it to Managed C++ and profiled it again, it was about 5%-10% slower, which isn't bad at all considering my development time is significantly decreased with MC++. Granted, if you're making the next Quake 3 then 10% is probably inexcusable, but pretty much everyone here is making amateur or sideline games and 10% isn't a big deal. I also ported and profiled a C# program to MC++ and found no difference. I prefer C# over MC++ since C#'s syntax is a little more clean since it doesn't have to have backwards support for an old syntax, although MC++'s syntax still isn't bad. However, there are some libs that are very useful that only work with C++, so my main game development is with MC++ for the time being.

Quote:
And what is different between native C++ and managed C++? Is there like a difference in syntax for example?

Yes, there are some differences like a class has to be declared with 'ref' or 'value' in front of it and managed pointers have a '^' instead of a '*' and you use gcnew to create memory instead of new. Also namespaces play more of a role. If you already know C++ then learning MC++ or C# won't be too hard and will only take you a couple of days, Google for some tutorials.

Share this post


Link to post
Share on other sites
Managed C++ is a hack. An ugly, ugly hack. If you plan to use .NET and you're writing new code, avoid Managed C++ and just go to C#.

Managed C++ is only useful in big enterprisey applications that would be too expensive to port to another language, so they write Managed extensions to hack the program to work with newer C# and VB.NET code.

Share this post


Link to post
Share on other sites
Quote:
Original post by JBourrie
Managed C++ is a hack. An ugly, ugly hack. If you plan to use .NET and you're writing new code, avoid Managed C++ and just go to C#.

Exactly how is it a hack and how is it ugly? I'm genuinely curious since I quite like it. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

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