Jump to content
  • Advertisement
Sign in to follow this  
BlackBrain

Choosing c# or c++ for game engine development

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

Hi .

 

   I want to start developing a game engine . I have done it before using xna and c# . Now I want to have the power of cumpute shaders and all the nice DX11 features .

So do you think from c++ or c# which is the better choice for this purpose ?

I feel a lot more comfortable in c# . But as you know c++ is generally faster . I heard about .net native compile that is going t bring c++ performance for .net languages .

 

For saving objects in my last engine I used BinaryFormatter of .net that I didn't see any equivalent for that in c++ .

Since c# uses refrence concept does it mean that iterating through an array does not take any benefit from CPU's cache ?

 

Thanks

Share this post


Link to post
Share on other sites
Advertisement

Well if you're not comfortable with C++ then I doubt you will beat the .NET JIT-compiler at writing fast native code in C++, and with Microsoft brewing some native .NET compiler, the speed difference will probably become a lot smaller very soon. (Like compiled VB6 vs C back in the 90s.)

 

If you want to use C++ because it's your long-term goal to be proficient at it, this is a great opportunity. Using C++ to be able to eventually port to iOS and Android might also be a good idea. If you just want C++ to save a few CPU cycles then I wouldn't bother unless your project is such that it absolutely needs blazing-fast performance. Truth be told, C++ might be a good starting point, but it is not a panacea to slow code. For example, Ogre 3D, which is pure C++, is sluggish and slow, and Runic Games, who are not even making performance-hungry games, had to mod it to improve performance. I wouldn't be surprised if someone could out-perform Ogre3D using XNA.

 

 

Also, I'm not sure I'd recommend BinaryFormatter for saving objects during development. I use it in my game editor for saving stuff and I regret it. Whenever I want to refactor something in my code, it breaks binary serialization and I can't fix it by hand, instead I have to use a SerializationBinder, hack some translation code, then load and save ALL my assets, and finally recompile my app without the hack because SerializationBinder slows loading down to a crawl. (It was such a pain that I had to make a library for auto-generating a SerializationBinder.) If I had to code it from scratch again, I'd probably save my levels in XML or JSON and my data in a SQLite database, disk space be damned. I think that binary serialization in .NET is useful for in-process serialization like copy and paste, sending data between AppDomain, and over a network, but not for long-term storage, and especially not during development where stuff can be moved and renamed.

Share this post


Link to post
Share on other sites

To add to Frob's exceptional coverage of the situation, I would say that when it comes to build an Engine with integrated tools like editors a-la Unity, using C# is a huge avantage because of the very good GUI building support you get either via WinForms or WPF.

We've seen C# and .NET pushed down in the latest 2-3 years by MS itself..and C++ regaining a lot of ground in the gamedev arena.. but, as .Net Native and the news coming out of Redmond about a rebirth of .Net and future support on the XBone show that the jury is not out yet on this one.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!