Advertisement

is c++ really a must?

Started by June 19, 2013 07:36 PM
51 comments, last by Amadeus H 11 years, 7 months ago

Hey everyone, i was wondering if c++ is really a must in game industry. Not that because i'm not able to learn it or anything like that. The thing i'm aware of is spending my time on learning language which i may not use like ever.

Today, I came across this interview which really made me thinking and really don't know what to make of that

http://harmful.cat-v.org/software/c++/I_did_it_for_you_all

The reaseon i'm not sure if i should study c++ is the possibility that i may not end up in a game industry at all (small european country, not US unfortunately)

Do you think c++ will be standard for many years to come (10-20) or will it be replaced since the hardware power is increasing so rapidly?

Another question i had is about unity and their scripting languages. Unity seems like a good starting point but which language should i script in? I build some websites from time to time, but i don't know any JS yet and i'm worried that unityscript, which is some sort of old JS (correct me if i'm wrong), will teach me some bad habits. C# seems like a much more usable not only in game programming but in other development. The problem with C# is that it's .NET based, but tha'ts just my opinion...

So anyway looking forward to any answers that could point me in the right direction

OP, that interview is satire :D

Advertisement

Setting aside the satire -- YES, knowing C++ is a must for being in the industry. Not all games are written in C++ and not all game programmers know C++, because there are many types of games and game programmers. But if we're talking about anything resembling the mainstream game industry, C++ is mandatory even if the game is not written in it. It's a core part of the relevant education and I wouldn't even think about hiring someone who is not fluent in it.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Lots of people make games in Java, Flash/ActionScript, C#/XNA, Python, JavaScript, and many other languages.

You absolutely can create games without knowing C++.

But that is not quite what you asked.


Do you think c++ will be standard for many years to come (10-20) or will it be replaced since the hardware power is increasing so rapidly?
That is a dramatically different question.

The answer is 'yes', but only for some types of games.

There are many kinds of games. Most games, from Tic Tac Toe to Farmville, do not seriously tax the hardware. They can be written in any language you like. Some games fall into a very different class of software; these games fall into the range of High Performance Computing (HPC), and they push the limits of what computer hardware can do.

Although you can write non-HPC games in any languages, your choices are very limited when it comes to HPC games. Even C++ was shunned until the mid 1990s for HPC of all sorts.

Let's consider just one aspect of modern programming languages that is a real issue in high performance computing engines: The use of virtual functions.

Many common patterns in C++ such as the common use of virtual functions, such as using virtual accessors and mutators. On today's hardware the cost of a virtual function is roughly 7 nanoseconds over the cost of a direct function call; back in 1995 the cost was around 100 nanoseconds. But how big is that in the engine?

There has only been one real comprehensive study of the costs of the language, and it was done back in '96. A paper called The Direct Cost of Virtual Function Calls in C++ studied the actual cost in several compute-intensive open source solutions, and found that the "spend a median of 5.2% of their time and 3.7% of their instructions in dispatch code." There is no evidence that the numbers have changed dramatically since then.

For non-HPC games that 5% of your compute time is not an issue, the games have compute cycles to spare. But when you are working on a high performance engine, the simple use of virtual functions that cost you a 5% performance penalty is a real concern. You can certainly use virtual functions, but you do so in cases where alternate solutions are more expensive.

This is why many game programmers, especially game optimization engineers, tend to be stuck in a "C with classes" view of C++; the cost of the feature is incompatible with high performance computing.

It is not that the feature is bad. In most cases virtual functions are great. They reduce development time and solve many real problems. But they have a cost, and if you are in the middle of a performance-critical area the cost is frequently unacceptable.

It may not seem like much, but it does add up in performance critical code. Do you want 5% more eye candy?

That is just one issue of the many issues you get in a HPC game engine. HPC engines will continue to extract every cycle they can, even turning to hand-tuned assembly in those most performance critical loops. That is the nature of the type of game.

Video game consoles, the PS4 and XBox One, are going to be the standard for the next five or more years. These consoles focus on HPC games to maximize eye candy. The core engines will continue to be "C with classes". On the PC, there will always be AAA games that push the hardware to the limit. These are HPC games. They will also continue to be "C with classes" in their core engines.

As processors become more powerful games can do more without becoming HPC games, but that does not mean that HPC games will cease to exist.

Learn programming, not languages. When you have mastered different programming paradigms (object oriented, procedural, functional, ...) it shouldn't take you too long to pick up a new language. It's mostly syntax.

Hey everyone, i was wondering if c++ is really a must in game industry. Not that because i'm not able to learn it or anything like that. The thing i'm aware of is spending my time on learning language which i may not use like ever.

Today, I came across this interview which really made me thinking and really don't know what to make of that

http://harmful.cat-v.org/software/c++/I_did_it_for_you_all

The reaseon i'm not sure if i should study c++ is the possibility that i may not end up in a game industry at all (small european country, not US unfortunately)

Do you think c++ will be standard for many years to come (10-20) or will it be replaced since the hardware power is increasing so rapidly?

Another question i had is about unity and their scripting languages. Unity seems like a good starting point but which language should i script in? I build some websites from time to time, but i don't know any JS yet and i'm worried that unityscript, which is some sort of old JS (correct me if i'm wrong), will teach me some bad habits. C# seems like a much more usable not only in game programming but in other development. The problem with C# is that it's .NET based, but tha'ts just my opinion...

So anyway looking forward to any answers that could point me in the right direction

I'm fairly certain that C++ as we know it today (C++11) will start to be replaced in less than 10 years, however it will most likely be replaced by a newer version of C++. (C++ is severely lacking both as a high level language (no good support for parallell programming for example) and as a low level language (why do we have to use non portable compiler specific intrinsics or worse, inline cpu specific assembly to execute basic SIMD instructions ?)

C++ really is like frankensteins monster, stitched together pieces from a whole bunch of different languages and paradigms where you can pick and choose which pieces you want to use (and more importantly for cutting edge game engines, what parts you are willing to pay for), it is far easier to stitch a few more pieces on the monster than it is to move millions of lines of code over to a new language so it will most likely stick around, in one form or another for a very long time.

Learning C++ is a good idea because of its popularity but its not the only language you should learn nor is it likely to be the only language you will use, do not worry about learning the "wrong" language, there is no such thing and there are valuable lessons to be learnt from using almost any language that exists.

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Advertisement

C++ is not needed, however it's a very popular language for console games and if console game development is your goal, the answer is simply - YES.

Learning C++ certainly isn't going to be an irrelevant endeavor, and what you learn is highly relevant to any other Object Oriented Language.

But certainly if you decide to learn Objective C, Java, C#, there is a wealth of conceptual knowledge of both making games and programming in general that are applicable to developing games in any language.

The question for you is... What do you want to do ? If you want to make console games, start learning C++ now.

If you want to make mobile games, you might want to learn Java, C#/Unity, Objective-C or C++.

If you want to make web based games, you might look at Javascript or Flash/Actionscript.

I also agree with what one poster said, learn "programming". Once you have learned one object oriented language, picking up another is not nearly as intensive as learning the first.


Do you think c++ will be standard for many years to come (10-20) or will it be replaced since the hardware power is increasing so rapidly?

Hardware power isn't actually increasing that rapidly. Certainly not for consoles anyway. If we look at the last few generations:

the gap between the ps1 and ps2/xbox was massive

between ps2/xbox and ps3/xbox 360 less so

and even less so again between current gen (ps3/360) and "next gen" (ps4/xbone).

Basically it's a law of diminishing returns.

So yeah, C++ will still be required for AAA titles (at least until something better becomes more common).

But as previously pointed out, you can still happily make games with plenty of other languages.

Besides, knowing C++ is only half the battle. I'm a pretty fair C++ programmer (have worked professionally with it for over a decade), but I know very little about programming a games engine. There's learning about 3d math, component systems, etc.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight


The thing i'm aware of is spending my time on learning language which i may not use like ever.

You will use the knowledge you learned in C++ in other things. Don't assume that learning C++ only applies to C++. You will surprised how much of the little things can be applicable to other languages. Identifying performance issues, ambiguous syntax, memory allocations, are some of the FUN things that you learn in C++.

Why does this question keep getting asked? Is there some organisation out there determined to discourage everyone programming games in a different language OR are people just not using the search function?

This topic is closed to new replies.

Advertisement