4 ms·
Do you know why Microsoft rewrote Minecraft in C++? Games can certainly be successful in spite of performance problems, but why purposefully introduce them in
by gregstula 11y ago
Do you know why Microsoft rewrote Minecraft in C++?
Games can certainly be successful in spite of performance problems, but why purposefully introduce them in the first place?
In the case of Notch, he used Java because he was most skilled at Java programming. The garbage collection, procedural generation, and multi-platform availability of the JVM allowed him to successfully release a massive hit as a solo indie developer.
At least that's one way to interpret it. Another way is that, had Notch been as skilled in C++ or (these days) Rust he could have made just as good of a cross platform game (even more so on mobile), that didn't concern itself with resource management outside of RAII and reference counting, was way more performant (no pauses), and in similar time frame as a skilled Java developer.
If you have a great idea use your favorite language. No doubt about that. You might be successful in spite of its specific deficiencies. However, if you are seeking a new language for a certain problem domain - like video games - choosing one with a feature that actively fights one of your fundamental goals (consistent framerate is only going to be a decision your users will regret you made.
It's funny that people like to say "users don't care what language it's written in". The fact that 8th graders know the the minecraft's garbage collector is a problem, suggests that using a garbage collected language for soft-realtime video games results in a seriously leaky abstraction.
- hacker_9 11y agoMinecraft is a special case, as the amount of voxels in memory and the constant loading and deloading of blocks of the map every few seconds, means that memory management is incredibly important to the game. That's why the C++ version was more performant, as John Carmack had full control of both the memory layouts and lifetimes, and could fine tune it all to fit the game. This is the only reason C++ is still in wide use today, in order for games to limit load times they have to do nasty 'unsafe' tricks (such as loading a block of memory from disk straight into an address space, and just assigning pointers to it), in order to get good performance. But if your game isn't open world (such as minecraft, GTA, Fallout), then using a garbage collected language will be fine (as long it's not stop the world, but runs concurrently).
- gregstula 11y agoCan you give me an example of soft real time game that isn't hurt by the presence of a garbage collector?
- hacker_9 11y agoAnything built with Unity, such as Cities Skylines. Additionally anything built with unreal engine [0] like Gears of War, the Arkham KNight series etc [0] https://wiki.unrealengine.com/Garbage_Collection_Overview https://wiki.unrealengine.com/Garbage_Collection_Overview
- gregstula 11y agoRight, you use C++ to build game engines, you can use scripting languages on top of that once the engine is built.
- greggman 11y agoI'm not sure what a soft real time game is. Here's two lists of some games with garbage collection https://en.wikipedia.org/wiki/List_of_Unreal_Engine_games https://en.wikipedia.org/wiki/List_of_Unreal_Engine_games https://unity3d.com/showcase/gallery https://unity3d.com/showcase/gallery
- gregstula 11y agoUnreal and Unity were built using C++. They offer garbage collected languages on top of their C++ game engines for scripting game logic. Any significant modifications to the engine will need to be done in C++
- greggman 11y agohttps://wiki.unrealengine.com/Garbage_Collection_Overview https://wiki.unrealengine.com/Garbage_Collection_Overview The link is for C++ garbage collection in UnrealEngine, not UnrealScript nor Blueprints