Can I make Minecraft in one day without the internet?
So I was bored and decided to bust out the good ol’ unity game engine and see how just hard it would be to create the classic blocky voxel sandbox game. To make it interesting and really test my skills, I wasn’t allowed to access any external resources/tutorials/code.
→ Download for some reason:
→ Download the source:
→ “Funky Monkey” & “Out of Pentatonic Scale” by Antti Luode
→ “Mirrorball” & “Emotional Wilderness” by
→ “Break Out” & “Blam” by DST – nosoapradio.us
I started off with basic terrain generation, using cube gameobjects arranged in a grid, whose heights are varied by a perlin noise function. This, however, led to not great performance, but luckily I knew of a way to significantly optimize things.
This was using terrain chunks – which is what the actual minecraft does as far as I can tell. This meant using voxel data to only build faces of blocks that are facing air blocks. And because the voxel data is 3D, it’s possible to have much more interesting procedural terrain generation, like caves, overhangs, trees, etc.
It’s super fun to play around with the different noise functions and see what type of terrain is generated. I ended up doing some simple stuff which looks pretty good: A base layer of simplex noise at a large scale + another layer at a smaller scale that is multiplied by yet another layer for terrain variety. This is the height map. Then 3D simplex noise cuts pieces out to create cave systems.
Procedurally generating trees and water were both a little tricky. For trees, I used a perlin noise value at each chunk coordinate to determine how many trees would be in each chunk. Then, a random number generator seeded with the chunk’s coordinates was used to build the specific trees. This way, the exact same random numbers are produced each time for a specific chunk, and the same trees are generated.
Water had to form around the terrain, so you don’t have weird stuff like finding water when you did straight down. What I ended up doing was creating a separate mesh for the water. To build it up, just loop through each xz coordinate in the chunk, for each starting at the max y position and move down through the voxel data, checking if land exists. If the water level is reached before the first land block, build a square at the water level.
There’s some boring stuff cut out of the video, like optimization. I did things like add an object pool for reusing terrain chunks and add a timer to load chunks one at a time instead of all at once. The performance is still not great, which is mostly due to all the noise function calculations. This could probably be fixed with multithreading, but there’s no way I could figure that out without internet help.
I finished this project off when an inventory, a skybox, and some graphical improvements. The total elapsed time from start to finish was about 14 hours, and the total time I spent actually working on it was around 11 hours. This was minecraft in 24 hours with #Unity3D.
—- Other Minecraft Programming Challenges —-
→ “Coding Minecraft in One Week – C++/OpenGL Programming Challenge” by Hopson –
→ “Minecraft in Unity 3D [Flashing Images] – One-Week Programming Challenge” by Shane Beck –
→ “Coding Minecraft in ONE DAY (Timelapse) | Unity3D” by TechBox –