5 ms·
Minecraft 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
by hacker_9 11y ago
Minecraft 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
- gregstula 11y ago> Unreal's game-level memory management system uses reflection to implement garbage collection. Yep. Game-level garbage collected C++. Which is exactly what I said, I just a didn't mention GC on C++ to avoid obscuring my point. I promise you the code at the game-engine-level is manually memory managed C++
- greggman 11y agoYou do realize that reference counting is considered a form of garbage collection right? https://en.wikipedia.org/wiki/Garbage_collection_(computer_science) https://en.wikipedia.org/wiki/Garbage_collection_(computer_s... BTW: I've written 6 engines for AAA games. 3 of them used reference counting. AAA C++ games use garbage collection all the time. Maybe yours didn't. Mine did. Unreal does. So does Unity
- CyberDildonics 11y agoThat's like saying World of Warcarft uses garbage collection because it uses Lua. The higher level language on top of an engine isn't what was being talked about since Minecraft was written completely in Java and thus dealt with the garbage collector at every level.