Yesterday I got the Raspberry Pi version of Minecraft running on my Model A and Model B. I also got a terminal window open and managed to complete my first – very (very) basic – piece of Python programming.
I bought a Pi Model B initially for use in the classroom, but then ended up finding that I also wanted to use it as an XBMC machine at home, hence the purchase of the Model A. Now the novelty of Airplay streaming to my TV has pretty much worn off, I’m hoping to use both machines (what’s the plural? Pis? Pies?!) in the classroom as part of the existing Minecraft club to give the children a taster of programming using Python.
The installation of Minecraft on the Pi is – in the spirit of learning – certainly not intuitive and I ended up using instructions cobbled together from a a few different forums to get it working. This post is intended as an adjunct to these existing instructions, in the hope that it may be useful to someone, somewhere.
I should point out that, in terms of programming, I would class my adult-self as very much a beginner. As a child of the 80s, I was lucky enough to have access to a BBC Micro at school and an Acorn Electron, followed by a Spectrum +2 and then the lesser known Sam Coupé at home, and therefore developed an early appetite for programming in BASIC. I have very early memories of retyping code from Input magazine. At this time I would have been six years old, so the current equivalent of Year 2 at primary school.
However, for whatever reasons, I never developed my own programming beyond some early dabblings with creating a few basic text adventure games, followed by a few cursory attempts at using using sprites (‘Roy’s Castle Caper’ is one game I started but never finished which – bad punning title aside – was of a similar standard to the ones I’ve seen children in my class produce in a couple of hours, using Scratch). I now wish that I had persisted.
IT at primary school at this point involved using the solitary BBC micro to simply run and use programs. Things like ‘Dread Dragon Droom‘ and ‘Podd‘ linger in my mind, along with a cat-and-mouse game where you had to answer addition questions and, bizarrely, something about identifying criminals (anyone else remember this?) Due to the scarcity of machines, computer time was limited and precious, but I don’t remember being directed in my use of the computer – you were left to discover for yourself, in the corner of the classroom. During holiday times the computer was sometimes loaned out to children to ‘look after’, like a class guinea pig! (This was a good opportunity to really test what ‘Podd’ could really get up to, without being reprimanded by the teacher for using inappropriate language. I also remember spending quite a lot of time playing a cool helicopter game where you had to rescue hostages).
IT (there was still no ‘C’ in ‘IT’ back then) at secondary school was all about spreadsheets and wordprocessing – never programming. We used Archimedes computers. In spite of my early interest in computers, I didn’t pursue the subject beyond GCSE and I’m fairly sure I didn’t have an email address or even access the internet until I went to university in 1997! I’m certainly not blaming school – being a teacher now I know how easy people find it to blame schools for everything, forgetting that a) it is invariably policy that drives practice and b) school doesn’t have a duty to provide everything. But that’s for another discussion in another place… Back to business…
Firstly I downloaded Minecraft Pi Edition here. They also provide these instructions for getting it installed and running. You need to open up a terminal window (click on the icon on your desktop) and type:
To decompress it: tar -zxvf minecraft-pi-0.1.1.tar.gz
To run it: cd mcpi
Followed by: minecraft-pi
This is where I met my first hurdle – it didn’t work! A bit of searching found the answer here from DanielG:
DanielG: If you are using Debian, instead of typing just minecraft.pi, type ./minecraft.pi
Aha! So, turns out that I was using Debian as I had setup my Raspberry Pi SD cards using Berryboot rather than installing an image of Raspbian Wheezy. (I had initially encountered problems setting up the Pi Model B, but found that using Berryboot to download and install the operating system worked fine.)
Who would have thought that a simple full-stop-forward-slash combo (./ – like a puzzled, one-eyed smiley) would have made the difference between success and failure? This is the kind of learning and understanding that reliance on user-friendly devices removes – most of the time I am thankful for this, but there is clearly a place for this kind of learning through necessity and persistence.
The fact that the installation of Minecraft Pi doesn’t produce a startup icon is encouraging – in the same way that a user of the Spectrum was forced to know the basic BASIC instruction LOAD “” to get a game loading. This subtle difference, I think, is an important step in teaching children that you can make things happen on computers by typing things in.
So, after a bit of a play – and being impressed how well this version runs on both the Model A and Model B – I decided to investigate how to program the thing. Help again came from the comments on this post.
In particular, this post from radcom123 proved effective,
1. You need to be running minecraft pi on the pi its self before you start plenty of info there.
2. now open a command prompt and cd into the api directory which should be something like “/home/pi/mcpi/api/python/mcpi”
2. At the command prompt type “python” some text is displayed and your prompt becomes >>>
3. Now type “import minecraft as minecraft” and press enter
4. type “mc = Minecraft.create()” press enter
Unfortunately, I got an error message here, but found a comment by thjrcrafter to amend it to:
mc = minecraft.Minecraft.create()
This worked! So I then continued with radcom123′s instructions:
5. now type “mc.postToChat(“Hello, Minecraft!”)”
Hurrah – the text appeared on the screen! Such a simple thing, but a sense of achievement nonetheless!
6. to place a block type “mc.setBlock(0,5,0,46)” then press enter in this exampe a tnt block is placed at hight 5 above the spawn(0,0,0) the command works like this (x,y,z,blockid,[data])
A TNT block appeared above my head! Brilliant! I then altered the variables in the final instruction and added some different blocks in different locations.
At this point, two things happened. My wife, very reasonably, decided that it was time to reclaim the telly that I had been using for the last couple of hours. (She had, to her credit, been very patient). And secondly the HDMI to VGA adapter seemed to give up on my ancient monitor, so I had to give my initial exploration into programming a rest.
I have since found these sites, that may be useful.
I also intend to put together some of these instructions into a slightly more coherent form to get some children to have a go in the classroom – this is, after all, for their benefit and not mine… isn’t it?