Could you use Minecraft to teach programming?

July 22, 2012 – 4:11 pm Tags: , , ,

There are two mods (that I’m aware of) for Minecraft which let you build computers inside the game.

ComputerCraft allows you to have Lua-programmable computers and robots, with basic wired and wireless networking capabilities. RedPower 2 on the other hand has a 6502-like CPU based computers, which are programmable either using 6502 Assembly or FORTH.

What if you used Minecraft and one of these mods as an environment to teach programming?

Why Minecraft?

I’ve been playing Minecraft lately and using ComputerCraft to automate and create things. I found it very fun and easy to learn, but why would it be a good environment to teach a beginner?

I’ll concentrate on ComputerCraft, since RedPower 2’s computers are much lower level and thus harder to use for anything practical in-game.

As an environment for buildings things, Minecraft is quite intuitive I think. You can mine blocks and place them in many kinds of formations. With mods, you get even more variety, such as automatic mining machines, automatic crafting tables, engines for generating electricity using fuel pumped into them which in turn is refined from oil with a refinery…

So as a sandbox for creating and adventuring in the autogenerated land, it’s quite nice, especially with some modding.

Why does this make for a good environment to learn programming in?

Let’s look at what ComputerCraft offers:

  • Computers which can render basic text-based UIs, they come with a simple UNIX-like shell
  • Robots which can dig and place blocks just like players, which share the OS with the computers
  • External monitor blocks which can be combined to create big info screens or other things
  • Computers can be connected to machines or each other via wires
  • Wireless network modems for computers and robots which can be used for communication between computers or robots
  • Small base library of useful programs to get started
  • Everything is programmable using Lua. You can even replace the OS by replacing its Lua scripts

ComputerCraft computer with Turtle robot
A computer with a floppy drive and a mining robot

This is quite a lot of things.

This offers a variety of things you can do, like creating machines in Minecraft which you then automate using a computer, building computer operated doors, building servers for data storage, creating networked applications, creating robots which can mine automatically or build structures…

Although the built in applications allow you to do some basic testing, for most things you will need to write a custom program.

There are many aspects to learn:

  • Basic programming: Lua is a full featured scripting language and seems easy to learn
  • Networking: Computers and robots can communicate with each other over networks
  • Automation: Machines, doors, lighting etc. can be automated
  • Robotics: Although simple, the robots can be programmed to do complex tasks and AI
  • High-level systems programming: Replace the OS in the computers with your own

If adding RedPower 2 computers to the mix, low-level systems programming with assembly could also be added to the list above.

ComputerCraft terminal output
Computer terminal with basic commands and output

But what makes it a particularly engaging environment to learn in my opinion is that everything is very much your own creations.

You first build it yourself from the ground up. Then set up the wiring necessary for connecting it. Then you write the program, and watch it come to life. It gives you feedback very quickly and seeing it work is very rewarding.

Considering you don’t need a lot of code for basic applications and basics of Lua are easy to pick up, it makes it very easy to use.

The inclusion of easy to program robots only adds to the possibilities. For example, there’s a video on YouTube highlighting using the robot as a makeshift bomber, dropping TNT as bombs.

The fact that the options are almost endless really makes this something where it’s a very personalized experience. The community is also creating further modifications to ComputerCraft itself, and it’s possible to combine the computers with many other mods’ additions, so the only limitation is really what you can imagine. And, unlike with a bucket of Legos, there is no limit to resources in Minecraft.

Downsides

Of course there are some downsides as well.

You can teach the general aspects of programming though, such as variables, functions, object oriented programming, and the things mentioned earlier like networking things (albeit a bit simplistic model).

However, besides this, it’s probably a bit impractical due to Lua not being a very commonly used language. So while you can do a lot of things and learn a lot of programming, you will very likely need to learn another language for anything that you do outside Minecraft – which may or may not be a bad thing depending on how you look at it.

Secondly, it’s Minecraft. You could easily get sidetracked with building some megaproject… but you probably would use the computers to automate that afterwards.

Conclusion

As is demonstrated on YouTube, teaching programming with Minecraft could be very viable. Although the video doesn’t really go into much details, it looks like something which could work.

If nothing else, I think it’s at least a very interesting idea and I’d love to see it taken further. Infact, a comment on Twitter from ComputerCraft creator dan200 would indicate there could be some further plans for education using ComputerCraft.

There’s really a lot of things for all skills levels, from simple password protected doors and keycard systems, to centralized user management servers with networking, and nuclear powerplant control systems, or robots which dig tunnels for you or even build houses.

And everything has a very quick feedback loop, so you will always have a feeling of achieving something.

If you want to try this yourself, the mod pack I’m using is Tekkit, with general documentation available in the Tekkit Wiki, computers and programming docs in the ComputerCraft wiki, information on building machines in the IndustrialCraft wiki and BuildCraft wiki, and computers and machines info in the RedPower 2 wiki.

Let me know your thoughts in the comments, I’d love to hear from you especially if you have used Minecraft in teaching or are planning to.

Share this:
  1. 5 Responses to “Could you use Minecraft to teach programming?”

  2. You most certainly CAN use Minecraft to teach programming. My son was quite proficient at using MIT’s Scratch. He understood all the concepts, but I was having a hard time trying to get him to switch over to writing textual programming.

    Enter Minecraft. I don’t let my kids play on internet servers – I instead have a single home server running (survival mode only), and open up ports for their school friends to connect into.

    Enter ComputerCraft. After I installed it on the server my kid was largely uninterested. But as soon as I wrote a few lua programs and showed him how small programs can do big things .. he started trying to do it on his own and has written a lot of programs. Mostly his applications make the turtles do something fun.

    You have to remember that the name ‘Turtle’ comes from the old days of programming education with ‘Logo’. The Minecraft turtle is, in essence, a 3D Logo Turtle .. that can do a lot more than PenUp and PenDown :)

    By Daniel Ward on May 9, 2013

  3. That’s pretty cool :) Pretty much exactly the sort of thing I thought, having something kids are already interested in and seeing how you can do more cool stuff -> profit.

    By Jani Hartikainen on May 27, 2013

  4. Minecraft Forge allows anyone to learn and build Minecraft mods including the ones you mentioned in your post. Minecraft Forge page has simple to follow tutorials from beginner to advance to take anyone from 0 to 100 in programming in Java. There is no need to use an in-game mod to learn to program when you can build your own by following a simple tutorial.

    There is even a custom based server designed for the teaching environment called Minecraftedu that is officially support by Mojang. Though any Server can be used or even using the local client to build mods.

    By Dustin on Jun 8, 2014

  5. I think for complete and total beginners, building a mod is perhaps a bit too complicated first step. You certainly could use modding to teach more advanced students though.

    By Jani Hartikainen on Jun 8, 2014

  1. 1 Trackback(s)

  2. Nov 30, 2012: Could Minecraft be the next great engineering school? – Quartz

Post a Comment

You can use some HTML (a, em, strong, etc.). If you want to post code, use <pre lang="PHP">code here</pre> (you can replace PHP with the language you are posting)