Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gaming with c++ or c#? [closed]

Tags:

c++

c#

What is the best language for programming a game project and why?

Why is the game programing world dominated by c++?

like image 394
Sherif Avatar asked May 31 '09 06:05

Sherif


People also ask

Is C good for gaming?

C++ C++ is the foundation of most major console and Microsoft Windows games. It's an object-oriented programming (OOP) language, meaning it organizes code into self-contained, reusable units. Those objects are designed to be reusable and movable, so you can code complex games without building everything from scratch.

Are games coded in C or C++?

C++ plays an important role in today's game development ecosystem. C++ is used in the source code of many major game engines, such as Unreal and Unity, allowing developers to build more high-performant games. Let's see why C++ is a better programming language for game development.

Which game engine uses C?

Unreal Engine primarily uses C++. It is free to use Unreal Engine, but if you sell your games, the creators of Unreal Engine will keep 5% of your profits. Check out some popular games made with Unreal Engine.

Why are games written in C and not C++?

Game programmers often ignore exceptions' existence, and even disable them on the compiler. Modern compilers have zero- overhead exceptions (that is, you only pay th cost for them when you actually use them). C is simpler to learn all the rules of. C++ is a very big, complex language.


2 Answers

This is kind of a difficult question to answer. For the most part, C++ is a "better" language for programming games in that it gives you so much direct control over memory management that you have more options to fine tune your performance. That, along with the fact that C++ has been around ages longer than C#, have lead to its current dominance in the game industry.

However, these days, with the .NET platform and C# becoming so much more mature, its not easy to rule it out as a very strong contender in the game programming arena. I think this is especially true for the near future, as .NET 4.0 and C# 4.0 will bring in a whole new era of multi-threaded and concurrent programming that could bring some massive performance gains to their platform. With multicore CPU's taking the desktop computing world by storm, and massively-cored CPU's only a short step behind .NET/C# 4.0, I think the ease of developing multi-threaded applications with .NET and C# 4.0 will give C++ a run for its money.

In the end, it will entirely depend upon how much control you think you need over memory management, and whether that control is worth the effort in the arena of massively parallel games. If you need that control, and think you can deal with the effort of writing a highly parallel game in C++, then you'll probably gain something from it. Otherwise, I would say C# 4.0 would be the better option.


2011 Update:

It should probably be noted that, now two years on from when I originally wrote this, Silverlight games, particularly Silverlight on Windows Phone 7, have become a large and rapidly growing platform upon which games, often quite advanced games, are being developed. Gaming on WP7 has exploded since the platform first launched in Nov. 2010, and already WP7 has more games developed for it than competing platforms. Given the ubiquity of mobile devices and the popularity of playing games on them, I think that is a strong indication of C#'s power and capability as a game development language. Quite a few WP7 games are fully 3D, graphics intensive games.

like image 198
jrista Avatar answered Sep 30 '22 11:09

jrista


For commercial / bigger game projects, C++ is probably the best option. However, if you're thinking of doing smaller, indie type games, there's nothing stopping you going with C# or even Java.

I've done several small games with C++, and one with C# using the XNA Framework, mostly for curiosity. Currently I'm working on a platformer game using Java and LWJGL (Lightweight Java Game Library). And guess what? It's working absolutely fine, plus I get cross-platform compatibility practically for free! The reason I started this project with Java was to see if I could create a nice OpenGL-accelerated game using Java instead of C++ I've normally used. So far it's working very nicely for me, I was really suprised actually. =) To be honest I've become a bit tired with C++, coding in Java feels much more productive for me currently (big thanks goes to Eclipse IDE!).

So, for smaller games you can definitely have success with Java or C#, no need to bother with C++, unless you're doing something that needs 100% of the possible performance. XNA might be the easiest option to get started with, although as for myself I most probably won't be using it again since it's basically Windows only (plus Xbox 360)..

like image 40
MH114 Avatar answered Sep 30 '22 10:09

MH114