I Made Minecraft in 24 Hours

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Here's the code if anyone's interested

πŸ‘οΈŽ︎ 9 πŸ‘€οΈŽ︎ u/samverse πŸ“…οΈŽ︎ Feb 28 2020 πŸ—«︎ replies

Ypu should turn off the "shininess" or what you call it. The way ambient light bounces on blocks look very bad for a Minecraft game (the unit standard)

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/AnonymAnonymsson πŸ“…οΈŽ︎ Mar 01 2020 πŸ—«︎ replies

Do you mean 1 day of normal work, or 24 hours of development time? (big difference between the two).

Either way, great achievement, well done!

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/AlwaysGeeky πŸ“…οΈŽ︎ Mar 02 2020 πŸ—«︎ replies

This is great! Good job!

One question I’ve always had is if you’re doing chunk meshing, how would you highlight/outline a single cube like Minecraft does when you aim at it?

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/d4v1d04 πŸ“…οΈŽ︎ Mar 09 2020 πŸ—«︎ replies

Do you have any tips for reducing lag caused by removing / placing blocks?

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/micke_i_backen πŸ“…οΈŽ︎ May 20 2020 πŸ—«︎ replies
Captions
here's the challenge I have one day to make Minecraft using the Unity game engine the goal is to have a blocky voxel based world infinite procedural terrain generation and the ability to place and destroy blocks that's all minecraft is right and because I hate myself I'm not allowed to use the internet except for downloading a noise library before starting sono tutorials not even Stack Overflow so it's about 8:40 let's jump in and fire up unity I first got to work on terrain generation we'll start simple with a 20 by 20 grid of cubes and once I figured out how coordinates work looks like we've just got one big rectangle but we can vary the Y position of each individual cube to get something that looks more like terrain to accomplish this we'll need some noise not that kind of noise Perlin noise Perlin noise is an algorithm that gives you random but smooth changes between inputs here it is in two dimensions which will be great as a height map for creating hilly terrain and here's what we get just throw in a first person character controller and there it is minecraft thanks for watching actually we're gonna have to take a step back because there are some problems with using full cubes and a 2d grid go up to 200 by 200 which is like was that 40,000 cubes and the performance is pretty bad also a cube can't be more than one unit higher than its neighbors or you see gaps in the terrain and mining caves and other things become impossible to implement so instead of a bunch of separate cubes we'll try using chunks of multiple blocks that have more optimized meshes if I can actually figure it out we'll start with some very basic mesh generation and we've got a squid though a square and you won't believe what I created next two squares now it seems like I'm just taking a long complicated path to making a cube but now we have some more flexibility here's how this will work we'll loop through each block in the chunk if it's a land block and there's an air block next to it we'll build a square facing that direction if it's another land block then we won't bother building a face because it's just inside the ground just add the Perlin noise back in and here's what we've gotten an optimized terrain chunk and as you can see it doesn't actually contain any full cubes now our original terrain generation script will be responsible for generating the voxel data and spawning in and out the individual chunks so now we can generate a bunch of chunks with seamless transitions between them oh maybe maybe not one second seamless transitions between them throw on some mesh colliders and there we go the performance is much better and we can add some much cooler stuff such as infinite terrain generation so I made a dictionary to keep track of the chunks and wrote a function to load them in around the player whenever you enter a new chunk now unload the chunks that are too far away and just like that welllike like 30 minutes later but just like that the chunks load in and out alright time to show off my art skills and make some textures for our world [Music] [Music] we'll have to put all the tiles onto a texture Atlas because the mesh chunks have to use a single texture and for some reason changing the texture changes how the terrain is generated okay a nice textured world [Music] I'm not sure but I think it's possible that minecraft has like mining maybe so let's add the ability to modify terrain to do this I made a new script that will shoot a ray cast where the player is looking and then use a little math to figure out what block to modify here is that code to update a chunk just edit the voxel data and then regenerate the mesh now we can left-click to place a block and right-click to remove one now for the part I'm really excited about more interesting terrain generation this noise library I downloaded has functions for 3d Perlin noise meaning we can do more complex stuff like caves and overhangs another thing we can do is add together multiple layers of 2d noise at different scales which will give some more variability in our surface terrain multiplying two layers together has another effect making some regions more hilly and some more flat [Music] caves what we'll do here is just generate the land we had before and then cut pieces out of it with some 3d noise and we've got some cave systems just so the caves aren't everywhere we'll create a mask using you guessed it yet another layer of noise next I added in some stone blocks by creating a height map that's lower than the surface and turns dirt blocks into stone and we'll give it enough variability so the stone will sometimes make its way to the surface because minecraft wouldn't be very fun if you die in a few seconds due to lack of oxygen we need to add in some trees this was a little tricky because I needed more than just a noise function if a chunk is destroyed and then loaded back in the exact same trees should be regenerated [Music] so basically I just used a random number generator seeded with the coordinates of the chunk this way each time it's loaded in the exact same sequence of random numbers is produced building the same exact trees [Music] next up is water unfortunately I can't really just make a water block and call it a day the water actually needs to be a separate mesh on top of the already existing terrain chunk so we can do things like use a different material and walk through it and this is actually really simple to implement just kidding what I ended up doing was creating a simplified version of the terrain chunk called a water chunk and after quite a bit of struggle I figured out how to get it to form around the terrain this is so it's not inside land and covering up cave entrances we're close to being done just need to improve the graphics a little bit and add an inventory I totally forgot how to make a skybox and eventually stumbled upon this shader which I would later figure out was not the best one to use it sort of looks like you're in a giant cube and maybe that fits for a Minecraft world but it still looks terrible it's about 8:30 which is 12 hours since we started next I worked on adding an inventory I made some UI and an inventory script that will hold the counts of the four possible block types and when you place or mine a block it will just adjust one of these counts and for some final graphics improvements I adjusted the lighting added in a little too much post-processing went through about a million iterations on the skybox before I got it looking decent and I redid the leaves tile and I think we're actually done minecraft now I don't have to buy it I can just play my knockoff version [Music] [Music] so that was minecraft in 24 hours as for the no internet part I only looked up like one or two things that I was really stuck on so I'll say it was a success and if you want to look at the code I will upload the project to github I guess that's it [Music]
Info
Channel: Sam Hogan
Views: 11,761,588
Rating: undefined out of 5
Keywords: minecraft, programming minecraft, unity, unity3d, procedural generation, voxels, game development, gamedev, minecraft in unity, unity game dev, indie game dev, programming challenge, coding challenge, minecraft in 24 hours, devlog, devblog, minecraft tutorial, perlin noise, simplex noise, unity perlin, computer science, voxel game, voxel engine, how to make minecraft, software engineering, computer programming, minecraft clone, coding minecraft in one week, coding minecraft
Id: Nj8gt_92c-M
Channel Id: undefined
Length: 13min 28sec (808 seconds)
Published: Thu Feb 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.