From RF Craft to RailCraft
Over the past few years, a community of makers, developers, artists, designers, gamers and educators have been exploring interesting ways to bring the ‘real world’ into Minecraft, which I’ve been calling The Minecraft Of Things. Some of the most interesting work has used the Raspberry Pi version of the game and the marvelous
mcpi distributed Python Minecraft API, supported by some great tutorials and code written by Martin O’Hanlon both on his website and in his book, co-written with David Whale.
For MakeFest 2016, we’ve made a working train that you can control with a Minecraft radio messaging system – RF-Craft – to work with some special laser-cut buttons and augmented oil lamps from the MSI handling collection. Then there’s a carriage building game for 3 players, and a Python model of a level crossing. All of this is within view of a RailCraft/TrainCraft Minecraft mod made by Mr Brutal, a well-known Minecraft modder who has modelled an amazing world inspired by the earliest Liverpool to Manchester rail journeys.
Learning by design and experimentation
I’ve been working on a few projects that use
mcpi like this, to share ideas around the Internet Of Things and basic programming. There is a lot of momentum to teach code to children, but I prefer to think of what people are doing in the maker/coding/education world as a sort of data literacy. It would be unrealistic to think that young people taking part in this sort of thing will be using Python 2.7/3 in their jobs of the future, but doing the sort of level of programming found in the Raspberry Pi and
mcpi community at least teaches some of the basic ideas of computer science. Most importantly, playing with Python in the context of Minecraft gives you a framework to do the most useful kind of learning: learning by design and experimentation, in a language (Minecraft) that you are comfortable with.
Perhaps the most useful approach is to design a solution to a set of problems or questions. For example, making a train in Minecraft that behaves like a real train from 1 million virtual blocks takes a fair bit of creative thinking to make a solution that you are happy with.
Coding is communicating
Another concept that learning with Minecraft helps with, and it’s not something that all adults understand or see the value in, is that of sharing knowledge and information in a way that makes sense, is human friendly and well documented. By coding and making, you are interacting and communicating with the world but in a more deeper way than, say, watching a video, sharing an image or sending a text-based message on social media.
All the content of the workshops at MakeFest 2016 is based on other people’s work and knowledge, in the same way that Stephenson’s Rocket or a particular rail gauge on some track does not belong to just one engineer. Yes, there are famous and talented engineers who innovate and are the first at something, but often they implement and build on the work of people before them. For example, Einstein needed Maxwell and Tim Berners-Lee needed the IEFC to build TCP.
The Minecraft myth
There’s a bit of a myth that Minecraft is a universally accessible world of creativity. In some ways it is, but this creativity comes from the sheer diversity of ways you can play/hack/modify/customise/mod the game. Many of the amazing things made by modders like Mr Brutal, who FACT and MSI have commissioned for this year’s MakeFest, need a bit of work to get running with tools like Engine Hub and Forge, and of course, it all depends on whether you’re playing on PC/Mac/Linux/XBox/PS4/Android/iOS/RaspberryPi or running Forge/Bukkit/CanaryMod/MinecraftEdu/Pocketmine servers.
What is awesome about
mcpi and the Raspberry Pi version of it is that it takes you back to the basics of version v0.1.1 alpha with minimum set up, so the modifications that you do make are limited around using Python and
mcpi, to ensure you make your mods programmatically. It also uses cheap hardware and is home to a big community. This means people have to forget how they may play Minecraft normally, and design something in a familiar yet new way. And that’s the other myth of creativity – that it’s all about freedom. It’s not. Instead, it is often the limitations of a medium that drive creativity.
So come along to MakeFest 2016 and learn more, build virtual railway infrastructure, and see Mr Brutal and the local Minecraft mapping community’s amazing creations.
Below is some example Python code for a Raspbian Raspberry Pi disk image to help you to start building your own train carriages in Minecraft. There are lots of resources out there to help you get started with using the Raspberry Pi, so I will leave the internet and the link above to fill you in on that.
To use it you will need to download Martin O’Hanlon’s
mcpi code here and save it to your home folder,
/home/pi. You can use the Pi Midori browser to download it, or use the command line.
Now open a Terminal on your Pi (in ‘Accessories’) and type
pi$ ls, and it will list your files in your home folder (just type the text after the pi$ part; that’s just the command line prompt and shows you who you are logged in as – in this case,
Within Martin’s downloaded files, you should have an
mcpi-master.zip folder, so unzip it and go inside the
pi$ cd master folder. You can then download the required file from here and unzip
pi$ unzip carriage.py.zip.
Alternatively, you can download it straight from GitHub:
pi$ wget https://github.com/cheapjack/RF-Rail-Craft/blob/master/carriage.py
(NB: Make sure the
carriage.py is in the same folder as
mcpi so your programme can find it).
Now open Minecraft and go to a new world and find where you want to build some carriages (you may want to clear a space).
Now go back to your Terminal and Run it with
If all goes well, and the
mcpi folder you downloaded is in the same place as your carriage.py code, you will see the message
"Hello Minecraft World!" in the game console.
Now try and hack the
CarriageTemplate function, or use it to make more carriage chassis and start building some classic rolling stock from throughout the ages.
If you get stuck come to MakeFest 2016 and we will help you out!
#!/usr/python # import mcpi, you will need the mcpi directory to be local to the carriage.py ie in the same directory. from mcpi import minecraft # connect to the game locally, ie on your pi mc = minecraft.Minecraft.create() #Define a Carriage function def CarriageTemplate(xpos, ypos, zpos, length, width, numberOfCarriages, material, materialType): # main carriage chassis for i in range(1,numberOfCarriages): mc.setBlocks(xpos+(i*(length+1)) + 1, ypos + 1, zpos, (xpos+(i*length+1)) + length, ypos + 1, zpos + width, material, materialType) #Make gaps # Make 4 wheels mc.setBlock(xpos + (i*(length+1)) + 1, ypos, zpos - 1, 89) mc.setBlock(xpos + (i*(length+1)) + length - 1, ypos, zpos - 1, 89) mc.setBlock(xpos + (i*(length+1)) + 1, ypos, zpos + (width + 1), 89) mc.setBlock(xpos + (i*(length+1)) + length - 1, ypos, zpos + (width + 1), 89) # Send a message to minecraft console mc.postToChat("Hello Minecraft World!") mc.postToChat("We need rolling stock!") mc.postToChat("Lets get building carriages!") playerTilePos = mc.player.getTilePos() mc.postToChat("TilePos is " + str(playerTilePos)) # Remember our Carriage function above needs the values Starting xpos, ypos, zpos, length of carriage, width of carriage, numberOfCarriages, blockmaterial, blockmaterialType. # Call our Carriage Function CarriageTemplate(playerTilePos.x+1, playerTilePos.y, playerTilePos.z+1, 6, 2, 4, 42, 0) #print to minecraft console so we know what we did mc.postToChat("Building Carriage chassis!")
MakeFest 2016 is on Saturday 20 and Sunday 21 August, from 10am to 5pm. Entry is free, though certain activities may be chargeable. Most activities are recommended for ages 6 and above.
Second image credit: Chris Foster