12 Replies - 11036 Views - Last Post: 24 January 2009 - 10:50 AM Rate Topic: -----

#1 ryanzec  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-January 09

C# vs. C++ for Game Programming

Posted 13 January 2009 - 08:58 AM

I know this has probably been argued to death but I am just starting to get back interested in want to learn game programming again(been doing a lot of web development) so I am not sure if the agreeument has changed at all. A few years ago, that main thing people said against C# was the speed lost you occur for using it and the requirement on the .NET framework(or Mono Runtime libraries in using Mono).

For the runtime requirements:
Now from what I understand, Window updater included updates to the .NET Framework and basically Microsoft is integrating the .NET framework into all of their applications so if the requirement on the .NET Framework really that big of a deal anymore?

For the speed degrade:
How big is this really? I am not looking to build the next Unreal Engine or a game engine that will power the next PC version of GTA, I would be happy with a game engine that would be able to produce graphics like we would have seen in the Mythos game if it was ever finished(for screen shots, take a look here: http://media.pc.ign....58/imgs_1.html). Now I know I am going to have to battle my technical skills to get something like that and I improve my skill but I don't want to have to battle the language(that is something I cannot improve). So are those quality of graphics possible with a complete C# Game Engine(and possible use of C++/ASM .dll files for stuff like math and physics and what not) while still getting a good frame rate? Also from what I hear (correct me if I am wrong) more and more code for graphics are being pushed to the graphics card itself so that seems like it would also help with the speed issue. Also is using Mono/Tao Framework vs. .NET/XNA add even more to the performance loss to the equation?

Another thing I am also curious about is portability. Now I know if I use C# with .NET and XNA, I will be limited to Windows/Xbox 360. I also know that if I used Mono/Tao Framework instead, that should work on Windows/Linux/MacOS. Do you think that any of these technologies are going to become compatible with PS3/Wii/Future Consoles because if there is no chance that C# with .NET/XNA or Mono/Tao Framework will work on consoles(besides .NET/XNA working on Xbox 360) that would also be something for me to consider as I except all platform and console to continue to support C++ for a while.
Answers to these questions or links to articles that are recent(no older than 6 months) that answer these questions would be great. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: C# vs. C++ for Game Programming

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4422
  • View blog
  • Posts: 12,289
  • Joined: 18-April 07

Re: C# vs. C++ for Game Programming

Posted 13 January 2009 - 10:51 AM

Well the speed difference between the two is going to be significant enough for you especially if you are looking at developing a graphic engine like on the scale of unreal or GTA. The reason is overhead of framework function calls and some of the objects are carrying around extra functionality that you are not using. This makes them bulky and eat up ram when not necessary. So as for speed in this situation C++ is your hands down winner. C++ can also uses memory more efficiently (given you free it up when you allocate) than C# can. C# is a bit higher level than C++ so you are carrying around extra stuff.

C++ is also much more compatible on other systems and while it is true that you can use Mono and such to run the .NET framework it can be a bit clunky to carry around the baggage of the .NET framework AND mono just to run it on another system. Again, if you are looking to streamline (which you definitely will want to for an engine) again C# loses the battle.

C# has one great advantage (and another reason I love it) is that it can mix in a little C++ if need be but also the higher level thought of development in there and a lot of implementation details (aka encapsulation or information hiding) makes developing programs like games with XNA a lot faster and you can see something not next month but next day.

So while things are growing together like you mentioned, they are still worlds apart for now. The two camps are C# with XNA or C++ with OpenGL or directX.

If I were you I would be first looking at what kind of machines you want to target, understand your target audience, and then program accordingly. Program into your audience not try to adapt your audience to your technology choices. In this situation you will have to choose between the two camps and see what you want to do. Ideally you want to keep the implementation simple enough and clean enough (documentation etc in the code) so that when they do finally merge a port between the two will much easier.

Hope that helps. :)
Was This Post Helpful? 1

#3 ryanzec  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-January 09

Re: C# vs. C++ for Game Programming

Posted 14 January 2009 - 05:09 AM

Yea, technically I am not really interested in the low level programming, while it would be interesting to learn, I am really more interested in creating a games. I am also only really interested in programming for windows. It would be nice to develop for Linux/Mac but chances are it would not be worth the time and I don't have the money to even be able to program for any consoles. I am not looking to create the Next MMO or the Next GTA(in terms of graphics), like I said I am looking to create a game like Mythos which the graphics from the links in my original post(http://media.pc.ign.com/media/869/869458/imgs_1.html). Basically the game I have always wanted to create a RPG with a Diablo like combat system but a different character progression system. It would be nice if I could use C# as we are moving to use C# at my work(of course using it with ASP.NET for Web Development) and it would be nice if I could use the language for both profession and personal reasons, it could help me pickup the language faster and become better with it faster. Knowing all this, are there any game engines that people would recommend?
Was This Post Helpful? 0
  • +
  • -

#4 stayscrisp  Icon User is online

  • フカユ
  • member icon

Reputation: 1010
  • View blog
  • Posts: 4,214
  • Joined: 14-February 08

Re: C# vs. C++ for Game Programming

Posted 14 January 2009 - 06:10 AM

you could try the jad engine
www.jadengine.com

but i dont know if it is any good or if it is just a graphics engine, but it is built in .Net

:^:
Was This Post Helpful? 0
  • +
  • -

#5 SigurdSuhm  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 111
  • Joined: 05-August 08

Re: C# vs. C++ for Game Programming

Posted 14 January 2009 - 03:21 PM

Well if you're going for C# I suggest that you use the XNA Framework. In my opinion it's the best game programming choice for C# at the moment. While not being an engine it's very easy to learn and has (like C#) an extremely fast and efficient workflow. So creating your own Game Engine along the way shouldn't be that hard and it could also be a great way to learn more.

Currently I'm working on an engine for a 3D RPG and it's a lot of fun to be honest. The framework has a lot to offer as long as you have a good understanding of C# to back it up with. And the online community and resources are a great help. Also the framework is constantly being improved. As of now running with version 3.0. It more or less took over from Managed DirectX which is no longer being improved.
Was This Post Helpful? 0
  • +
  • -

#6 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: C# vs. C++ for Game Programming

Posted 14 January 2009 - 04:14 PM

Another nice thing about XNA is you can also makes games for the Xbox 360 and the Zune.
Was This Post Helpful? 0
  • +
  • -

#7 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: C# vs. C++ for Game Programming

Posted 15 January 2009 - 09:53 PM

AFAIK you have to pay a fee to publish on Live.
Was This Post Helpful? 0
  • +
  • -

#8 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: C# vs. C++ for Game Programming

Posted 15 January 2009 - 10:46 PM

You do. $99/yr for access to Creator's Club. There's a free subscription via Dreamspark that lets you develop Xbox games, but it's limited in that you can't upload to Live and publish your game.
Was This Post Helpful? 0
  • +
  • -

#9 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4422
  • View blog
  • Posts: 12,289
  • Joined: 18-April 07

Re: C# vs. C++ for Game Programming

Posted 15 January 2009 - 10:57 PM

View Postryanzec, on 14 Jan, 2009 - 04:09 AM, said:

Yea, technically I am not really interested in the low level programming, while it would be interesting to learn, I am really more interested in creating a games. I am also only really interested in programming for windows. It would be nice to develop for Linux/Mac but chances are it would not be worth the time and I don't have the money to even be able to program for any consoles. I am not looking to create the Next MMO or the Next GTA(in terms of graphics), like I said I am looking to create a game like Mythos which the graphics from the links in my original post(http://media.pc.ign.com/media/869/869458/imgs_1.html). Basically the game I have always wanted to create a RPG with a Diablo like combat system but a different character progression system. It would be nice if I could use C# as we are moving to use C# at my work(of course using it with ASP.NET for Web Development) and it would be nice if I could use the language for both profession and personal reasons, it could help me pickup the language faster and become better with it faster. Knowing all this, are there any game engines that people would recommend?



I recommended C++ for speed because you said you were interested in building an engine and game engines are done using a lower level language like C++! If you just want to build a game and build it quick, C# and XNA as the others said. Just don't expect it to be high performance like a C++ implementation would be but it works fine for game development on windows.

And if you were interested in designing only for windows, why mention mono? Just develop on windows, use .NET, use XNA develop for 360 and be merry. Not much to think about in this case.

;)
Was This Post Helpful? 0
  • +
  • -

#10 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 790
  • View blog
  • Posts: 7,623
  • Joined: 05-May 05

Re: C# vs. C++ for Game Programming

Posted 21 January 2009 - 06:18 PM

The idea of using C# for games makes me very ill (it being stuck on Windows and all). Once my game engine is done, it should, by design, be quick for making the actual game using the tools I have. Having an open platform engine is amazing.

The engine itself is taking me very little time to write in C and was fun to play around with (I'm lazy and only work on it some days at a time). But then why stop at C? I'm writing my map editor in JAVA! I hate writing tools so I picked a language for faster development since tile maps are just one part of my engine.

What I'm telling you is, the core engine is best written in C (and for complex games use C++) and you can actually use #ifdef WIN32 to section out stupid Microsoft specific fixes like sprintf_s and for device-specific ASM optimizations. A faster game engine is always better because technology gets better, and you will want to add and upgrade stuff which is much easier in C.

But! That is not the best language for writing games! Really great games are made from toolkits. The engine may be written in C but the tools are all written in any language you see fit. You're using your tools to make all the data to the game and making it FAST! Using multiple languages to compose the game engine and everything you need to make the kinds of games it can support is the middle optimization between shortening development time and maximizing game power.

So, YES! is my answer~! Not only do you have way too many languages at your disposal to pass up but you should also invent your own languages to describe your game world and cut out cumbersome coding tasks- for example RPG Maker 2000 has it's own very very simple language for writing stories.
Was This Post Helpful? 0
  • +
  • -

#11 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: C# vs. C++ for Game Programming

Posted 21 January 2009 - 06:28 PM

View PostWolfCoder, on 21 Jan, 2009 - 05:18 PM, said:

The idea of using C# for games makes me very ill (it being stuck on Windows and all).


I am extensively using XNA and can say that it has enough features to build professional games. So what if it will be only for Windows? How many massively used games are currently developed for something else than Windows and next generation consoles? Personally for me developing the game only for Windows and Xbox 360 is currently not a big issue.

And XNA is excellent for a beginner. As it provides built-in functionalities for graphics and multimedia, it is much easier to use, compared to C++, at the starter level.

Speaking about the Creator's Club subscription for XNA, I am currently using the one provided by DreamSpark. It only lets you debug and deploy applications on Xbox 360. At the starter level, you don't need to publish your games on Xbox Live Marketplace. The trial 12-month subscription provided by DreamSpark is more than enough, so if you will feel comfortable with XNA after a year and you will develop games that people will most likely buy, then you can buy a $99 subscription.
Was This Post Helpful? 0
  • +
  • -

#12 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 790
  • View blog
  • Posts: 7,623
  • Joined: 05-May 05

Re: C# vs. C++ for Game Programming

Posted 24 January 2009 - 12:59 AM

View PostWolfCoder, on 21 Jan, 2009 - 05:18 PM, said:

The idea of using C# for games makes me very ill (it being stuck on Windows and all).


Being windows specific is just the surface of this smelly mess.
Was This Post Helpful? 0
  • +
  • -

#13 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: C# vs. C++ for Game Programming

Posted 24 January 2009 - 10:50 AM

View PostWolfCoder, on 24 Jan, 2009 - 12:59 AM, said:

View PostWolfCoder, on 21 Jan, 2009 - 05:18 PM, said:

The idea of using C# for games makes me very ill (it being stuck on Windows and all).


Being windows specific is just the surface of this smelly mess.

Can you elaborate?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1