c++ or c#

Started by
49 comments, last by Antheus 16 years, 2 months ago
ok, in the field of game programming, what is better or more used, c# or c++?
Advertisement
Industry standard is C++, but there's no reason by C# isn't a valid choice as well.
ok then that settles it, i am gonna stick with c++
I notice a lot of threads on here about what programming language to use for games. I think the question is sort of back to front.

What I mean is that it really depends on the graphics or game engine you want to use. Especially if you're not already deeply into a particular language.

Like some engines won't run on C# but are built for C++. Others use Python or their own scripting language. Test a few and see which environment suits your style of game development then go with the underlying code base.

For example some developers love drag and drop GUI engines with script generators etc. Personally I like to code everything so I have total control so I prefer a SDK with C++. If I was clever enough I'd write everything myself direct to the Direct X SDK but I'm not that clever.

In the old days when hardware was expensive the "real" game programmers wrote strictly in C and dropped into assembly where ever possible for sheer speed and a minimal use of memory. Those days are long gone though so you don't need to worry about that anymore.

m0ng00se
Where I work, I use both C++ and C# on a daily basis. The game is all C++, but many of the tools and infrastructure are C#. This is getting increasingly common in the professional arena.

In the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
It's true that C++ is the industry standard, but that doesn't mean it's the best language for you. Most of the reasons C++ is standard is due to legacy code and legacy programmers, not that it's somehow a superior language in and of itself (it isn't).

Here's my advice: If you use C++ you'll spend a large portion of your time doing book-keeping and tracking down really messy bugs - tedious stuff that has nothing to do with what you're trying to accomplish. If you want to learn about games I think your time will be better spent actually doing useful stuff and learning from it, rather than wrestling with a legacy language. Use the language that let's you get the most work done in the shortest amount of time.
Plus XNA is C#, and that's probably one of the best platforms to get experience making games right now.
This is the same argument that has gone on for 10 years now with numerous variations. As I said before, the total opposite is actually true in regards to "professional" game development.

People use C# because it's easier not better. People use C++ because it's easier not better than C. The big professional game houses still employ "real" programmers to write fast pure C that drops into assembly for real graphics intensive stuff. Anything that can write direct to the video and direct to the CPU is faster and handles memory better. A game written direct to Direct X will out perform anything done in a higher level language.

It's no accident that Windows is written in C++ (with some libraries still in pure C), most SDKs are in C++ or C. most widgets are in C++ or C and almost all direct hardware API's are in C++ or C that drops into assembly. Most very fast huge industry EPROM's use C as a wrapper for assembly.

Any higher level language such as C# is not "better" at all. It's easier that's all but it's also slower and more bloated and it protects the API too much.

Old School programmers believe that MS is deliberately leading programmers away from accessing the API directly because MS is the most "hackable" operating system on the planet.

It's true that XNA is where it's at so pretty soon the industry will be flooded with C# programmers (as happened when VB was "the" new high level language) and suddenly the industry will be looking for programmers that still know how to cut through all the bloat and directly access the API.

Just because something is hard to learn properly doesn't mean it's no good.

m0ng00se
For my current game I decided to go with C# using XNA for the main reason that I want to make a game, and not be bogged down with having to write "tedious" components such as resource managers, since a lot of that is done for you. I do still like to experiment with things like that and when I do, I use C++. In my eyes, for games, C# should be used if you're aiming to just make a game, and C++ should be used for more serious projects or if you have more time to dedicate to it.
Quote:Original post by Promit
In the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.


There are valid reasons to use C++. Though Mono and Tao are quite good, C++ still has the upper hand for most things on non-Windows platforms. Downloading or installing the .NET framework may be too much overhead or might be infeasible for your target audience. But in general, I agree. Certainly the reasoning that "C++ is the 'industry standard'" is no reason to use C++ over C#.

Oh, and why did you stop considering Python, OP? It's a very nice language, but you seem to have dropped yesterday's thread about it in favor of C++ vs. C#. Either C# or Python would be a better choice than C++, IMO.
C# is a good language to break into game development with. It does a lot of the behind-the-scenes stuff for you so that you can concentrate on learning what a game is, what it's comprised of, and how the game development cycle progresses.

Once you've gotten a grasp on how developing, maintaining, and patching a personal game works, you can move on to learning C++ and sinking your teeth into the industry's way of handling everything.

This topic is closed to new replies.

Advertisement