• 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
KappaG3

What are the most important things that should make me consider moving to C++?

47 posts in this topic

[quote name='GrandMaster789' timestamp='1347617031' post='4980011']
- Language will remain stable for many (~10) years[/quote]
10 years ago we didn't even have standard-comformant compilers. And we still don't have a conformant C++11 implementation, to the best of my knowledge.

Not sure I'd call that 'stable' [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img]
0

Share this post


Link to post
Share on other sites
[quote name='swiftcoder' timestamp='1347622268' post='4980018']
[quote name='GrandMaster789' timestamp='1347617031' post='4980011']
- Language will remain stable for many (~10) years[/quote]
10 years ago we didn't even have standard-comformant compilers. And we still don't have a conformant C++11 implementation, to the best of my knowledge.

Not sure I'd call that 'stable' [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img]
[/quote]

You're right about that, although I would argue that the *standard* didn't change for ~10 years. If you have C++ code that's 10 years old, it'll almost certainly still compile correctly to this day. If you have, say, Java code that's 10 years old, it probably won't work anymore.

The whole C++11 implementation stuff is a bit comparable to browser adoption of CSS, where the standard had been established for many years before any browser would correctly render it. At the moment there is no complete implementation of C++11, although for example the latest GCC and MSVC compilers do a pretty good job already. Edited by GrandMaster789
0

Share this post


Link to post
Share on other sites
[quote name='GrandMaster789' timestamp='1347623335' post='4980023']
If you have C++ code that's 10 years old, it'll almost certainly still compile correctly to this day. If you have, say, Java code that's 10 years old, it probably won't work anymore.[/quote]
WTH do you get that idea?

The rate of code-rot in unmaintained C++ code bases is truly ridiculous, especially if you have any meaningful external dependencies. I'd say that 10 year old C++ code rarely still compiles - and when it does, it's often only with a legacy compiler (Visual Studio 6, how do I love thee? Let me count the ways...)

By comparison, all Java code from 10 years ago not only still compiles, but is still standard-conformant (because java actually had a consistent standard, well more than 10 years ago). Edited by swiftcoder
0

Share this post


Link to post
Share on other sites
[quote name='GrandMaster789' timestamp='1347617031' post='4980011']
Detailed, explicit control over your application
[/quote]

Eh? You don't even know the size of your int's...
1

Share this post


Link to post
Share on other sites
I suppose a more detailed explanation is required here... it does highlight an issue I neglected to mention: because 10 years ago most compilers would not correctly implement C++, it's doubtful if code that worked 10 years ago would actually be compliant C++ (VC6 was notorious for this).

Recently I dusted off some of my own old code from back then and it worked perfectly. This is, of course, anecdotal evidence and probably not correct for all projects, but as the topic here is very subjective anyway I thought I'd share my personal experience.

I mentioned Java because I used to program with it 10 years ago, and back then it had a habit of deprecating all sorts of standard library functions. The language itself didn't change that much, true. I haven't had much experience with Java lately so my opinions on that language may be a bit dated.
1

Share this post


Link to post
Share on other sites
[quote name='GrandMaster789' timestamp='1347617031' post='4980011']
- Code will compile to just about any platform[/quote]
I actually missed this one the first time around. It should probably say something more like "Code can be beaten into compiling on just about any platform, given a significant porting effort".

[list]
[*]Want to compile your 32-bit code with a 64-bit compiler? Sorry, your standard integer type changed size, and nothing works anymore.
[*]Want to compile your standard-conforming code on Android? Sorry, we disable RTTI and exceptions, just because.
[*]Want to compile your file-system tool on Windows? Sorry, we only kind-of support POSIX over here.
[*]Want to compile your file-system tool on Mac? Oh, hey, we do support POSIX, but we moved all the header files.
[*]Want to compile your GUI application on a Mac? Sorry, we don't have Win32 or MFC. We do have GTK+ and QT, but they have subtle differences from their linux counterparts.
[/list]


Even though a number of those points are library related, when you compare to the portability of a language/ecosystem like Java, C++ just doesn't cut it. Edited by swiftcoder
1

Share this post


Link to post
Share on other sites
To extend on the above, C ([i]and hence C++ by 'inheriting' most of C[/i]) was designed to be a portable replacement for assembly languages -- i.e. it's "portable" in that you don't need to learn the actual assembly instructions for each CPU that you want to port your code to, but you've still got to port your code. Edited by Hodgman
0

Share this post


Link to post
Share on other sites
Same with any language / platform.

C# using Winforms on Android isn't going to work.
C# using Gtk# on the Windows Phone isn't going to work.

Unfortunately because C++ has many more platforms to support and includes loads of legacy support, people get put off by this and consider to be harder.
-3

Share this post


Link to post
Share on other sites
[quote name='Karsten_' timestamp='1347652636' post='4980152']
Unfortunately because C++ has many more platforms to support and includes loads of legacy support, people get put off by this and consider to be harder.
[/quote]

That's not the argument.

The argument is that "C++ is way better for portability", and to get that awesomesauce, you deal with C++'s downsides. In real life, C++ [b]isn't [/b]that portable. So you have the same portability issues in C++ as you do in other languages, except C++ also has all these [i]other [/i]downsides.
1

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1347652877' post='4980155']
C++ [b]isn't [/b]that portable.
[/quote]

C++ isn't as portable as C perhaps. But far more so than C#. It doesn't need a runtime VM for a start ;)

In terms of games library portability... Writing a library in C or C++ (or another native language) is perhaps the only way you can guarentee it can work in C#, Java, Python.

You can't use C# libraries in python for example. Edited by Karsten_
-2

Share this post


Link to post
Share on other sites
[quote name='swiftcoder' timestamp='1347630994' post='4980054']
[quote name='GrandMaster789' timestamp='1347617031' post='4980011']
- Code will compile to just about any platform[/quote]
I actually missed this one the first time around. It should probably say something more like "Code can be beaten into compiling on just about any platform, given a significant porting effort".


[list]
[*]Want to compile your 32-bit code with a 64-bit compiler? Sorry, your standard integer type changed size, and nothing works anymore.
[*]Want to compile your standard-conforming code on Android? Sorry, we disable RTTI and exceptions, just because.
[*]Want to compile your file-system tool on Windows? Sorry, we only kind-of support POSIX over here.
[*]Want to compile your file-system tool on Mac? Oh, hey, we do support POSIX, but we moved all the header files.
[*]Want to compile your GUI application on a Mac? Sorry, we don't have Win32 or MFC. We do have GTK+ and QT, but they have subtle differences from their linux counterparts.
[/list]


Even though a number of those points are library related, when you compare to the portability of a language/ecosystem like Java, C++ just doesn't cut it.
[/quote]


And then you start thinking about more game-like issues , such as direct memory access and , let's not forget, execution speed, and then you see the light :D
1

Share this post


Link to post
Share on other sites
C++ is a 3rd generation language.
Only generation 0 (opcodes) and generation 1 (assembly) are considered low-level.

Fortran, Pascal, & C are 2nd generation languages.
Objective-C, C++ is 3rd.
Java & C# are 4th.

Language choice is dictated by the quality of the toolchain available for your target platforms.
If you only want it to work on Windows, use C#.
If you only want it to work on Android, use Java.
If you only want it to work on OSX, use Objective-C.

If you want it to work on all three, then you need to setup your environment to build and test for all three.
I would probably setup a C# environment using .NET, Mono, & Ximian.
If you know Java well, then setup a Java environment.
If/when you need to do something lower-level, then you use C++ or C.

Java would probably be easier but I would look into what is new for JNI and GUI before I committed.
Those are the two areas that Java always seems to fall apart. For example C# now has C++/CLI & CXXI for native-interop in addition to the features built directly into C# & WinForm is now supported by Mono so that nails the JNI & GUI problems. Edited by Shannon Barber
0

Share this post


Link to post
Share on other sites
[quote name='Karsten_' timestamp='1347655201' post='4980173']
You can't use C# libraries in python for example.
[/quote]

That's not strictly true... [url="http://ironpython.net/"]IronPython[/url].
0

Share this post


Link to post
Share on other sites
[quote name='Shannon Barber' timestamp='1347658046' post='4980190']
That's not strictly true... IronPython.
[/quote]

You can't use C# libraries in Objective C for example.

[quote name='Shannon Barber' timestamp='1347657769' post='4980188']
If you only want it to work on Windows, use C#.
If you only want it to work on Android, use Java.
If you only want it to work on OSX, use Objective-C.
[/quote]

Or cut the crap and use the langage and compiler that works for all.

Windows: C++ (GCC)
Android: C++ (NDK, GCC)
OSX: C++ (GCC or Clang)

And if you code your software correctly, you can get code that works on all without needing to rewrite your software in a new language each time. Edited by Karsten_
-3

Share this post


Link to post
Share on other sites
I can compile C# for windows, android, and OSX. I can compile Java for windows, android and OSX.

*This is not an advantage of C++.*

Hell I can even take a DLL compiled on windows and run it in OSX. Good luck getting C++ binaries to do that.
1

Share this post


Link to post
Share on other sites
[quote name='Shannon Barber' timestamp='1347657769' post='4980188']
C++ is a 3rd generation language.
Only generation 0 (opcodes) and generation 1 (assembly) are considered low-level.

Fortran, Pascal, & C are 2nd generation languages.
Objective-C, C++ is 3rd.
Java & C# are 4th.[/quote]
You can't just lump languages into tiers like that.

What generation is LISP? By year, it should be generation 0 (it is after all, 20 years older than C). If we go by expressiveness, it's at least tier 5.

What generation is Erlang? Over 9,000?

And I strongly object to your lumping Objective-C in the same category as C++. How does dynamic message-passing land in the same category as a glorified C pre-processor?
1

Share this post


Link to post
Share on other sites
[quote name='Karsten_' timestamp='1347655201' post='4980173']
C++ isn't as portable as C perhaps. But far more so than C#. It doesn't need a runtime VM for a start ;)[/quote]
I trust you are joking?

If not, I'm going to hand you a .jar file and a .o file, both implementing the same functionality, both compiled on an undisclosed (but exotic) architecture, and you can come back when you have executed both.

[quote name='Karsten_' timestamp='1347660156' post='4980201']
And if you code your software correctly, you can get code that works on all without needing to rewrite your software in a new language each time.[/quote]
Otherwise known as "significant porting effort". Whether you do this before or after you write your software, is largely irrelevant.
-1

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1347661183' post='4980207']
Hell I can even take a DLL compiled on windows and run it in OSX. Good luck getting C++ binaries to do that.
[/quote]
If I was to compile a .NET assembly "dll" with C++.NET (using the /clr:safe flag) it would run fine on a mono VM on OSX.
But I guess a native Windows DLL would run fine in wine on OSX anyway. Afterall, installing wine is just as much unnecessary faff for users as installing the mono runtime.

[quote name='swiftcoder' timestamp='1347666854' post='4980226']
If not, I'm going to hand you a .jar file and a .o file, both implementing the same functionality, both compiled on an undisclosed (but exotic) architecture, and you can come back when you have executed both.
[/quote]
I doubt that exotic architecture even has a Java VM ported to it haha.

But good luck getting a .jar to run on an iPhone.

[quote name='swiftcoder' timestamp='1347666854' post='4980226']
Otherwise known as "significant porting effort".
[/quote]
Yeah, because completely reimplementing in a whole new language is sooo much quicker... Or not.

[quote name='swiftcoder' timestamp='1347666275' post='4980224']
And I strongly object to your lumping Objective-C in the same category as C++. How does dynamic message-passing land in the same category as a glorified C pre-processor?
[/quote]
Objective-C doesnt belong in the same category as C#/Java because not only does it not need a garbage collector but it also compiles out to native code rather than needing some hosted VM indie shite.
Not to mention that C#'s pre-processor has been completely crippled making it *even* less useful for cross platform development. (Then again.. Microsoft only really designed it for their platforms anyway...) Edited by Karsten_
-4

Share this post


Link to post
Share on other sites
[quote name='Karsten_' timestamp='1347667318' post='4980228']
[quote name='swiftcoder' timestamp='1347666854' post='4980226']
If not, I'm going to hand you a .jar file and a .o file, both implementing the same functionality, both compiled on an undisclosed (but exotic) architecture, and you can come back when you have executed both.[/quote]
I doubt that exotic architecture even has a Java VM ported to it haha.[/quote]
Oh, trust me, it does. You can [url="http://ti.tuwien.ac.at/rts/teaching/courses/jvmhw/"]take a university course on implementing the JVM entirely in hardware[/url]. There are even [url="http://www.theregister.co.uk/2001/06/04/bread_as_a_display_device/"]JVMs available for god-damn [b]toasters[/b][/url].

But if you don't like that point, let's try a little exercise:

- As a language implementer, what are your choices when face with an entirely new platform? Either:
+ (a) port a compiler to the platform, or
+ (b) port a virtual machine to the platform.

- Now, programming languages like C, tend to take route (a).
+ But guess what language the JVM is written in? That's right, C.
+ So as soon as you have a working C compiler, you can have a working JVM.

- Ergo Java is [b]at least [/b]as portable as C.
-1

Share this post


Link to post
Share on other sites
[quote name='swiftcoder' timestamp='1347668625' post='4980233']
- Ergo Java is [b]at least [/b]as portable as C.
[/quote]
By that logic, since almost everything is written in C, then everything is as portable. Ridiculous. The garbage collector alone that a JRE needs can't be ported to a large number of platforms for technical reasons.

FYI, almost all implementations of Java are written in C++, and this is proven to be much less portable than C. Your logic is so flawed. Afterall, platforms with no stack (e.i PIC), certainly wont take well to C++'s stack unwinding haha.

Not only that, but the development time required to build a JVM on the platform is certainly not going to be a good return (Unless of course a company wants to cash in on indie developers developing games for the platform such as the XBox360 .NET XNA stuff).

So chances are good that there will be no Java JVM on exotic platforms. Admittedly they will probably also not have an OpenGL implementation or 2D acceleration either so this isn't too relevant. Edited by Karsten_
-2

Share this post


Link to post
Share on other sites
[quote name='Karsten_' timestamp='1347669335' post='4980234']
Not only that, but the development time required to build a JVM on the platform is certainly not going to be a good return (Unless of course the company wants to cash in on indie developers developing games for the platform such as the XBox360 .NET XNA stuff).[/quote]
And here, my friend, you are hoist by your own petard [img]http://public.gamedev.net//public/style_emoticons/default/ohmy.png[/img]

Because if, as you so vehemently argue, C is some sublime expression of portability, then, by the transitive property, being in and of itself a C program, the JVM must share in this magical ideal of portability, and 'porting' the JVM will be a matter simply of re-compiling.

And on that humorous note, I bid adieu and farewell to this (meaningless) discussion.
0

Share this post


Link to post
Share on other sites
And this thread is closed. Congratulations! Edited by Washu
1

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