Why Minecraft is a Technical Feat | Explaining the Engineering Behind an Indie Icon

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi my name is Gabe and today I would like to talk about some of the technical difficulties of a game most of us are familiar with this game is the result of countless hours of effort from several different teams of people over the course of a little over a decade most people see a simple game that could have come from the 80s but seems to be a simplistic retro game on the surface is actually a complex problem that was waiting to be solved for those of you that don't know minecraft is a sandbox game or you can create anything you want and have infinite terrain to work with the concept for a game like this has been around for over 20 years however the technology available at the inception of this idea was not strong enough the reason it was not strong enough is because the key component that makes a game like this possible voxels voxels are essentially pixels extrapolated to three dimensions we all know what a pixel is it's the smallest part of a picture on a computer using pixels for art was the standard when making games in the 90s a team of developers thought hey why not bring this to the third dimension as they began to develop a game that would use this concept the only problem was that the game industry was shifting towards the concept of using polygons so their game outcasts got left in the dust the shift in the game industry led to the standard form of polygonal rendering done on the GPU this can be seen in early 3d games and is prominently featured in most triple-a games today this meant that voxels would take the backseat of the gaming industry for the better part of another 10 years while polygonal rendering reached new heights that is until a Swedish video game programmer Markus notch Pearson decided to make a fun little sandbox game inspired by games like Dwarf Fortress and infiniminer knotch decided to embark on a project that he envisioned would be a mix of his favorite games in an RPG I could go on describing the history of Minecraft evolution but instead I want to highlight some of the difficulties that would come with trying to make the game like I mentioned before voxels the main feature of Minecraft were concept that had been around since the 90s but minecraft would take them to new heights the same problem that persist in the 90s still plagued notch as he tried to build this that problem being how do you efficiently render a game world that can be completely destroyed and reconstructed at the players whim well the hardware had improved enough to be able to handle this as you can see from the game minecraft consists of thousands of cubes that the player can break in place all over the world the logical approach would be to build the game in exactly that manner that is let's write a program that places a bunch of 3d cubes everywhere to create a world this is where we encounter our first problem you see the way a computer's GPU works is that the less geometry it has to deal with the faster it will run if we dissect a simple Minecraft cube we can see that it actually contains several different components one cube contains eight vertices 12 triangles in six phases each face with a unique image and that's just for one cube imagine that we continued to do this for entire world we simply start placing these simple pieces of geometry all over until a world starts building we start to run into a problem though minecraft standard settings for chunk radius is 12 that means there are 12 trunks surrounding the player to the north the east the south and the west each chunk is 16 by 16 by 256 blocks that means that each chunk consists of 65,000 blocks that is 790,000 triangles in comparison most overwatch characters only have around 60,000 triangles I hope you can begin to see the problem here the solution is pretty straightforward don't render all the blocks there's no sense trying to render all the blocks because the majority of the faces are being hidden by other blocks so you just need to find a way to remove the faces and vertices of unseen blocks this involves a complex process of using a predefined algorithm to create a mesh which is a collection of vertices that contains all the visible faces the mesh is basically just combining all the blocks into one big weird shape this can reduce the try count up to a tenth as many tries now that you can remove the faces of hidden blocks in each chunk you might want to remove the faces of the blocks between each chunk this will continue to reduce that try count in a typically solve our first problem which was reducing the try counts that we can render enough blocks on the screen we may have solved some problems but the problems above pale in comparison to another problem that loomed in the distance minecraft is seemingly infinite and can generate completely unique worlds every time you play how in the world do you create a completely unique world that still looks good and is fun to explore how can you create such complicated yet ordered thing like land that is structured yet chaotic this same question plagued a man named Ken Perlin Ken Perlin was tasked with creating computer-generated imagery or CGI for Tron in 1982 he hated the way CGI generally looked in films it was too structured and he wanted a way to make it look more natural take for instance a mountain if you see a mountain silhouette in the distance you could almost draw the lines of the peaks in the valleys trace it with your finger and create a discrete image that describes that mountain line the line would rise and fall within reasonable limits never seeming too sporadic you're always seeming completely random this is the effect Ken Perlin wished to achieve with computer graphics so he developed an algorithm that can compute this random yet structured look for the movie and it later became a de facto standard for creating structured randomness and things from video games to cinematic effects like smoke and fire the basic premise used to create the noise is to build an n-dimensional grid based on how many dimensions of noise you want like two dimensions three dimensions four dimensions etc and then you draw a vector pointing in a random direction away from the grid point it's attached to you then compute the gradient which is the angle between the vectors on the sides of this to come up with a structured noise then you interpolate which is smoothing out those values to give it a more gradual feel the result of all of this is Perlin noise the way that this is used in Minecraft is by building a basic 2d height map that's a map of what the terrain would look like if you were looking down on it from directly above you can then use the pixel value a value from white to black and multiply it by the highest point you want your terrain to go to and Minecrafts case that's 256 then it will give you how tall that particular point in the map is supposed to be next you can throw in some variation of blocks based on the height like grass at the top and stone in the middle and you have yourself some basic terrain the final piece of the puzzle that's also solved by purling noise is reproducibility not only does Perlin noise create the random yet seemingly natural landscape but it also works on a graph patterns that you can continue to query points in any direction and get more noise that's how minecraft is able to create infinite terrain and continue creating as the explosion in any direction while it melds seamlessly together of course solving the problem with terrain and drawing the terrain onto the screen only takes you so far what about the caves the overhanging cliffs the biomes these were all questions that would be answered in due time as notch continued to develop the game with the help of his ever-growing team let's see how to solve the first problem Caves in Minecraft they're randomly placed cave systems that form vast complex underground worlds inside these cave systems are dungeons abandoned mine shafts and monster spawning holes the caves take random twists and turns and vary in size enough to represent what a real cave system might look like but how do you build these complex cave systems well you pick a point in 3d space determine this will be the end of the cave then meander through the world in a noisy way to create some tunnel system rinse and repeat this process a few times and you'll have some decent looking caves once again this seemingly simple concept is quite difficult to pull off in a natural-looking way enter Perlin noise Perlin noise comes into the rescue again we can use this Perlin noise to our advantage to create some good-looking caves the specific method that is used in cave generation is something called purlins worms this uses the same basic concepts as the terrain generation but it extends it to three dimensions the third dimension helps determine what angle to branch off in at each turn then you simply pick a random point in the world and begin to use this noise to branch off in several different directions this is most likely part of the method that was used to generate Minecraft caves [Music] the next interesting feature that needs some explaining is how biomes work a biome is just a type of ecosystem we see present in the real world things like deserts swamps mountains and jungles are all examples of biomes one of the biggest problems when it comes to biomes is placing natural biomes next to each other for example a desert should not be placed next to a jungle initially minecraft used the following method to ensure that two disparate biomes were not placed next to each other this method was to create a lookup chart that contains precipitation and temperature mapping to some biome then you create two more Perlin noise maps the same way that we created the terrain and then you use those maps to assign temperature and humidity to each part of the world then you would use a lookup chart and the purlins maps to determine what type of biome each part of the world is if it's drying hot you have a desert dry and cold the Arctic wet and hot you have a jungle and so on and so forth the only problem with this approach is that as more biomes get added it's more and more complicated to keep the lookup chart going so the Minecraft team decided to ditch this and use a simpler solution dialogue for disparate biomes to be placed next to each other rivers instead of trying to blend biomes together you can just have a hard line of separation and the separating line is the river this reduces the need to make sure that each biome is predefined in a complex chart and allows multiple biomes be added with relative ease creating rivers is also pretty simple we just find the line of separation between the biomes and put a river there [Music] now that we have interesting worlds being generated with complex caves and varying biomes we have to deal with the issue of how to light it all up in typical modern triple-a games lighting is calculated as much as possible before the game is even run this is done through a process called baking the way this process works is by taking a mostly static scene think of an indoor scene where objects don't move and then processing all the shadows on all the objects before the games run all this information is then saved and unloaded once the game starts running minecraft is completely random every time you play so there goes the idea of baking this rather large problem was also solved in quite an ingenious way instead of calculating lighting using photorealistic methods which is what most triple-a games would do minecraft chose to stick to a stylistically simple method that looks fine in a cartoonish game this method involves a few different things the premise of the solution is to store the light level of every single block in the world this light level would then be used to determine how bright that specific block is the first step to calculate this light level is to start at the top of the world which means why level 256 next if there are no blocks on the top layer then each block is marked as having a full light level which is 15 the process continues downwards if a non transparent block is hit then the light level underneath that block will take on a mixture of the values to the left and the right and the bottom of it so if you have one block that's floating in the air the empty space beneath that block would have a light level of 14 since this is the next smallest value from all the spaces around it as you continue downwards the light level of the block directly above you takes precedence over the light levels to the right and to the left this means that lighting can now be calculated and stored the same way that all the blocks are stored in memory it also means that the lighting no longer poses a large threat to the GPU there is one more complication in this lighting schematic though and that is light sources that can be placed in Minecraft you have items such as torches glowstone and that can be placed and give off light these are actually quite easy to integrate into the current lighting system because they simply change their source box light level to a level of 15 and then all the source blocks around them follow the same rules as outlined above this gives minecraft a unique advantage over almost all other games and the fact that you can place unlimited light sources this is almost impossible to do in games like Call of Duty because all the lighting in those games are calculated to be photorealistic and having too many light sources can slow down the GPU tremendously as you can see this game keeps getting more and more complex by the minute and we aren't even close to having all the features that modern-day minecraft has I hope this is enlighten you to just how difficult it is to not only create a game but to create a groundbreaking game an innovative game and most importantly a fun game minecraft may look simplistic and easy to create but underneath that guise of simplicity is a vastly complex web of problems that all had to be solved over the course of a decade and are still being solved to this day this concludes the brief look into some of the many complexities of the game Minecraft I hope you guys enjoyed it thanks for watching you [Music]
Info
Channel: GamesWithGabe
Views: 2,200,749
Rating: undefined out of 5
Keywords: gameswithgabe, games with gabe, Minecraft, How does minecraft work, why minecraft, how to code minecraft, how minecraft was made, minecraft internal workings, how minecraft does world generation, how minecraft does biome generation, how minecraft does cave generation, perlin noise, perlin worms, biome generation, minecraft lighting, infinite light sources, indie games, minecraft documentary
Id: fjZAgoxFKiQ
Channel Id: undefined
Length: 14min 18sec (858 seconds)
Published: Mon Feb 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.