Difference between java and c++ in games

If you like the “click everything” approach of Unity but want an open-source library, you may want to check out Godot. It has a fully open-source license like JMonkey, so you can do pretty much whatever you want with it without needing to pay anyone. While its “visual scripting” is a bit obtuse, its primary GDScript language is pretty easy to pick up (especially if you already know Python), and it has support for C# and C++ as well if you really need it. I haven’t done much extensive 3D work in it, but I do very much like what I have seen so far, and would take it over Unity or Unreal any day, if at least for stability more than anything else.

Alternatively, if you want a “code everything” C++ library, The Urho3D looks pretty good. I haven’t tried it myself yet, but that is where I would look first.

That said, the general wisdom is that while you can often technically squeeze higher performance out of C++ applications compared to Java (even though the gap is pretty small these days due to the JVM’s remarkably high optimization), your code will be hampered by a lot more obscure bugs simply because C++ is pretty hard to code for and is prone to these bugs in a way that Java isn’t.

As far as rendering goes, though, most of the work is ultimately offloaded to OpenGL anyway, so it doesn’t matter too much what language you use, as long as the engine isn’t doing anything too stupid. Our recommended physics library, @sgold’s Minie, also offloads its work to the Bullet native library, so the Java/C++ point is rendered moot there as well.

In the end, I would just recommend using pretty much anything besides C++ if only for saving on headaches. C++'s manual memory management may seem handy for games at first, but it is often more trouble than its worth, and Java has a pretty decent garbage collector anyway.

5 Likes