UEVoxelCraft

Minecraft clone using Unreal Engine 4

Overview

UEVoxelCraft was one of my experimental projects during my time at CyberSoul. We created this project to understand different aspects of memory optimization, procedural generation, inventory system, and day/night cycle. Fully implemented in C++, UEVoxelCraft performs perfectly on PCs and can be a very helpful voxel-world-generation guide for others.



Technical Overview

As stated above, UEVoxelCraft was my attempt to recreate and understand the secret behind Minecraft's performance of procedural generation. I figured out the concept of "Perlin Noise" which helped with the creation of randomized but structural (also known as "chaotic") generation of numbers. I used this random generation to create chunks of voxelized blocks, with each chunk consisting of a limited number of layers, representing each kind of block. This system could also be applied to create voxelized clouds, just like the ones we can find in Minecraft. My system was flexible enough to create various "biomes" based on the height and frequency of the noise, which could result in biomes like the plains or high mountain areas in the original game.
For the game to run as smoothly as possible, I and my programmer friend on the team had to find a way to get rid of the overhead of rendering sides of voxels that couldn't be seen from the player's position. We came across a solution to separate the voxel into 6 sides and decide on whether to render that side or not. It resulted in having a perfect removal of the unnecessary rendering overhead which helped us to get constant 120fps on our devices. I have to remind you that 120fps is UE4's default frame rate cap for games; More frame rates could be achieved even after turning off the frame rate limiter, and we still had consistent frame rates.
The inventory system was another challenge to overcome. We wanted to implement an inventory system that was flexible and still performs in a good amount of time and memory. We started by implementing a basic inventory with regular arrays and after hours of research and trial and error, we finally created the system we were looking for. The system worked perfectly with a UI system that represents the player's inventory and items could be dragged and dropped into other slots. This system helped us to learn a lot about how memory is managed, what soft and hard pointers are in UE4, and how garbage collection works in this game engine.
We also had some fun with lighting and tweaking directional lights to get effects like "God Rays" and bloom. I also implemented a day/night cycle that works at a customizable rate. All these together, and we had a Minecraft clone that we could run forever and never reach the world's end, and get back and still get the same world topology!



Take a look!

You can see our version of Minecraft using Unreal Engine 4 using the link below:
UEVoxelCraft video