4 ms·
I wonder what are the grand capabilities it lacks? Is C++ a more powerful tool filled with grand capabilities? It does not feel right, although it sure is a Swi
by kpil 10y ago
I wonder what are the grand capabilities it lacks? Is C++ a more powerful tool filled with grand capabilities? It does not feel right, although it sure is a Swiss army knife full of sharp and pointy tools in a "Don't look into laser with remaining eye" sort of way.
Is C a more powerful tool? Absolutely not. It's powerful but not that expressive.
Both languages are relatively low level and uses application memory management. I think it's only the latter that really matters when writing 3d games and other low-latency programs to be honest.
But I think the slow part of minecraft is the terrain generation, and I think it's mainly because the world is rather large and the algorithm is complex, not because java is slow or that the gc is a bad idea.
I don't think that the Windows 10 version run noticably faster, but I'm not completely sure that it's C++ and not C# and gc:d.
- pshc 10y agoJava has quite a bit of memory overhead which exacerbates Minecraft's inherently high RAM requirement. That plus frequent GC pauses make Java a suboptimal choice for Minecraft long term. (But it may have been the right choice for Notch back in the day.)
- chillacy 10y agoYea it's a vague statement for sure. Maybe "more powerful tools" means Unity or a game engine, but it's not certain, and that sentence will just keep looking strange to me.
- MichaelGG 10y agoMy kids run it on their X201s. The Windows 10 version is massively faster, providing really fast rendering. Minecraft 1.9 doesn't even seem to support setting the fullscreen resolution, so it's always pushing 720p. I'm not kidding when I say it's literally unusable: 1 frame per several seconds. Unfortunately the W10 version is very cut down, lacking lots of things. It's possible the main difference is OpenGL v DirectX on the Intel integrated cards. But the graphics are basic enough that there should be some way to render them quickly regardless.
- kpil 10y agoI must admit that I have not played Minecraft on any computer without a fast nVidia card. It could be the OpenGL driver that makes it slow in your case actually. I am not sure that the graphics are "basic" in the technological sense - Yes, the graphics have a retro-pixel look and no fancy shader-tricks, but there are a lot of large views and a lot of surfaces, and no cheating with a world box.
- matt_m 10y agoThe biggest thing compared to C and C++ (or even C# and Go) is probably the lack of user-defined value types. So if you want to create an array of Point2D objects, in Java it will be an array of pointers to heap-allocated objects (each with additional per-object overhead), which is really bad for cache misses, memory consumption, GC pressure etc. C# is a pretty similar language that is popular for game development (with Unity) but unlike Java it supports value types.
- kpil 10y agoI agree. It would be good with some kind of fly-weight allocation for a whole array of objects in java. How is garbage collection for arrays of value objects solved? Is the whole array gc:d, or what? If an individual element is referenced somewhere the array stays in memory?
- matt_m 10y agoC# works a little differently from C/C++ in that stack vs heap allocation is decided at the type level (using a 'struct' or 'class' keyword when defining the type). So you can't easily have one object have a reference to an interior Point in a Point[] array, since any Point instance variable will just be copied by-value and not be a reference. A Point in an array can be passed by reference into a function using the 'ref' keyword though, in which case I'd expect the GC to keep the whole array around until the function returns? (It seems hypothetically possible to optimize but kind of a niche case). If you need to, you can also actually use raw C pointers with an 'unsafe' keyword, that's outside of the GC though (useful for working with C libraries).