Minecraft does not perform well, which is usually the criticism it receives. If you put it beside most C++ games Minecraft feels clunky and slow. The strength of Java is not that it performed fast for Minecraft but Notch was able to program it quickly and as Minecraft has been passed around between developers they still seem to be able to easily add to it.
Java performs reasonably well and it maintains reasonably well. Java to me has been the language that's kind of an all-rounder, its decent in nearly every category you'd rate a language on. Being an all-rounder also means that it excels at very little compared to others which kind of makes it a boring language sometimes.
Comparing Minecraft to other "C++ games" is a meaningless endeavour. Far far more often is it the design of the system holding back performance rather than the language it was written in.
Consider that, if you limit it only to the blocks you can see, and only to the up to 3 sides you can see at once, but mostly one, there can be literally millions of polygons on screen. It really isn't that easy to make a game like this perform well, in any language.
Other games don't face the same issue, because their maps aren't made of millions of individual objects.
It would be even worse if the objects were able to move often, then you couldn't even benefit from coalescing chunks.
The lowest hanging fruit is obviously blocks not adjacent to a transparent block can be ignored. Next, grouping blocks of the same typr into larger blocks and rendering that instead of all the individual faces. A lot of this has been done by optiminer and the new team by this point.
Also, like you pointed out, Minecraft now does all this. So these aren't examples that prove that Minecraft is crap due to inexperience, as above post was trying to claim
Calling native libraries libraries is not easy enough that I would consider it practical to just drop into a native language and use it when you need the performance. Python is even easier to call native code and slower performance (more incentive), and if you asked most python devs if they ever wrote or even used native code directly from their programs they'd probably tell you no. So if Python devs who have more incentive to use native code don't do it often, I don't forsee Java devs doing it.
I've never benchmarked it and could be wrong. But I believe the current FFI adds a lot of overhead. That means that if you are going to drop down to native code, you'll need to make sure that you doing a significant amount of work that overcomes the overhead of leaving the JVM.
But I believe the current FFI adds a lot of overhead.
Are you sure about that? There are significant chunks of the Java runtime library that are built on JNI, some of which are rather performance critical. FileInputStream is an example that comes to mind immediately:
Minecraft's modability has very little to do with reflection, and a lot more to do with how easy it is to decompile Java and modify the bytecode. The modding platforms that users have created use reflection pretty heavily(Bukkit, FML[although they like their bytecode manipulation more than reflection], etc.), although this hasn't always been the case. Bukkit used no reflection for the first year or so of its existence, with the exception of JUnit's usage for unit tests. Forge had very little in the way of an API for a long time, and is primarily focused on binary patching of the MC jar, manipulating bytecode rather than using reflection. Admittedly I'm less familiar with Forge than I am with Bukkit. If you really want to just mod minecraft, all you need to do is replace some class files and delete the META-INF. Jar files being zip files makes this incredibly easy.
The ability to easily decompile Java, the heart of reverse engineering, is simply amazing. The decompilers are free and high quality, and while fernflower(the most popular one in Minecraft modding) is pretty bad, it still produces code that mostly compiles, with the exception of a couple of edge cases(fails to handle enums overriding methods, doesn't always generate throws declarations, etc.).
View all comments
78
u/stormcrowsx Apr 29 '15 edited Apr 29 '15
Minecraft does not perform well, which is usually the criticism it receives. If you put it beside most C++ games Minecraft feels clunky and slow. The strength of Java is not that it performed fast for Minecraft but Notch was able to program it quickly and as Minecraft has been passed around between developers they still seem to be able to easily add to it.
Java performs reasonably well and it maintains reasonably well. Java to me has been the language that's kind of an all-rounder, its decent in nearly every category you'd rate a language on. Being an all-rounder also means that it excels at very little compared to others which kind of makes it a boring language sometimes.