I Made Minecraft but with Realistic Physics

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] lately i've been spending a lot of time playing a game called minecraft you might have heard of it you know the one with the blocks and the blocks and after spending countless hours building questionable structures and committing virtual war crimes i've made the realization that minecraft may in fact be one of the greatest games of our time it's a game of infinite possibility to recreation delimited only by your imagination and the capabilities of your computer sure it may not have the best graphics or the most realistic physics but i think that that's actually what makes minecraft so special the simple graphics combined with a slightly inaccurate physics removes players from the restrictions of the material world allowing them to create pretty much whatever they want and i won't be having any of that you see when i make a game i don't want the players to be creative or fun no i want a game that makes people suffer and feel pain which is why today i'm going to be ruining countless childhoods by completely and utterly destroying everything that makes minecraft good and adding realistic physics to minecraft we've got realistic falling blocks next generation ragdoll technology and the wobbliest most nauseating gameplay the world has ever seen [Music] let's get to it so in order to add physics to minecraft you first need a minecraft obviously now i could have tried to make a minecraft mod or something that adds physics to the actual game but writing an entire physics engine sounds like a lot of effort and math and i'm not a huge fan of either of those so i opted for the next best thing instead of adding physics to minecraft i'm actually going to add minecraft to physics by recreating the entire game using the unity game engine which has a very nice built-in physics engine that that seems logical right let's get started so as you probably know minecraft has infinite procedurally generated worlds made up of blocks or voxels and it's in these worlds that all the minecrafting takes place so that was what i decided to try to replicate first i started off small with a little one by one unit dirt block which is just a cube with a dirt texture scribbled on then i made a simple script that spawned a bunch of these blocks in a grid just like in minecraft however unlike minecraft these blocks aren't too exciting and lack a certain depths to them so i threw in a bit of perlin noise which is a type of randomness that can be used to generate maps sort of like this to offset the cubes and now we have some wavy hills cool that's it right we have our terrain now all we have to do is add more cubes and make the world a bit bigger and oh right apparently having this many cubes in the world at once isn't great for performance luckily there is a pretty simple solution instead of making tons of cube objects we can instead create a single object that is shaped like multiple cubes which should be pretty efficient and since the world is made up of cubes this should be pretty easy as all we have to do is manually create squares depending on where the blocks are update the colliders yin out for collision and let unity handle the rest and so after a few trips to stack overflow in a couple of voxel generation tutorials i managed to get this set up pretty cool a world is looking as stylish as ever and my computer is no longer screaming in pain but it's still a little small and minecraft worlds are infinite which is a bit of a problem but this too has a simple solution you see the world in minecraft seems infinite because of something called chunks basically each chunk is well a chunk of blocks in minecraft these big boxes 16 by 16 blocks wide and 256 blocks high that contain all the blocks inside this area in minecraft saves these chunks and loads in the closest chunks to the player and if the player moves to another chunk it unloads the old ones and loads new ones which allows the world to be very very big since there are always only a set number of chunks active at any given time so i implemented that by basically just storing our chunks in the dictionary which is a fancy data structure that lets me map each chunk to a coordinate and loading unloading or generating new chunks every time the player moves to a different chunk i'm using this dictionary and yeah loading and unloading already existing chunks around the play works flawlessly and the performance is pretty good since we're just getting the chunks from the dictionary and setting whether or not they're active however generating these trucks for the first time can be pretty slow since the game has to do quite a bit of processing to generate the terrain and meshes and stuff and due to how unity scripts all run on the same thread which basically means that they run in order one after another all of the other code has to wait for the chunks to be generated before they can be run in other words the chunk generation lags a lot so i decided to make the terrain generation multi-threaded which allows multiple bits of code to run at once and so after many hours of frustration and a couple more trips to stack overflow i managed to get it working now the terrain generates in the background separately from everything else which means that the game doesn't lag anymore which is pretty cool i then threw in a very basic player controller to move around in the game and we now have a functioning minecraft world the terrain generation system works pretty much the same as an actual minecraft and chunks will load and unload around the player which allows for pretty much infinite worlds at least as long as your computer doesn't run out of memory the noise library i'm using doesn't start screwing up with huge numbers like what happened with the minecraft farlands and unity decides to behave however unlike the terrain gender minecraft everything is well made of dirt so let's spice it up a little i wasn't all that happy with the boring old hill so i layered on a bit more purlin noise to spice up the surface and added some 3d parallel noise underground to get these cave sinks i also turned lower blocks into stone put some bedrock on the bottom turned any exposed dirt blocks to grass added a couple ore blocks and some more generation and made trees randomly appear and now it's starting to look a bit like minecraft keyword being look because it's sure as hell doesn't play like minecraft so let's add the player into the game now in high intensity action-packed games such as minecraft good responsive controls are very important without them games can be really difficult to play which can cause a lot of frustration which is exactly why i decided to make the player the wobbliest ragdoll man you could possibly make well technically he's not a ragdoll or a man he's actually just an invisible capsule saying because in actual minecraft when you're in first person mode you can't see your body so that's why you can't see your body in this game either definitely not because i was too lazy to make a body or anything but anyways our being here is essentially just a rigid body with some scripts i've set it up so that pressing the wasd keys applies force to move it like a standard first person controller except with one key difference being that the force is actually applied at a point slightly above the center of mass so moving around will cause it to tilt then i apply torque or force to the rotation to try to balance it and it's great whenever you do it touch anything it starts wobbling uncontrollably and causes uncomfortable levels of motion sickness and finally i added a healthy amount of post-processing and motion blur to really rub in the motion thickness and that's pretty cool we basically have really really bad minecraft now except well you can't mine or craft so i think it's time we added destruction now in minecraft if you want to break a block you just have to point at it and click which is far too convenient and easier for my tastes even with a player as wobbly as this one i want the players to really struggle into suffering to just have a bad time all around which is why i took a hint from famously frustrating games like getting over it and made the player's hand a rag doll and in order to mine you have to physically hit the block with your limp noodle hand it's just great i basically created this nightmare of game design by first modeling and rigging a hand in blender no not that blender the 3d modeling tool although judging by the quality of this model i might as well just use an actual blender but anyways i then took this model over to unity and gave it the gift of life i also gave the arm just the slightest bit of strength so that it isn't a complete wet noodle and at least has a bit of resemblance to an arm then i slept on a pickaxe and now you can break things by left clicking which swings the arm and activate the script that handles collisions to break blocks i then threw in a bit of unity particle system to make it look nice and made the block drop a smaller version of itself for the player to pick up and yeah i am ready to mine but wait there's still something missing you hear that it sounds like inaccurate physics and we can't have any of that so let's do some physicsing so basically our problem is that when you separate blocks from the ground by breaking other blocks things float which last time i checked isn't very realistic so let's make them fall we're gonna have to do a bit of scripting for this one basically your problem of objects floating happens whenever you separate a cluster of blocks from the ground by breaking the block holding them together so all we have to do is run a check where whenever we break a block we do a flood fill which is a way to loop through the block starting from the block we destroyed outwards to find any separated objects and check if anything is floating and we'll stop searching after a certain amount of blocks have been searched which should save a bit of processing power and also prevent the entire world from falling this does mean that really big structures won't fall but i highly doubt anyone would actually be able to create a structure of that size with these janky controls so it should be fine then if we find any floating segments we'll just separate those blocks from the chunk slap on a couple of box colliders for accurate collisions and add a rigid body to make it fall now at first glance you might think that this approach is pretty bad since we're looping through tons of blocks every time we break one and you aren't wrong however it actually doesn't run that badly due to how we aren't actually searching that many blocks and the code is pretty optimized and is essentially just looping through an array of integers which is pretty fast then i applied this to the blocks that have already fallen using some additional bits of mass and now you can break them into even smaller pieces which is pretty cool so now we can break blocks the next logical move is to add placing blocks so let's do that now placing blocks in the actually good version of minecraft functions pretty much the same as breaking them you point and then right click however i once again wanted more physics so instead of making blocks magically appear the hand will throw a mini version of the block which will place a block on whatever it hits it also bounces off the physics enabled blocks because i was too lazy to make them build onto them but i think it looks better like this anyways and you can do some pretty cool trick shots so it's here to stay the way i made this was very similar to how i implemented breaking blocks except this time the arms rose the block and it works great placing blocks is now not only realistic but also nearly impossible to do well which i'm sure will be great in a game about building things however that reminds me minecraft isn't just about building it can also be about adventure and discovery and that isn't all that fun to do alone so let's make some friends i started off with a zombie first because while i haven't met one in person i'm sure they're friendly right anyways i modeled and rigged it in blender slapped on some textures i downloaded off the minecraft skin website and then stuffed it into the unity ragdoll generator and now he's floppy maybe a bit too floppy i don't want him to act like he's dead all the time i want him to be well undead so i added some code to balance him and to make him walk it basically works by first applying forces to balance it just like with the player and to get it to walk i use some inverse kinematics which is a way to tell foot to go to point by bending leg basically it keeps the foot firmly planted on the ground then if the foot gets too far from the body it just steps towards the body where it sticks to the ground again and yeah he's alive that's just great but now it's time for the next step teaching him to feel pain so i made a sword in blender reuse the code for breaking blocks and now i can do very bad things i then added copious amount of blood and made the zombie completely ragdoll and dust and yeah pain and suffering but now that our zombie guy can feel pain i think it's only fair if the player can too so i made the zombie flail it's armed at the player and added a health bar and deaths that's just great real good stuff however while the player is now able to feel a pretty good amount of pain i still felt that it wasn't enough and that's because while zombies do quite a bit of damage they don't naturally spawn in the world yet and i've just been manually placing them in so there are no zombies to actually do damage in the actual game so i made a spawning system and began learning about shaders so i could throw together a little day night cycle since zombies only spawn at night but this ended up being kind of useless because i decided to make zombies spawn during the day also because i wanted more pain but hey we have pretty sunsets now and things are looking pretty good we have what is basically a fully functional game but i still thought that there was something missing i mean we have a sword and a pickaxe and some blocks but that's pretty much it so i added a gun yep gun in minecraft why no idea basically how it works is that it's a gun you can shoot things it breaks blocks it breaks enemies it's the jack of all trades well it's really more of a master of all trades because it's very overpowered so to balance this out i decided to set up an inventory and a crafting system well sort of the inventory is really just a counter for the seven items in the game that you can actually obtain and crafting is just a menu with a button because i am lazy also there's only one recipe you can craft which is the gun because i actually decided to make the player start off with the diamond pickaxes sword because the pickaxe is the only thing besides the gun that can actually break blocks so you kind of need it and the sword matches the pickaxe so yeah and finally i went and added a main menu where you can change all sorts of settings and added some sound effects and now it's really starting to look like minecraft you can mine for ore craft things build things explore commit war crimes it's perfect in fact i'm pretty sure this game has almost everything minecraft does save for a few minor things like a few blocks a couple mobs and water but i'm sure no one will notice and yeah this was making minecraft but with physics or something i'm not really sure i just made this video because i wanted to mess around with ragdolls but hey the end result turned out pretty good so if you want to torture yourself you can try playing it to the link for the download below it's completely free and it's pretty cool but yeah that's all if you want to see more dumb videos like this and there will be many more very dumb videos then consider leaving a like and subscribing and turning on notifications and all that good stuff okay that's enough begging for now i'm gonna go see ya [Music] so
Info
Channel: Steven
Views: 5,235,912
Rating: 4.9148231 out of 5
Keywords: minecraft, programming minecraft, unity, unity3d, i made minecraft, minecraft in 24 hours, coding minecraft in one week, minecraft realistic physics, voxel game, voxel physics, minecraft in unity, procedural generation, how to make minecraft, minecraft clone, devlog, game development, floppy minecraft, ragdolls, minecraft ragdolls, i learned how to make 3d games in one week, Steven, Sam Hogan, Dani, computer science
Id: 2gle_F522ng
Channel Id: undefined
Length: 14min 1sec (841 seconds)
Published: Sun Sep 13 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.