views:

974

answers:

18

I've basic game programming knowledge in c and c++. I'm learning c# nowadays. If I want to make a career in console games programming, which one I should use to proceed? I've noticed that a lot of game companies are using C++/C (probably because of legacy reasons). Also probably C++ enjoys more number of supported libraries? In which languages modern game engines(unreal/crysis etc) are written in?

This thread suggests to use c# in the beginning and later c++. Would in future C++ maintain its spot in games industry?

Keeping all those points in mind, which language would be a better bet? and why?

+5  A: 

There is no one language that is a "better bet." Use the language most appropriate for what you need to do, whether it is game programming or any other domain. C++ isn't going away anytime soon.

If you're not developing for a Microsoft platform, I doubt you'll use C#.

While I hate to get into a language war, there's no doubt that certain languages are better or worse for certain applications. For game programming, I'm willing to say that both C++ and C# are better bets than COBOL, and currently it looks to me like C++ is a better bet than C#.
David Thornley
Fine. **ALL GAMES SHOULD BE WRITTEN IN C++**... There. Is that what we're looking for? Keep the downvotes coming please.
@David: although it is purely subjective.
dboarman
LOL at your comment, StingRay.
Judah Himango
sympathy upvote
Frank Schwieterman
@STingRaySC: If no languages are a better bet than others, let's change it: ALL GAMES SHOULD BE WRITTEN IN COBOL. That should get a few downvotes.
David Thornley
@dboarman: Are you saying that there are no objective reasons to use C++ or C# for game programming, rather than COBOL? Or that the use of C++ vs. C# is necessarily subjective? While I hate to say that one language is objectively better than another in general, there are often strong and objective reasons to use one language, or one of a small number, under certain circumstances.
David Thornley
@David Thornley: The whole point to my answer was to rebel against the over-simplified view of *always use C++*, or more generically *always use X*. I hate the word *always*. The question was asked very generically about gaming from a clearly inexperienced person. What language should be used is not a trivial decision, and it depends on many factors. I understand that C/C++ have their foothold in this domain, and it is not hard to understand why. However, there are many many games created using many other technologies.
@David: no, not at all...I was being sarcastic. This thread will be in discussion until everyone is tired of talking about it. Hence, my subjective remark. My post included a link to stats for C# and clearly no one has bothered to comment on that. But I did agree with most of what you said...until the *C++ is a better bet than C#*. ;)
dboarman
@STingRaySC: that's my point, too...yeah I'm gonna support the decision to try C# - and provide some definitive reasons for my choice (as I did in my post...below, in the unpopular section). But to insist that C++ is *the gold standard*, or that C++ *is* the only way is...well, restrictive and inviting stagnation.
dboarman
What I said is that C# and C++ are better than COBOL for video game programming, and I think I can come up with objective reasons if I have to. I also expressed a current preference in thoroughly subjective terms. I dislike language chauvinism, but I also believe that there are meaningful differences in languages that make them more or less suited to particular activities. If anybody does believe in complete subjectivity, I've got a challenge: there are open source COBOL compilers, and it's not a difficult language to learn. Write your own video game in COBOL, then report back.
David Thornley
+22  A: 

C++, for two reasons.

1) a lot of games are programmed in C++. No mainstream game is, as yet, programmed in a managed language.

2) C++ is as hard as it gets. You have to master manual memory management and generally no bounds checking (beyond the excellent Valgrind!). If you master C++, you will find this transferable to managed procedural languages. Less so the other way around.

C++ has a level of complexity close to APL! You'll never get better by playing weaker opponents.

Joel makes a very strong point about this. People who understand how the machine works make better programmers, because all abstractions are leaky.

Will
As to your first point, Civilization IV was programmed in Python which is a managed language.
Jeff Hornby
@Jeff hmm, it can use python for a rules engine. Most game engines support scripting engines; Lua is, I think, the most popular. But it doesn't mean the engine itself is written in script.
Will
I can see all the C++ votes will go here... ;)point #2 is a valid reason for learning C++ but it doesn't support point #1, nor does it support the assumption that C++ engines will outperform C# engines. There are no 'mainstream' C# engines (except possibly Unity is C# ??) because of the assumption that a C++ engine will naturally outperform a C# engine. :)
dboarman
yeap, (1) is about the job market, (2) is about learning; there's not a lot of support between them, so there's two separate points
Will
Well theres also Unity3d for iPhone/Wii games, and it can be programmed in either Jscript or C# (well a variation of mono to be exact..)
Francisco Noriega
Unity is scriptable with Boo...and if I'm not mistaken written in C#.
dboarman
Stretches "mainstream" a bit though?
Will
What, that Unity could be considered 'mainstream'? I don't think so. You don't get to be able to do all of this: http://unity3d.com/unity/ ....and not at least be given a shot at being considered mainstream
dboarman
XNA runs xbox360, pc, AND zune. also, there is mono touch, and unity. so, unless you are going to be writing a fairly performance intensive game, you could go the c# route.
Darren Kopp
@dboarman: It is not an "assumption" that C++ will outperform C#. It is a fact. The whole advantage of managed code is that you don't need to worry about how memory is allocated. But console game developers *do* need to worry about precisely that. So they need the kind of control that C++ offers.
Porculus
@Porculus: I guess that's why .Net and XNA are so popular. Because we don't worry about memory allocation, we spend less time debugging and optimizing - and more time producing. ;)
dboarman
Crash Bandicoot was written in a lisp dialect, another managed language mainstream game. C++ is not C, it has a different set of abstractions so you might as well say Joel was talking about C# ( which has pointers and manual memory management when you need them ).
Pete Kirkham
@Porculus: It is NOT fact. I've done extensive testing in the area of file I/O and I've seen C# outperform C++ AND C (using C Std Lib). Yes there are areas in which native code will outperform, but MS is optimizing their OS for .NET and not native APIs. You'll soon see managed code surpass native performance, because native performance is now stagnant. Don't forget too that JIT compilers can perform optimizations that native compilers never can...
This is crazy. There are exciting games that are scripted in managed languages. That chunks of the actual heavy lifting code, like say DirectX, would be written in a managed language should they be written from scratch today, is, however, massively unlikely. And this discussion about C# being better than C++ from a *technical* perspective is something I avoided answering in my question, because the *learning* and *employability* aspects are what dominate.
Will
Crashworks
Civilization 4 also used Flash via Scaleform for the UI stuff, with ActionScript in there (http://en.wikipedia.org/wiki/Scaleform).
Chris Dennett
A: 

I think that C++.

Because c# needs additional instalation for C# runtime which only absorbs space on a disk. And C# is of course a bit slower.

oneat
"And C# is of course a bit slower." -- a dangerous statement!
An equally dangerous statement is the concern about disk space in 2010.
Woot4Moo
The speed difference in *many* regards is quite neglibile. +1
dboarman
+1 to the HD space concerns...
dboarman
To those who say the speed difference is neglibile, keep in mind we're talking about game programming, where you generally need every ounce of performance. I'd say C++ is a better choice for this application.
Josh
The better choice is assembler :)
oneat
The better choice is raw binary - or better yet, hard-wired circuitry for your game logic... Clearly...
Erik Forbes
+1 at Erik: I guess hard-wiring is our definitive answer - way to go... ;)
dboarman
Not every game is a resource hog that needs "every ounce of performance". Also, take a look at XNA.
Foole
@dboarman: Rats! Prevented from game programming until I improve my soldering skills!
David Thornley
@David: lol...you could always breadboard it... ;)
dboarman
+2  A: 

You won't find C# running on any consoles, so it's useless in that regard.

If you are learning programming, C# offers a softer learning curve than C++, but you can write C++ without getting into the more scary and complex areas of the language, so it's not really much more difficult.

If you want to program with graphics or other "gamesey" things, then C# is a pretty poor choice - go for C++ with OpenGL or DirectX.

edit

Ultimately, if you want a career in games, go for C++. You may be able to write game code in C#, but realistically you won't find nearly as many career opportunities using C# as you do with C++. Unless you want to become a game tools programmer, in which case C# is much better than C++ because you can get a lot more functionality working in a lot less time. A lot of games companies are switching to C# for as much tools dev as possible.

Of course, if you can handle the workload, the best way is to learn both languages, and apply "the best tool for the job". As they're so similar, it's really not difficult to learn one when you've learned the other. (Really most of the learning curve moving from C++ to C# is .net and LINQ etc rather than the core C# language per se - an awful lot of it is nearly identical, with just a few bits of syntactical sugar here and there)

Jason Williams
You will indeed find .NET (hence C#) running on XBOX 360.
Yeah...somebody deleted the XNA reference, don't know why.
flq
C# is going to get beat up in here... ;) oh well, I love the language and wouldn't change for anything. I learned assembly and enough C++ to know what my fellow programmers were talking about back in the day when I was a VB6 dev...if you wanna call it that.
dboarman
You'll actually find C# running on the Wii and iPhone as well: http://unity3d.com/unity/features/scripting
RAOF
I didn't realise c# was supported on Xbox now. The question is about consoles, so I didn't consider Phones, Linux, Windows. You can also install Linux on a PS3 and run Mono on it, but I didn't think that really was in the spirit of the question. I'll edit out the "no C#" bit as it's wrong. (P.S. I love C# and .net, despite years of being a happy C++ developer, so I'm not bashing C# in any way)
Jason Williams
A: 

Its always a hard one to say because they were using assembly up until 1993, NBA Jam if anyone remembers that bad boy. Technology is constantly trending so its very difficult to say where it will go, I would recommend learning C and getting a very firm grasp on that then move onto C++. I will say this as a caution if you enjoy playing games you will not enjoy coding games.

Woot4Moo
Why would you not enjoy programming games if you like playing them?
Partial
When this question was initially posed it made it seem as though he was debating a professional career in game programming. Often times people don't understand everything that goes into making a game so they think its all the flashy stuff that they see as the end result.
Woot4Moo
@Woot4Moo: What I mean is that it is not a fact that people that love playing video games will dislike programming them.
Partial
right I agree Partial
Woot4Moo
+2  A: 

C++ with win32/GDI is relatively easy to get going, but far more difficult than say Flash or Python (pygame) - however, by using C++ you'll learn a lot in the process and be well poised to continue advancing your career as a game developer. You can also look into XNA if you want to program to the xbox360.

I took some classes at Game Institute (GI) and learned a lot about C++, win32 API and DirectX.

Mr-sk
+1  A: 

C++.

It is the gold standard for AAA game programming. If you need to do something interesting, you will need to do C++ or delve into unmanaged C#(not always nice).

C++ is also arguably faster(usual caveats apply).

As a learning experience, C# is not worth it. C++ is unquestionably better, especially in the quasi-embedded world of consoles. To get the object-oriented experience, go towards Java.

Paul Nathan
Java and C# are pretty much alike in terms of OOP. The only difference is that Java can be used on many more platforms than C#.
Partial
@Partial: Well, Java's always seemed quite a bit more pure OO to me. And Java platforms for gaming are, what, cell phones? (I'm not certain...).
Paul Nathan
@Paul Nathan: Java is probably used more for academic reasons or scientific reasons than gaming. It is used on cellphones because of the fact that it can easily be ported to different machines (there are many cellphones out there). What makes Java a more OOP language than C# for you?
Partial
+1  A: 

To tell the truth...you have to make the decision as to which is the better language. I know what I can do with C#. I know what can be done in C++. C# isn't made to do what C++ was made to do...write code at the most basic level and still be somewhat meaningful when read by human eyes.

We are developing a game engine with C#, DirectX...is it a challenge? hell yeah...but it's something we chose to do. We are looking at some performance levels that are very close to what C++ can give. So, I see no problems with this effort.

To cross-platform development, if it weren't for .Net, we might not have the Mono platform. The Mono platform has broadened our platform base.

Here is some support to my arguments...

dboarman
-1: The goal is to be able to develop games on consoles. You will only be able to do certain things with the Xbox 360 with C#. With C++ you widen up the horizon from the Xbox360 to the PS3, Wii, PSP, DS/DSi, etc. Even if C# can now be used on Unix based operating systems, it doesn't mean that you will have as much support (documentation and help) as C++ has to offer for them.
Partial
So because I tell the OP *...you have to make the decision* and point out the cross-platform ability because of Mono, I'm getting down-voted. Lets not try to make anything because a language is new and documentation is not as easy to find; lets stick with the old just because it *has* been the standard. I certainly didn't say C# was better for this than C++. C#, however, does have a friendly learning curve, is making speed improvements, and documentation is improving...so I don't agree with your point.
dboarman
No I down-voted you because the OP asked about which language is better for the consoles. C# can only be used on the Xbox 360 while C++ can be used on the Xbox 360 and the other consoles I enumerated in my previous comment. Is there really that much support for game development on consoles other than the Xbox 360 and maybe the Wii?
Partial
C# (with Mono) can be used on PS3. Documentation may be sparse; however, documentation never grows overnight, it wasn't there in the beginning when a lonely C++ programmer started writing for the first console I'm sure (whatever console that was). As the interest, performance, and productivity with C# increases, so shall the documentation. That is the nature of things.
dboarman
+1  A: 

It really depends on what type of game you're planning on building: many games could be done in a language like C#. That being said, the majority of game development is done in C++ just becasue the majority of game development needs to eke out every last bit of performance that the platform can provide and that means either C, C++ or (shudder) assembler.

Jeff Hornby
...and because C++ is used on more platforms than C# :P
Partial
A: 

If you knew C# and XNA, you could make some sample games in a pretty straight forward manner, which might help to break into the field.

My guess is, the core gaming engines are written in C++, but some of the other code around the core could be in C#.

alchemical
dboarman
+1  A: 

Look at it like this - while you can write a game in C#, it isn't going to open many career doors for you. If you know C++ and Lua, then you're going to be far more employable.

You're also not just talking about PC desktops and Consoles, games nowadays are very much for the mobile devices, so only knowing C# would limit you even further. Sure, C++ isn't going to be the optimal choice for writing iPhone apps, but you're going to be far closer to being an objective-C programmer if you know C++ than if you know C#.

Games devs use C++ not for legacy reasons (though having establish C++ engines and libraries helps) but for performance and experience. Game devs know C++, it works for them very well, so there's no need to change. Its not like line-of-business apps (on Windows) where the developer mindshare moves with the current Microsoft tools.

gbjbaanb
+8  A: 

Ok here is my two cents.

If you are planning to seriously get into the game industry I recommend you learn both languages. Starting off with C++ then moving into a managed language like C#. C++ has it's advantages over C#, but C# also has advantages over C++.

Personally I prefer C# over C++ any day. This is because many reasons:, just a few:

  1. C# makes programming fun again ;).
  2. It's managed code helps me complete complex tasks easily and not forget safety.
  3. C#s' is pure OOP, forcing rules in your code that helps keep your code more readable, 'maintainable' and execution is more stable. Productivity rate surpasses C++ by at least 10%, the best C++ programmer could be an even better C# programmer.
  4. This isn't really a reason, more like something 'I' like about C#: LINQ.

Now...there are many things that I miss about C++. I miss being able to (completely) manage my own memory. I can't tell you how many times I caught myself trying to 'delete' an instance/reference. Another thing I dislike about C# is the inability to use multiple-inheritance, but then again it has forced me to think more about how to structure my code.

There has been more discussions on this topic than there are stars in the known universe and they all close at a dead end. Neither language is better than the other and refusing either one for the other will just hurt you in the long run. Times change and so do the standards for computer programming.

Whatever language you choose to keep at the top of your list, always keep your options open and don't set your mind to any one single language. You say you already know C++, why not learn C#, it can't hurt and I 'promise' you, it will make you a better C++ programmer.

qc.zackf-FissureStudios
+1: Good answer there! ;) I would point out that C++ is a multi-paradigm language which in turn allows more freedom in comparison to C# which is a strongly OOP language. Depending on the point a view, one or the other will be better because of that.
Partial
+1  A: 

C++ is the lingua franca of the console game industry. For better or worse, you must know it to be a professional console game programmer.

munificent
+1  A: 

If you want to be employed professionally as a game developer you need to know C/C++. End of story!

devilcrack
+3  A: 

I'm not going to answer the original question since most post here have. I'm going to point something out to you that you missed in your post. Simply knowing C\C++\C# isn't going to get you a career in game development. Most game studios get dozens to hundreds of applications for a simple code monkey job. What makes you stand out compared to them? What makes you a better hire than someone else who has experience making games at another studio?

If you really want a career in the games industry, even on consoles, you should make a demo of some kind that shows what you know. C++ would be great language choice to use in the demo if you're applying for a console development position. You could show off more by making a tool in C#\XNA to create the assets for your demo. You'll show the hiring managers and tech leads that you're not JUST a C++ guy or JUST a C# guy: you're a developer.

Marcus
+1: good point about being a **developer**...
dboarman
A: 

Hey, if BASIC is good enough for Gorillas, it's good enough for me.

Coderer
A: 

I believe that C++ is the language that you are looking for. The majority of game development is in C++ because it is a multi-paradigm language (OOP, meta-programming, etc.) and because it allows memory management. What makes C++ even better is that it can be used to develop on a multitude of platforms whereas C# cannot do so on such a big scale.

Many will say that with C# you will not have to worry about memory allocation and this is true at a certain price. You will have the burden of the .NET framework on your shoulders and will slowly see the limitations of C# in the way certain tasks must be done.

Probably you have read from some answers that C++ is a hard programming language. This is mostly true, but perhaps you haven't heard about C++0x. Some features found in C# such as garbage collection will become available (optional for you to use) with C++0x. Also, multi-threading will finally be supported by the language with this revision of the C++ standard.

I would recommend that you buy a few C++ books as well as C++ DirectX/OpenGL books.

Partial
+3  A: 

It depends

It depends on a lot of things - your goals, your experience, your timeframe, etc.

The majority of game programming isn't language specific. 3D math is 3D math in C# as much as it is in C++. While the APIs may be different, and different 'bookkeeping' may be required, the fundamental logic and math will remain the same.

And it's true that most AAA game engines are C++ with a scripting language on top of them. That is undeniable. However, most AAA engines also have a bunch of in-house tools supporting them, and those may be in anything - Java, C#, C++, etc.

If you want to write a game, and are an experienced developer then C++ and C# have a lot going for them. C# has less housekeeping, while C++ has more available libraries and tools. For anything highly complex, however, you'd be best off trying to use an existing engine as a starting point.

If you want to write a game, and are a new developer then don't write an engine. Use an existing engine, and mod it or use its facilities to write your game. Trust me.

If you want to learn how to write an engine, and are an experienced developer you should probably think about C++. C# is possible as well, but the amount of code and ease of integration of C++ probably puts it over the top.

If you want to learn how to write an engine, and are a new developer I'd probably recommend C#/XNA. You'll get to the game 'stuff' faster, with less headache of learning the ins and outs of C++.

If you want a job in the industry then you need to figure out what kind of job you want. A high-level language can help get a foot in the door dealing with tools and/or web development, which can lead to opportunities on actual game work. Even knowledge of scripting languages can help if you want to go for more of the game designer/scripter position. Chances are that you will not get a job working on core engine stuff immediately, as the skills required to do so are pretty high. Strong C++ development skills are always helpful, especially in real-time or networked scenarios.

AAA game engine development involves some serious brain-twisting code.

If you want to start a professional development house then you probably aren't reading this, but already know that C++ is probably the only viable answer.

If you want to do casual game development then you should probably consider Flash or a similar technology.

kyoryu