View Single Post
  #10  
Old 03-28-2012, 08:45 PM
Thee_oddball Thee_oddball is offline
Approved Member
 
Join Date: Mar 2011
Posts: 812
Default

Quote:
Originally Posted by mazex View Post
Well, I started working as a C++ developer in the mid 90:ies and switched to C# in 2006 for those reasons so I agree, if it would have been a business application... C# is an easier language to work with in general and If you have a team that includes junior developers doing businesses applications there is no debate on what to choose, the benefits of the .NET framework for business apps is a real boost too, as you have base classes for most everyday needs like talking to web services, mail servers, mq servers etc..

For gaming though it's a different story... The benefits of all those base classes in the .NET framework are really minor as most of the code is maths anyway, and one can assume that game developers know how to allocate and deallocate memory as you can't just let the framework do your cleanup if you use millions of objects that is rare in a business app. You just can't have a GC collect when doing 100 fps. And you really need 100% performance and then C# is not the best language... Sure there are many claims lately that a well written C# program is just some percent slower than C++, the problem is that a sloppy C# program is not. You leave too much in the hands of the runtime, and when tuning performance you are not in full control. And then you have the problem that most of the external libraries that you use in a game are written in C++ (like directx and speedtree) so to use them you get what is called Interop, which is when you go from managed code to unmanaged code, where managed code is the C# code where the memory is managed by the. NET runtime as opposed to the unmanaged code written in C++. And interop costs peformance when you context switch between them. It works a lot better today than in the first versions of .NET and I remember a project where we tried to use a mixed C++ / C# in 2005 where we had to ditch it and go back to unmanaged code as the memory demand increased and we lost too much performance... And in the end it was not that much faster to use C# as it was a team of experienced C++ developers.

There are many games popping up these days written in C#, mainly by small indie teams using some generic 3D engine like Unity3D, but all the bleeding edge games are written in C++... And I don't see that changing as you loose control and performance to be able to have an easier programming language...

/mazex
nice post maz thnx for the info now i know what interop means I have a question i think you would know the answer to...if i started writing a game using OPENGL but half way through decided to with just directx how difficult would that switch over be?
__________________
Gigabyte Z68
Intel 2500K (@4.3 ghz)212 CM Cooler
8GB Ram
EVGA 660SC (super clocked) 2GB Vram
CORSAIR CMPSU-750TX 750W
64 GB SSD SATA II HD
WIN7 UL 64BIT
Reply With Quote