• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
stein102

Why is C++ the industry standard?

38 posts in this topic

I've seen a billion C++ vs. X-Language posts and the answer is always, whatever you prefer to code in is the better language. But what I want to know is; why is C++ the industry standard for game programming? Almost every reputable game company uses C++ for their games. What is so special about C++? I've never gone too deep in C++, I've picked up the book [i]Accelerated C++, [/i]but I just can't seem to get the hang of it and I've always gone back to Java. Now I'm thinking of trying another C++ book, but that's getting off topic.

Thanks.
2

Share this post


Link to post
Share on other sites
Because it works on all the platforms a game studio needs to target. Specifically: Xbox 360, PS3, and sometimes PC.

Its not a matter of a "want" to use C++, but a matter of "what is required to operate on this platform?"

That being said, indie developers can use XNA to target the Xbox 360 platform, with limitations of course. Edited by Washu
2

Share this post


Link to post
Share on other sites
Another common reason is for performance.
For some things, c++ can be faster than another language. That said, this isn't as good of a reason these days what with a lot of people being able to make games in x language and still get decent performance.

A third reason could be that it's been around a while and has a pretty big community and a lot of libraries for so many different things, as well as tons of documentation, tutorials, etc.
0

Share this post


Link to post
Share on other sites
Also that existing (huge) code bases / libraries were in C and all the programmers knew C, so the change from C to C++ (which can be made in steps, since most C also works in C++) must have been easier than the alternatives. Just a thought, though.
2

Share this post


Link to post
Share on other sites
[quote name='Washu' timestamp='1337832025' post='4942781']
Because it works on all the platforms a game studio needs to target. Specifically: Xbox 360, PS3, and sometimes PC.

Its not a matter of a "want" to use C++, but a matter of "what is required to operate on this platform?"

That being said, indie developers can use XNA to target the Xbox 360 platform, with limitations of course.
[/quote]

Does it mean that only C/C++ has compilers to all platforms? Why there isn't any compilers written to all platforms in other languages? Maybe there's not strong enough demand for that?
0

Share this post


Link to post
Share on other sites
[quote name='szecs' timestamp='1337841967' post='4942820']
Does it mean that only C/C++ has compilers to all platforms? Why there isn't any compilers written to all platforms in other languages? Maybe there's not strong enough demand for that?
[/quote]

Most popular languages get compilers for all platforms eventually.

The problem really is that C and C++ are the de-facto standards, existing middleware, engines, etc are allready written in them and those will not get ported over that quickly(maybe not at all) if they have to be rewritten from scratch in a new language. This in turn means that a game platform without a C and a C++ compiler will fail miserably. (WP7 is a great example of what happens if you don't support native C++).

Since C++ almost has to be supported it is one of the few languages that a middleware writer can count on being supported on launch on a new platform which makes it the safest language to write new middleware in which keeps the cycle going.
1

Share this post


Link to post
Share on other sites
[quote name='Jebbles' timestamp='1337833182' post='4942784']
Another common reason is for performance.
For some things, c++ can be faster than another language. That said, this isn't as good of a reason these days what with a lot of people being able to make games in x language and still get decent performance.
[/quote]

The reason you can do things with decent performance in x language, is because someone implemented low level library functions for what you wanted to do.
Usually implemented in C++ or C.
0

Share this post


Link to post
Share on other sites
Most popular languages these days insist on runnning in a VM even though the benefits for video games are questionable compared to their runtime cost.

Few languages are designed to be compiled natively while still offering a diverse set of high level paradigms such as OO programming, meta programming and functional programming. There's basically mostly C++ and D that fit this category. Only one of those two is a mature language with a proven design and a huge ecosystem of tools, compilers, libraries, and frameworks.

Template meta programming in particular allows C++ to combine very good runtime performance with very good abstraction capabilities. There's pretty much no other language that have both of those things along with a big ecosystem. Edited by Zlodo
1

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1337828980' post='4942768']
whatever you prefer to code in is the better language.[/quote]

It is.

Over time, you then want to do more. And inevitably, no matter the language, you hit roadblocks. They may be big or small, related to performance, management, refactoring, overall development speed, platform support, open/proprietary issues, third-party library availability, ....

Then one looks around and realizes the choice of languages that can work around any of these is fairly limited. It's almost without exception C or C++.


Companies do not have time or budget to experiment. So they start with one thing which is designed to not have limitations.

Electric cars are fine. But if you want something that will work everywhere, you buy something that runs on gas.
0

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1337828980' post='4942768']
I've seen a billion C++ vs. X-Language posts and the answer is always, whatever you prefer to code in is the better language. But what I want to know is; why is C++ the industry standard for game programming? Almost every reputable game company uses C++ for their games. What is so special about C++? I've never gone too deep in C++, I've picked up the book [i]Accelerated C++, [/i]but I just can't seem to get the hang of it and I've always gone back to Java. Now I'm thinking of trying another C++ book, but that's getting off topic.
[/quote]
It all depends on your target. When it comes to devices by number, the three major consoles (Sony, Microsoft, Nintendo) are actually the exception to the rule.

If you develop on Android you don't use c++; you use Java. If you developed on older phones, such as the Nokia family, you developed in Java.

If you develop web games, up until recently there was a good chance you would use Java or Flash. Now there is a good chance your new applications will be developed with JavaScript and HTML5.

If you develop iOS games you use Objective C.

If you develop PC-only games you are more likely to develop in Java or C# than you are to develop in C++.

If you develop with an engine like Unity3D you can develop in C#.

In fact, at EA we use mono and custom library wrappers to develop in C# for not just PC but also for the three major consoles. Many major AAA cross-platform games are developed in C#.



C++ in games is on a downward trend. It won't go away any time soon, just like we see many SDKs provided in pure C, but the three major console makers are very much aware of the shift away from the language. It won't drop soon because you can call the functions directly through interop from any language and there is no incentive to rewrite their libraries.

With the next iteration of hardware I fully expect the SDKs for all three to provide support for C#; Microsoft already does, third party vendors already do it, and major game studios already do it.
0

Share this post


Link to post
Share on other sites
[quote name='Bregma' timestamp='1337867768' post='4942893']
tl;dr C++ lets you do stuff the alternatives don't, it lets you directly leverage existing infrastructure, and it lets you pay only for language features you use. No alternative does all that.
[/quote]
Nice theory, but completely false.

The whole point of object files is that you can call the functions from ANY language. You can call compiled Perl functions from C. You can call compiled Java functions from C#. You can call compiled C++ functions from Python. Etc, etc..

The only thing you need to know is the function's interface. Tools like [url="http://www.swig.org/"]SWIG[/url] can automatically convert them for all major languages. Other sites like [url="http://pinvoke.net/"]pinvoke.net[/url] are specialized to C# or similar tools for JNI. Before the tools you had to do it manually but it was not a difficult task.

The barriers between languages has not existed for decades (since the mid 70's) when languages started compiling to common object file intermediate formats. Edited by frob
Add pinvoke.net and JNI tools.
0

Share this post


Link to post
Share on other sites
Ravyne that really is an excellent answer if you don't mind me saying. I was about to write my own explaining the whole Assembly->C->C++ history.

Really, C++ is the standard today only because of the link between all of those languages. The need for low level performance, the idea that C is a high level language, but one of the lower level ones really defined it as the next step from assembler and I think C++ was just the natural next thing in that chain. Most of the compilers we were using already did it.

Sometimes I wonder though what language we might have been using today if C never existed. What would've taken C's place in the interim? Pascal? BCPL? Edited by freakchild
0

Share this post


Link to post
Share on other sites
[quote name='saejox' timestamp='1337859676' post='4942865']
it has a little thing called "pointer"
[/quote]
So does every language in existence.
1

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1337828980' post='4942768']
I've seen a billion C++ vs. X-Language posts and the answer is always, whatever you prefer to code in is the better language.
[/quote]
There's always the right tool for the job and the wrong ones. Comparing languages outside of the problem context is plain stupid. For game development the answer is simple: OOP is very fitting for writing game engines since a lot of things in a game engine can be represented as objects and C++ offers the best performance out of all of the OO languages.
1

Share this post


Link to post
Share on other sites
[quote name='Alpha_ProgDes' timestamp='1337901594' post='4943051']
[quote name='saejox' timestamp='1337859676' post='4942865']
it has a little thing called "pointer"
[/quote]
So does every language in existence.
[/quote]
Uhh... no?
-4

Share this post


Link to post
Share on other sites
What i believe is the case is that in practice the differences between high level programming languages are so tiny as not to warrant use of other language for any reasons beyond "that's what I know"; the C++ has libraries written in it. The few issues in C++ that other programming languages solve, are very minor comparatively to the rest of the complexities in the big software. Ultimately, the issues like 'managing the memory' or 'multi threaded execution', etc. are very difficult for beginners and are nontrivial in small projects, but are trivially tiny part of the job in a big project.

Other programming languages also tend to force preferred programming ideology of the author (functional programming, some vision of what OOP should be, etc), tend not to implement some pet hated feature (operator overloading is bad! overloading is bad!), or follow some unwieldly maxim (everything is an object!), to the detriment of actual fitness in general use outside the area of expertise of the designer of that programming language. Edited by Dmytry
1

Share this post


Link to post
Share on other sites
[quote name='Dmytry' timestamp='1338156734' post='4943815']
What i believe is the case is that in practice the differences between high level programming languages are so tiny as not to warrant use of other language for any reasons beyond "that's what I know"; the C++ has libraries written in it. The few issues in C++ that other programming languages solve, are very minor comparatively to the rest of the complexities in the big software. Ultimately, the issues like 'managing the memory' or 'multi threaded execution', etc. are very difficult for beginners and are nontrivial in small projects, but are trivially tiny part of the job in a big project.
[/quote]

Let me ask you something; how much time have you spent working with something like C#? And I don't mean "made a small program" I mean 'developed a sizable and complex system with it'?
0

Share this post


Link to post
Share on other sites
[quote name='phantom' timestamp='1338158272' post='4943821']
[quote name='Dmytry' timestamp='1338156734' post='4943815']
What i believe is the case is that in practice the differences between high level programming languages are so tiny as not to warrant use of other language for any reasons beyond "that's what I know"; the C++ has libraries written in it. The few issues in C++ that other programming languages solve, are very minor comparatively to the rest of the complexities in the big software. Ultimately, the issues like 'managing the memory' or 'multi threaded execution', etc. are very difficult for beginners and are nontrivial in small projects, but are trivially tiny part of the job in a big project.
[/quote]

Let me ask you something; how much time have you spent working with something like C#? And I don't mean "made a small program" I mean 'developed a sizable and complex system with it'?
[/quote]

Let's not resort to methods prone to massive placebo effect. The C# has numerous advantages over C++, and I do expect some increase in productivity, albeit much less significant than people tend to state, and actually, less than I am likely to believe - I do hate doing reflection in C++, for instance, and while it is not a significant burden, it is quite a big annoyance. Likewise not having to use smartpointers = less keyboard use, etc etc. If you let people remove some insignificant but noticeable weights attached to their legs the walking is going to feel a lot easier (for relatively short time) even if speed and endurance changed by only a couple percent.

I would say, C# is more ergonomic, in the sense of being less annoying, to much larger extent than it is 'better' by other metrics. edit: Basically, i would say that the parts which C# improves, are not a very significant burden in the sense of percentile of the difficulty; they are, however, very annoying sides of C++ and itch in the sense that you can very clearly see that some of your work has to be done only because language is being stupid. Edited by Dmytry
0

Share this post


Link to post
Share on other sites
Actually, if you are using the Microsoft tools for development, .NET is supported much better. Up until very recently (vs10), C++ was largely ignored. It suffered from horrendous code completion, on/off navigation, etc. In .NET you've got even refactoring capabilities built-in.

The advantage of using C#/.NET is primarily coherence and the fact that you have a lot of functionality at your fingertips. I don't really think the language itself matters that much. They are almost the same, anyway. Also, another benefit of using .NET over native is that you get far superior tooling support. There are a lot more plugins to choose from, there are even some free ones, there is the invaluable Reflector (and now ILSpy), and the vanilla IDE is also a lot better. You've got ms-build, which is awesome for automation. But you can use nant instead, which is also awesome.

Another problem with C++ and performance (as in coding) would be legacy. Take a look at [url="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml"]Google's coding conventions document[/url]. They are [url="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Exceptions#Exceptions"]banning exceptions[/url] because the old code isn't built with exception-safety in mind. There is also the problem with Unicode: some use utf-8 (e.g. all non-java Linux and open-source stuff), others use utf-16 (Windows). There is ICU, of course, but I haven't met a library that uses it. And not to forget, there is the vastness of C libraries you might need, which you might need to wrap in order to use efficiently in your code base.

I think arguing about languages bringing productivity is not very fair. When somebody says C#/Java/Python, they usually mean the associated platform, not just the language. And it's the platform design and what's included, that matters. Developers will always find work-arounds for weak spots in the language. With time, you get to employ those work-arounds automatically, and they stop mattering to your productivity. At least that's my experience.
1

Share this post


Link to post
Share on other sites
[quote name='eugene2k' timestamp='1337977541' post='4943344']
[quote name='Alpha_ProgDes' timestamp='1337901594' post='4943051']
[quote name='saejox' timestamp='1337859676' post='4942865']
it has a little thing called "pointer"
[/quote]
So does every language in existence.
[/quote]
Uhh... no?
[/quote]

Uhh... yes? lol you just can't directly manipulate them in other languages... but they ALL USE POINTERS :)
1

Share this post


Link to post
Share on other sites
I hope someone understands this:
[url="http://www.jelovic.com/articles/why_java_is_slow.htm"]http://www.jelovic.c...ava_is_slow.htm[/url]

Personally, (although I am most experienced with C++) I don't like C++ much. I agree strongly with dilyan_rusev. I don't think C, either, is all that shiny enough for the C++ designers to completely ignore people's problems with it, just so they can continue to be fanatic about C's legacy. I would say C++'s contributions aren't much either. There's a chance that if you limit yourself to utilizing C++'s capabilities, you can complete your project(s) much sooner. C++'s meta-language just sucks; I disagree that it improves any of the programmer's productivity. I tried "D", but I honestly didn't try very hard, because it makes some big mistakes that Java has also made.
0

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0