MyCraft

This is a retroactive post about a project I did almost 7 years ago, in 2012. I’ve called it “MyCraft”, basically it was a homework / final project for the Computer Graphics class at Berkeley.  If I remember correctly, I spent a couple hours here and there improving it the winter after, but most of the work was done for the class.

The goal was to get as close as we could to recreating the popular computer game Minecraft.  Their website at the time shows how far that game has come.   This was my first and only class on computer graphics, so we had roughly 3 months of computer graphics experience and very little knowledge of the libraries.  On top of that, we built some things ourselves for the class that we really should not have handled ourselves. We did well in the class, but at the time it felt like we didn’t make it anywhere close to our goal.  Even for a microscopic world, 100 by 100 by 20 blocks, the amount of objects to keep track of and manage proved to be a difficult performance problem when trying to render at speeds of at least 20-30 FPS. We did a ton to make it better – see the Readme – and were able to run it at about 25 FPS on my gaming laptop at the time.

It was a completely dead project.  It has been lying around on my Github account for years, untouched.  Of course, the executable didn’t work anymore. The Readme was basically just information for the instructor, it didn’t have any instructions on how to build it.  Luckily it’s C, so basically just keep running make until you manage to find all the dependencies you need.  It took like 30 minutes to sort out through what the correct dependencies were and where to find them, remarkably easier than I was expecting.

And after getting it built, bam!

I was stoked.  

The interface is pretty conventional, WASD for movement, mouse for camera, space to jump.  Click to place a block, right click to remove a block. You can zoom in / out with a mouse wheel or two finger scroll.   The world gets generated with grass, dirt, trees, ores, in the ground and a layer of non-destroyable blocks on the bottom.  It’s a little buggy with block placing and camera movement, but it’s absolutely good enough to play with for a couple minutes.

Now that computers hardware has gotten a little more powerful it feels like we did a lot better than we had thought.  Its running ok on my cheap Asus laptop, which I was not expecting when I dug this project up. The feature set feels quite a bit richer diving back into a MyCraft world, not remembering everything we built at the time.  It’s not often something you impress yourself with some relatively unimportant you built long ago, I thought it would be nice to share and show it off.

The full source code is available here.  Check it out!

Leave a Reply

Your email address will not be published. Required fields are marked *