Remaking MINECRAFT 2D (Minicraft)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] it's been a couple months since my last programming video and i kind of decided since then uh 3d minecraft is on the outs you know minecraft is kind of a kids game it's super simple real easy sort of just uh overdone i think i'm like why not change it up let's do 2d minecraft in this video a completely different novel concept let's get started to explain a bit minicraft was actually originally made by the same guy who made minecraft back in 2011 in just two days for a game jam which is something like a speed game making competition for those of you who don't know i wanted to take the original concept of the game and sort of polish it up and expand upon it so i ended up giving myself a few extra days compared to the original so i could really make a solid game this also helps because i have a day job and i can't just kind of make games all day the original game was written in java and i know using low-level languages like c is hip and cool and all right now but i was getting pretty tired of memory management errors by the end of my last video so i decided to use java 2. and as i was getting kind of lazy with the language choice this time i also got kind of lazy with the art style and used the same sort of limited palette simple pixel art style the original game had the first thing to get squared away for the game was the renderer which for this game is actually super simple it's just made up of 216 unique colors on a 256 by 144 pixel display which was simple enough that i was able to get it working pretty quick and i could cook up this psychedelic looking palette test to make sure that everything was working [Music] so that all set up it was only about a half hour's work more to do the rest of the render and get it to draw sprites on the screen and afterwards it was time to start on the art and as you can see from the background here all the sprites are actually just done in grayscale they're just four colors each and they're colored at runtime so one sprite can become multiple different tiles depending on how it's used in the code these are the four unique colors is defined by three digits one for red green and blue from zero to six and each sprite is made up of four of these colors and unfortunately my pixel art skills are still kind of garbage and haven't really improved much since my last video but this time i was using screenshots of the original game to base my own sprites on which helped out a lot i also had the advantage of knowing exactly what sprites i would need for the game right from the start so i was able to get the bulk of the textures done for the game in one big three-ish hour long art session [Music] after the sprites were done next thing up was to get levels rendering which since this is a 2d game means just drawing a fat array of 2d sprites on the screen with some basic camera code to allow for x and y axis offsets and as i'm sure you all know this of course includes messing up a few times along the way as is standard practice so i also got these absolute beauties while i was working through the terrain rendering code but it wasn't too long before i got all the colors and tile connections worked out and everything was looking alright next up it was time to make this bad boy playable i started out by adding in entities or controllable movable objects and from there went on to add a player entity that could be controlled with the keyboard i used the player sprites that i drawn earlier clothed the player in a classically stylish red shirt and blue jeans slapped down some basic animation and movement code and shortly thereafter our boy was fully mobile and taking his first steps and not long after that with the help of a little more code he was swimming like a pro too and now that our cute little baby boy had taken his first steps he needed a better world to explore than this randomly generated trash that he'd been walking on up to this point so i started on world chat like with my minecraft clone i wanted to use some kind of random noise to generate the height map for my world so i did a quick little google found some nice looking codes slapped into my project and had some pangaea looking stuff up and running in no time and after that i threw down some trees tall grass flowers rocks beaches or just created the entire world out of nothingness and in a record time if you ask me and with the small task of bringing an entirely new reality into existence squared away next up i gave the player health and stamina stats and wrote the code for the a2d or heads-up display to show them on the screen i also added in some rare cacti wherever there's sand in the world and gave the player the all-important ability to punch things [Music] and if you're gonna punch things obviously you need something to punch them with so i started on the code to implement items and tools and gave the player the pal glove the default tool for the game [Music] and after hitting some stuff i realized it didn't quite look smashy enough so i programmed in some particle effects to fix that and after some time spent smashing rocks i thought to myself what may get when we smash big rock me get small rock though me also adds small rock [Music] and once a player starts smashing these rocks and picking them up they need a place to put their rock collection so i give the player an inventory [Music] it kind of turns out though that punching rocks with just a glove on doesn't work too good so i started on adding in more advanced tools for the player to use i went with the same set of tools that were in the original game sword pick axe shovel and hoe with three different materials iron gold and gem and also added in all the crafting stations to the game those being the oven anvil furnace crafting bench and then a chest for storage adding in tools also meant that i needed to give the player the ability to interact with the tiles in the world so picks and shovels could dig things up axis could chop things hoes could hoe things and swords could hit things all the player needs to do is pick the right item out of their inventory and that's what we'll use now that the player could hoe things of course there needs to be a farming system so i added in the ability to make farmland tiles by using a hoe on grass or dirt and wheat that could be grown with seeds obtained from destroying the tall grass that's kind of scattered around the fields also in the original game were these cool little numeric damage particles so i threw those on top of the smashy looking particles as well and as i'm very sure all you minecraft kiddos know very well any self-respecting craftomp game needs a decent crafting system so that's what was up next the menus were pretty simple to get working there are just three different windows to each crafting station one that shows what the player can craft one that shows how many of the selected item the player has and one that shows what resources the player needs to crap the selected item and then crafting itself is super simple you just go up to the station you want to use crafting bench furnace oven or anvil you pick the thing you want to craft and if you got the materials you kind of just glue them together you know slap a couple ingots on a couple sticks and you got it with the sprites and menus done i had to add in a way to access the menus into the game in minicraft all the crafting stations are a special kind of entity called furniture entities which can be pushed around and picked up by the player and after a little bit more coding you can see that in action here i can slap down all five of our furniture entities and push them around and after that i built out the rest of the crafting menu system for all furniture items and thoroughly tested out crafting benches furnaces anvils chests and ovens i also took the opportunity here to make sprites for and add in a whole bunch more items that could be used in the crafting system like glass which comes from melting sand gems which come from mining rocks bread and apple pie which you can make in the oven and apples and acorns which come from chopping down trees and even after adding all that fancy new stuff our boy here was kind of starting to wonder if this was all there is to life just punching and crafting it was the benevolent god of this world that i am i decided to cook up some more terrain code and add in an underworld with some spooky looking caves in it for the player to explore and mine in [Music] now the issue with adding in new levels is that there isn't really any sense of depth in this 2d sort of flat world so like the original mini craft the next best thing of course is to slap some stairs down on the map that you eat the player 600 feet down into the depths of the earth to get him into the underworld and after struggling with coding upstairs for a couple hours and a couple tweaks to the world gen code there were some caves accessible underground things weren't very interesting though so i put in some spiky little ore tiles for iron gold and gem and added in a new material mithril as the highest tier material in the game and after adding a couple more levels of underground with some fancy new rock types to give things a different look at each level all the basics for the caves were done even then though the caves were kind of lifeless so it was time to add in some baddies to go after the player now of course as was all the rage back in 2011 the original game had green slimes as the primary enemy so i added in some of those bad boys along with some tougher new blue and red slimes for the deeper levels of caves [Music] getting more entities to render around the world was easy enough but this was actually the first time i'd written any kind of ai for well anything but i think it turned out pretty alright in the end the basic idea of the ai is that if the player is within some radius of a slime the slime will see it and try to take a jump towards the player every few seconds if it hits the player player gets knocked back takes some damage and to be honest this is pretty basic and dumb but hey it works once slimes were finished up again as was all the rage back in 2011 all good crafting games need zombies so i did a lazy little recoloring of the player model and tossed some of our necromanced friends down onto the surface and into the caves the zombie ai ended up being about the same as the slime ai so they were pretty aggressive as they just try to get as close to the player as they can to hurt them [Music] even after adding a few monsters the caves were definitely still not spooky enough so next up i needed to add in some lighting to make the underground a little more ominous i programmed in some lava tiles to test the lighting system out and after a couple tries and experiments that range from looking pretty okay to completely awful i landed on a system that i think looks pretty cool the basic idea is to use an old-school technique called dithering around each light source to give the illusion that it gets darker the further away something is from a light source when in reality the pixels aren't actually being darkened at all this makes it super quick to do in software which is nice since i was using a completely custom software renderer for this project [Music] the original game used a lantern as the primary light source so i made an ugly little sprite for one and added them into the game as a craftable item at the end build made out of some iron some glass and some slime balls and to give them a try i took a quick little run around the caves you can probably see this little guy here taking pod shots at me those are some skeletons that shoot arrows that i sort of hacked in not super happy with how they turned out but their aim is adorably bad so i kept them the more the merrier for enemies in caves i guess now that almost all the base game was done i could move on to the main thing the original game didn't have that i wanted to include in my remake armor the sprites were simple enough to design you can see me in the background here making them by just painting over the head torso legs and feet of the player sprite for a helmet chest plate leggings and boots i ended up adding in iron gold and mithril armor all of which are craftable at the anvil the armor works by giving the player a greater chance to resist damage as the tier and amount of armor the player is wearing increases and of course i made it so that our friends the zombies and skeletons could equip the armor if they happen to find some somewhere down in their caves [Music] and now that the player had armor to protect themselves with it was time to add in the end game in the original version of the game the main boss is an air wizard so i followed suit and added this creepy looking dude who lives in the clouds and shoots wind to attack the player when the player beats the wizard the game is over i took some time to give the wizard some interesting ai and attacks but i'm not gonna spoil him here just in case you decide to play the game for yourself basically though he just runs around casting spells that shoot wind and tries to hunt you down and end you quickly when you fight him and with the boss fight done there were just a few things to tidy up to complete the game starting with the ui i programmed in a main menu customization menu difficulty selection and win-loss screens i was also able to chef up some sound effects and the audio mixing program bfxer for when you go to a new menu when you start the game when you hit something when you hit nothing when something hits you when you make something when you pick something up when you put something on and when you inevitably lose the game [Music] and that was pretty much it i did design the boss fight level against the air wizard 2 making sure it was actually beatable in this version of the game but i don't want to spoil it here just for fun after final pass over most of the code for some minor refactoring here and there i went through and playtested the game rebalanced a thing or two and called it done a complete playable arguably fun game in just a few days of work and you can see in the background here actually one of my first runs didn't end up going so well so i rebalanced a few things but i think the game should be sufficiently tough if you want to try it out so if you do actually want to give this absolute masterpiece a test drive for yourself just head over to the first link in the description and there will be download links to versions of the game for every platform and of course the source code is up on github so feel free to take a look at that as well it ended up being a lot bigger than i anticipated and the project ended up being somewhere around 12 000 lines of code by the finish anyway though thank you very much for watching be sure to check out the game if you're curious and come back to my channel for more game dev stuff like this in the future [Music] you
Info
Channel: jdh
Views: 309,380
Rating: undefined out of 5
Keywords: c++, programming, coding, minecraft, opengl, graphics, java, voxel, 3d, gamedev, gaming, code
Id: hvLYzISx6dU
Channel Id: undefined
Length: 15min 46sec (946 seconds)
Published: Fri Oct 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.