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

Java or C++?

44 posts in this topic

[quote name='zoneweb' timestamp='1332262647' post='4923677']
[quote name='Vlad86' timestamp='1332258514' post='4923654']
C++ will consume allot of time before you will be able to generate something useful (without major bugs).
[/quote]
That only happens when you scale it up. Hobby games are still doable in C++ without much hassle (if you know what you're doing).
[/quote]
That's the problem. Obviously, the OP is a beginner, and obviously he wouldn't know what he's doing with C++... That's the same for any beginner. Hence why C++ would consume a lot of the beginner's time before he/she even gets a semi-working simple game.
1

Share this post


Link to post
Share on other sites
[quote name='Cornstalks' timestamp='1332264525' post='4923688']
[quote name='zoneweb' timestamp='1332262647' post='4923677']
[quote name='Vlad86' timestamp='1332258514' post='4923654']
C++ will consume allot of time before you will be able to generate something useful (without major bugs).
[/quote]
That only happens when you scale it up. Hobby games are still doable in C++ without much hassle (if you know what you're doing).
[/quote]
That's the problem. Obviously, the OP is a beginner, and obviously he wouldn't know what he's doing with C++... That's the same for any beginner. Hence why C++ would consume a lot of the beginner's time before he/she even gets a semi-working simple game.
[/quote]
Yup according to one of Stroustroup's latest talks one of the reasons there is so much bad C++ code is:

Bad style is the #1 problem in real-world C++ code

Makes progress relatively easy

Only relatively: bad code breeds more bad code

Lack of focus on style is the #1 problem in C++ teaching

A “quick hack” is usually the quickest short-term solution

Faster than thinking about “design”

“They” typically teach poor style

Many are self-taught

Take advice from

Decades old books

[img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img] Other novices [img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img]

Imitate

Other languages

Bad old code
1

Share this post


Link to post
Share on other sites
[quote name='Cornstalks' timestamp='1332211164' post='4923504']
C++'s syntax is just... tedious, especially for a beginner, and even more so when the compiler gives very non-beginner-friendly error/warning messages. That's the main issue with C++'s syntax and beginners.[/quote]
You must be using a really crappy compiler then, mine simple says:
"Main.cpp:54: error: 'class std::vector<std::basic_string<char> >' has no member named 'begiin'"

And as for missing a semicolumn in a header:
"Component.h:25: error: expected ';' at end of member declaration"
0

Share this post


Link to post
Share on other sites
[quote name='MichaBen' timestamp='1332273676' post='4923725']
[quote name='Cornstalks' timestamp='1332211164' post='4923504']
C++'s syntax is just... tedious, especially for a beginner, and even more so when the compiler gives very non-beginner-friendly error/warning messages. That's the main issue with C++'s syntax and beginners.[/quote]
You must be using a really crappy compiler then, mine simple says:
"Main.cpp:54: error: 'class std::vector<std::basic_string<char> >' has no member named 'begiin'"

And as for missing a semicolumn in a header:
"Component.h:25: error: expected ';' at end of member declaration"
[/quote]
If you consider g++ a crappy compiler then... sure, I guess I am. But that's even another issue: different compilers give different errors, and inconsistency is a disservice to beginners.
0

Share this post


Link to post
Share on other sites
Maybe it's because I've only been using C++ for about 2 years now (and probably because I've never really studied any other language as deeply as C++), but I really don't see what the big deal is with C++ it's just something you gotta learn. In my opinion you should start with C and evolve to C++ (atleast that's what I did and I haven't regretted it so far), after you have a good understanding of both start developing basic console games (like tic-tac-toe) and after your skills have grown try making simple 2D games (with programs like Game Editor or libraries like SDL) or if you're feeling really adventurous go straight to basic 3D games (again, with the help of programs and libraries); obviously you wont produce any commercial, mind-blowing games, but you will absorb a lot of knowledge about programming.

I hope I haven't scared or confused you. Basically all I'm saying is to jump into the difficult stuff (cause your gonna have to learn it eventually), cry for a few days because you don't understand it (not literally), after you've calmed down, go back to it and eventually (without realizing it) you'll start learning stuff about programming.

Anyway, that's how I've been doing it since I've started learning.

Cheers :D
0

Share this post


Link to post
Share on other sites
[quote name='Aluthreney' timestamp='1332283712' post='4923762']
Maybe it's because I've only been using C++ for about 2 years now (and probably because I've never really studied any other language as deeply as C++), but I really don't see what the big deal is with C++ it's just something you gotta learn. In my opinion you should start with C and evolve to C++ (atleast that's what I did and I haven't regretted it so far), after you have a good understanding of both start developing basic console games (like tic-tac-toe) and after your skills have grown try making simple 2D games (with programs like Game Editor or libraries like SDL) or if you're feeling really adventurous go straight to basic 3D games (again, with the help of programs and libraries); obviously you wont produce any commercial, mind-blowing games, but you will absorb a lot of knowledge about programming.[/quote]
You've only used it for two years? That's really barely enough time to get to know the language. C++ is a huge and horrible beast of a language, with lots and lots and lots of [url="http://www.scapecode.com/category/quizzes/"]lovely corner cases[/url] just waiting to bite you. That's not to say one can't start with it, but its a bad idea. You never have to learn C++ unless you decide to become a professional game developer. If you work indie, XNA, mobile phones, or similar, you can avoid C++ for almost the entire time. C is only slightly better than C++, having fewer of the more tricky corner cases, while still having plenty of lovely undefined behavior just waiting under the hood. I'm not trying to be mean, but even after 20 YEARS of using C++, I still find nasty corner cases that introduce [url="http://dwarffortresswiki.org/index.php/Fun"]fun[/url]. C++11 certainly didn't help in that regard.

[quote]Basically all I'm saying is to jump into the difficult stuff (cause your gonna have to learn it eventually), cry for a few days because you don't understand it (not literally),[/quote]

More like a few months, and even then you probably still won't understand the exact reasons why certain things are or are not valid.

There is a reason we recommend managed languages (like Java, C# and python) to beginners: Your goal, as a beginner, is to learn the art of programming. This is not something that is bound to a single language, it is a method of thinking, a set of paradigms, and the problem solving skills required to take a problem and produce a solution. As such, the language you choose to learn on your initial forays into the field should be one that encourages learning, provides results quickly, and does not require you to understand low level concepts before you can implement high level ideas. You will eventually learn lower level concepts, and you will eventually move on to other languages, many other languages. Each language has problems it is good at solving, and problems that it is terrible at solving. Eventually, when you have a tool chest of languages and paradigms you will find problem solving to not just be significantly simpler, but also significantly cleaner.
2

Share this post


Link to post
Share on other sites
[quote name='Cornstalks' timestamp='1332274849' post='4923727']
[quote name='MichaBen' timestamp='1332273676' post='4923725']
[quote name='Cornstalks' timestamp='1332211164' post='4923504']
C++'s syntax is just... tedious, especially for a beginner, and even more so when the compiler gives very non-beginner-friendly error/warning messages. That's the main issue with C++'s syntax and beginners.[/quote]
You must be using a really crappy compiler then, mine simple says:
"Main.cpp:54: error: 'class std::vector<std::basic_string<char> >' has no member named 'begiin'"

And as for missing a semicolumn in a header:
"Component.h:25: error: expected ';' at end of member declaration"
[/quote]
If you consider g++ a crappy compiler then... sure, I guess I am. But that's even another issue: different compilers give different errors, and inconsistency is a disservice to beginners.
[/quote]
Yup. They don't even seem to agree on the simplest of errors as the following shows:
C:\Temp>type meow.cpp
#include <iostream>
using namespace std;
int main() {
cout < "Hello, world!";
}
C:\Temp>cl /EHsc /nologo /W4 meow.cpp
meow.cpp
meow.cpp(5) : warning C4130: '<' : logical operation on address of string constant
meow.cpp(5) : warning C4552: '<' : operator has no effect; expected operator with side-effect

This is actually required to compile by C++98/03, as cout has operator void *(). Comeau 4.3.10.1 also accepts this.

GCC 4.4.1 emits hard errors but I don't know what they're doing.

In C++0x, this should fail to compile due to changes in the Core Language and Standard Library. (While VC10 implements portions of C++0x, it doesn't implement the relevant changes here.) [size=4][b]- [/b]Stephan T. Lavavej [/size]
0

Share this post


Link to post
Share on other sites
One thing on C# vs Java that hasn't been mentioned is that C# has amazing developer tools. Every time I decide to use C# the first thing I think is, "MY GOD THIS IDE IS BEAUTIFUL!" as a single tear of happiness rolls down my cheek. Even moreso everything that is beautiful is also totally functional whereas in VC++/VS it's almost a tossup on whether something will work the way you expect it to.

That would be my biggest reason for choosing C# tbh. You can install VC# Express and you're pretty much good to go instantly. Almost every other language/IDE has more setup than click setup.exe->start programming. Also the xna site has tons of great tutorials for a beginner that wants to jump straight into games. There are [i]some [/i]good java tutorials, but they are generally lost among the flood of crappy java tutorials.
1

Share this post


Link to post
Share on other sites
learn java before c++ is a good choice, java can let you master an important language more easier, after that you will find what c++ really is. If you learn c++ straightly, you may be halt by many disgusting and unuseful stuff.
-1

Share this post


Link to post
Share on other sites
There is something that has been on my mind for quite some time, why is C++ often considered as a primary language to beginners? and has anyone actually gotten far enough making a content rich game in C# with SlimDX / SharpDX similar to AAA quality games out today, where performance was so bad due to it being managed that C++ would have made a noticeable difference?

Sure theres benchmark threads, a tonne of comparison threads and a lot of opinions but has there ever been a case where a C# project using SlimDX / SharpDX has come to a halt because C# just wasnt good enough to perform and if there is how did they deal with it, something tells me it wasnt "port everything to C++".
0

Share this post


Link to post
Share on other sites
[quote name='Robin123' timestamp='1332247418' post='4923591']
wow guys, far more replies than I expected...a hot topic apparently [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]. Thanks for all the help. I think I will continue with Java, now that I'm already into it. I will probably not head in the C++ direction straight away instead opting to take a look at C# first.

I have plenty of time to get onto C++.

Thanks!
[/quote]
As far as I remember [i]Language1 vs Language2[/i] always brought wars, especially when it comes to [i]C++ vs Java vs C#[/i].

But I guess I can provide my own point of view:
C++ is hardest out of those 3 because it has memory management, pointers and other weird stuff, however it has high performance because it's not virtual machine like Java, and doesn't require dynamic linking for everything like in C#. Therefore it's best suited for demanding applications (database, AAA games, simulations, etc).

C# allows easy Windows UI development, together with XNA it can create nice games too (not only for PC).

Java is very cross-platform therefore is best suited for applications that target wide audience, however it's quite big letdown when it comes to performance. Huge amount of packages allows rapid development as well, but inability to create overloaded pointers can make game development complicated because of heavy math involvement.


Also I don't consider Java and C# true programming languages because they cannot run on machine without OS/extra libraries, like Assembly/C/C++ can, therefore I consider both of them to be scripting languages.
-2

Share this post


Link to post
Share on other sites
[quote]
But I guess I can provide my own point of view:
[/quote]
This is [b]For Beginners[/b]. Try to stick with facts, rather than opinions.

Just to quickly refute some of your points:
[quote]
C++ is hardest out of those 3 because it has memory management, pointers and other weird stuff, however it has high performance because it's not virtual machine like Java, and doesn't require dynamic linking for everything like in C#. Therefore it's best suited for demanding applications (database, AAA games, simulations, etc).
[/quote]
Virtual machines have nothing to do with performance, nor does dynamic linking. The fact that [u]current implementations[/u] of these might incur performance overhead is not a particularly interesting argument.

Consider virtual machines, if you look back a few years and see the performance difference between what they were then and where they are now - you will see that most of the "performance issues" are actually [i]implementation issues[/i]. In addition, language implementations that have some kind of hypervisor/compiler functionality have lots of opportunities for advanced optimisation that we're only scratching the surface of (e.g. V8 javascript engine compiling dynamic function calls to inline assembler - no current C++ compiler can do this).

As for dynamic linking performance, I imagine any performance issues are most likely related to Microsoft attempting to keep backwards compatibility with their existing DLL systems. I've never looked into C#'s dynamic linking, so I cannot comment for certain, but if you were free to design a new dynamic link system from scratch, I see no reason one would have to pay a heavy runtime price for it. Indeed, again the nature of these languages could serve as a benefit, the abstract instructions here could be fully inlined into the caller when they are dynamically linked (possibly but considerably more difficult for fully native code).

[quote]
Java is very cross-platform therefore is best suited for applications that target wide audience, however it's quite big letdown when it comes to performance. Huge amount of packages allows rapid development as well, but inability to create overloaded pointers can make game development complicated because of heavy math involvement.
[/quote]
Overloaded pointers?

Java's main performance pitfall is the memory structure - it suffers because it doesn't allow explicit value objects and AFAIK little or no memory layout optimisations are done automatically. This is where 95%+ of modern performance issues are - memory layout problems causing the busy loops to fall outside the cache.

[quote]
Also I don't consider Java and C# true programming languages because they cannot run on machine without OS/extra libraries, like Assembly/C/C++ can...
[/quote]
Standard C++ and C cannot run on their own without an OS. Arguably, no program can run without an OS, without also being an OS.

In any case, C and C++ operate in their own kind of "virtual machine", just one that happens to map more or less directly to hardware very often. This abstraction insulates you from the processor just enough that you would need some assembly or language extensions to bootstrap you and/or to accomplish certain tasks.

And of course if you allow C or C++ that, then surely you must allow Java, C# or even Javascript the same, and you are back to where you started.

However unless you are in the business of writing operating systems I don't see any relevance of this line of reasoning.

[quote]
... therefore I consider both of them to be scripting languages.
[/quote]
Arbitrary, line in the sand nonsense. The classification of a programming language as a "scripting language" (the latter usually considered a subset of the former, not a disjoin set), even under a definition of scripting language as unusual as yours (typically scripting language is more or less synonymous with dynamic typing), is irrelevant.
2

Share this post


Link to post
Share on other sites
[quote name='rip-off' timestamp='1332431398' post='4924354']
Try to stick with facts, rather than opinions.
[/quote]
[img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img]
[quote name='rip-off' timestamp='1332431398' post='4924354']
Consider virtual machines, if you look back a few years and see the performance difference between what they were then and where they are now - you will see that most of the "performance issues" are actually implementation issues.
[/quote]
It's so easy to blame everything on [i]implemention[/i]. It's a catch-all phrase for defending anything that's wrong with a particular tool. One could argue that the performance issues of C/C++ is related to implementation too. If the compilers were made better, C/C++ would always be extremely far ahead of Java in performance.

[quote]
Java's main performance pitfall is the memory structure - it suffers because it doesn't allow explicit value objects and AFAIK little or no memory layout optimisations are done automatically. This is where 95%+ of modern performance issues are - memory layout problems causing the busy loops to fall outside the cache.
[/quote]
Regardless of whether or not the percentage is correct, you've admitted yourself that Java is an inadequate language, performance-wise.

[quote name='rip-off' timestamp='1332431398' post='4924354']
And of course if you allow C or C++ that, then surely you must allow Java, C# or even Javascript the same, and you are back to where you started.

However unless you are in the business of writing operating systems I don't see any relevance of this line of reasoning.
[/quote]
There's a huge difference between a little abstraction and 100% abstraction. And if Java is so good, it would've been used for coding commercial operating systems
-2

Share this post


Link to post
Share on other sites
[quote name='Dynamo_Maestro' timestamp='1332378490' post='4924148']
There is something that has been on my mind for quite some time, why is C++ often considered as a primary language to beginners? and has anyone actually gotten far enough making a content rich game in C# with SlimDX / SharpDX similar to AAA quality games out today, where performance was so bad due to it being managed that C++ would have made a noticeable difference?

Sure theres benchmark threads, a tonne of comparison threads and a lot of opinions but has there ever been a case where a C# project using SlimDX / SharpDX has come to a halt because C# just wasnt good enough to perform and if there is how did they deal with it, something tells me it wasnt "port everything to C++".
[/quote]

I've seen a handful of games that were released on XBLA (not XBLIG) that started as C# projects but were ported to C++ in order to squeeze those extra couple drops of juice out.
0

Share this post


Link to post
Share on other sites
I think that Java is good enough for most applications on a modern system. However, if you are doing something that is low level or requires extreme performance, Java is out of the question. For example, I'm not aware of any GBA homebrew games written in Java.
0

Share this post


Link to post
Share on other sites
[quote name='zoneweb' timestamp='1332440294' post='4924397']
And if Java is so good, it would've been used for coding commercial operating systems
[/quote]

Ignoring the absurdity of that metric as a measure of what denotes a 'good' programming language, the non-kernel bits of the Android OS are written in Java. I suspect other mobile OSes (you know... almost every commercial operating system made after the development of Java) also have a large bit of Java.
1

Share this post


Link to post
Share on other sites
[quote name='Storyyeller' timestamp='1332441445' post='4924402']
I think that Java is good enough for most applications on a modern system. However, if you are doing something that is low level or requires extreme performance, Java is out of the question. For example, I'm not aware of any GBA homebrew games written in Java.
[/quote]

The GBA doesn't have a JVM nor a native Java compiler so it would be kinda difficult [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

as waytolazy mentioned there is also a bit of a problem with managed languages on consoles, primarily because of the insanely low amounts of memory available. (The xbox 360 only has 512MB ram shared between CPU and GPU and no L3 cache (1MB L2 cache shared between all 3 cores) making memory management something of a problem), the situation on the GBA is even worse.

The PC on the other hand has tons of RAM and large chunks of cache available, while the L1 cache is still small and L2 isn't much bigger than on the 360 the large L3 cache greatly mitigates the cost of cache misses. (the latest core i7 has 15MB L3 cache in addition to the L1 and L2 cache making complete cache misses fairly rare even with a managed language (unless you work with large sets of data ofcourse) (having to fetch data or instructions from L3 is still slower than getting them from L1 or L2 ofcourse but nowhere near as slow as having to dip into RAM to get them as you frequently have to do if you're not careful on a console)
0

Share this post


Link to post
Share on other sites
Magicka was C#/XNA, so was terraria and ic heard Bastion was also. If you are wanting more speed than these games need, its likely not a 1 man hobby/indie project.
If you want a good basis for programming, i.e. have a driveto really learn it well and understand how things like Unreal are built. I think its good to grab a C++ primer book and go through it till you understand all about memory and pointers. Then move to C# to get things done relatively easy. If you need more power later on, move back to C++ and start learning its black magicks.
0

Share this post


Link to post
Share on other sites
Well it depends on the type of game you're making. Most games don't require much performance, but if you want to do advanced AI or physics, then you can easily run into performance limitations, even in an indie game. Just look at Achron (made by only 2 people).
0

Share this post


Link to post
Share on other sites
I was not pretending that Java (or any language) is a performance panacea. I was addressing particular misconceptions in the post by Ripiz. I'm not sure your rebuttals have any particular relevance to a beginner.

[quote]
It's so easy to blame everything on implemention ... One could argue that the performance issues of C/C++ is related to implementation too.
[/quote]
My point was that you cannot write off technology based on the current implementation. A few years ago, many people dismissed dynamic languages as hopeless to optimise. Modern Javascript engines show that such an attitude is flawed in the medium and long term.

Yes, C++ compilers are not set in stone. They will continue to improve. That said, they've had a long maturation time, and are closer to the point of diminishing returns than younger technologies.

[quote]
Regardless of whether or not the percentage is correct, you've admitted yourself that Java is an inadequate language, performance-wise.
[/quote]
For who? What purpose, what application?

Is it inadequate for a beginner's Pong clone? What about Quake? Or Minecraft? Crysis 3 would be a different matter. What about Doom 7 though - what will be in vogue then?

I was merely pointing to one concrete flaw that is exacerbated by the [i]language itself[/i], much like C++ has the aliasing problem. Some quick googling suggests that some research has been done into virtual machines that can do object inlining. I don't know if such changes are in the production JVMs, but if not this again points to [i]implementation issues at heart[/i] - just the implementation must be more complex because it gets no help from the language.

[quote]
And if Java is so good, it would've been used for coding commercial operating systems
[/quote]
[url="http://en.wikipedia.org/wiki/Mu_(negative)#Signifying_.22unasking.22_the_question_or_similar"]Mu[/url]. I don't write Operating systems, I would wager that most people here do not write operating systems. Especially the beginners amongst us. I utterly reject this as a meaningful metric of a language's "goodness".

Whether there are 100 commercial operating systems written in Java, C#, javascript or even Basic, it is of no consequence.
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