Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualkunos

Posted 17 December 2012 - 11:37 AM

I think the sweet spot in writing a game in C# and C++ would be to have your core engine coded in C++ and then exposed to C# (or any other language that can bind to C) via a C interface (good for portability) or CLI/C++ interface. This way you keep all the game code using the elegance and simplicity of C#/F# while using C++ to interface all the 3rd party libs as it was meant to be.
Also, this way, you are not paying the price of constant context switching that you get when using things like OpenTK and SharpDX happening at every single function call, and you can keep this cost under control by grouping more calls into a single "engine" call.

This for the software.. then there is the programmer's brain context switching cost.. I find this remarkably annoying, especially when you are forced to go "down" into C++ code because you need something not available in C# land... I did this for my last project project and I didn't really like it, so for my current project I am back to C++ only approach. Somehow, working with C++ only makes you forget how much it sucks to deal with forward declarations, includes, stupid compiler error description and so on... having part of your code in a decent language like C#/F# is a constant reminder of how much suckage there is in C++.

#1kunos

Posted 17 December 2012 - 11:37 AM

I think the sweet spot in writing a game in C# and C++ would be to have your core engine coded in C++ and then exposed to C# via a C interface (good for portability) or CLI/C++ interface. This way you keep all the game code using the elegance and simplicity of C#/F# while using C++ to interface all the 3rd party libs as it was meant to be.
Also, this way, you are not paying the price of constant context switching that you get when using things like OpenTK and SharpDX happening at every single function call, and you can keep this cost under control by grouping more calls into a single "engine" call.

This for the software.. then there is the programmer's brain context switching cost.. I find this remarkably annoying, especially when you are forced to go "down" into C++ code because you need something not available in C# land... I did this for my last project project and I didn't really like it, so for my current project I am back to C++ only approach. Somehow, working with C++ only makes you forget how much it sucks to deal with forward declarations, includes, stupid compiler error description and so on... having part of your code in a decent language like C#/F# is a constant reminder of how much suckage there is in C++.

PARTNERS