Game Programing. C++ or C# ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #1

    Game Programing. C++ or C# ?

    Hi.

    I'm designing a 3D game with DirectX and thats all good, except I'm not sure wether to write it in C# or C++.

    C# is obviously much easier to write, since the syntax is so much simpler than C++ syntax. Also Visual Studio offers much better tools for C# than C++.

    Then again C# is managed code and I've read claims that ppl have seen up to 50% drop in framerates porting to C#, tho I'm sure a majority of that drop is the developers fault rather than the C# compiler's.

    Others claim that the managed compilers can increase performance, that well written C# code would infact out-perform well written C++ code.

    Also, DirectX is available in a managed version for .Net, as opposed to the overly capitalized, unclear mess that it is in C++.

    Any thoughts?
  • gasfusion
    New Member
    • Sep 2006
    • 59

    #2
    I'd write it in C++ just because C# requires the .net framework and all that other stuff to get it going. Look at the load time for an average C# application. I have a 40k program which loads for nearly 20 seconds just because it in turn loads the .net environment objects every time you start it. C# is powerful but damn slow (at least now). I'd do it in C++. At least you'll know it's going to be portable. Besides, there is a game dev. class at my university and there is a group of people who showed me their final project. it was almost a full-blown 3D action game. Not as detailed as what's out there on the market of course, but i saw what an amazing thing they've accomplished with C++.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Are you going to run the game on a web page?

      If so, C# will be the better choice. Most likely your C++ code on a web page will have to be a COM object and those are slower than C#.

      Comment

      • hollingsworthd
        New Member
        • Apr 2007
        • 6

        #4
        Most 3D game programmers would probably write a 3D game in C++

        There's nothing wrong with C#, but the reason it's simpler to use is because Microsoft sacrificed efficiency for ease. C# is analogous to Java, and most Java games are not 3D, they're cell-phone games.

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Thank you guys for the input.

          The game I'm designing would be a windows application, not on a web page.

          I've been testing this myself, created an exctemely simple test app in both C# and C++. It loads the same model with all the same textures and a single light.

          The difference is so minor it was almost not noticable. The most noticable is that the C++ app shot up to 100% CPU usage every now and then, and the C# app's memory usage was rising most of the time, then it would drop, but then start climbing again.
          (I'm talking like 13kb - 16kb while the C++ app is steady at 14,5kb)

          The main difference for me would probbly be that the C# app took me like an hour to write without ever having to open any refrence book or google or anything.
          The C++ app took most of the day to write, and that time was mostly spent on msdn and in refrence books an pages looking up object names and mehods.

          I'm leaning towards C# at the moment, mainly because it is easier to write and debug, which would give me more time to extend and improve the game.

          So thanks guys, im of to code something!

          Comment

          Working...