Computational Modelling Blog

Gamification of Python script execution in Minecraft

Minecraft player, holding a PythonScript

Minecraft is a role-play game in which players create and modify the virtual 3d Minecraft world. Underlying the attractiveness of the game are the problem-solving challenges in the context of the laws of physics which are implemented approximately in (Java) code: water flows downhill, light is scattered and absorbed, and players need to eat regularly to maintain their health. It is possible to extend Minecraft through Mods, connect through it via other programmatic interfaces (including Java, JavaScript and Python), or give particular game elements (so-called ‘command block’) simple statements to execute.

This summer, Alvaro Perez and I have explored which of these approaches might be suitable for an educational program to develop programming skills within the context of Minecraft.

For Minecraft gamers, aged 5 and above, this could be the entry point to a career supported by programming. For undergraduate students and researchers, they could be a playful way of developing a basic understanding of functions, loops, etc through routines that build a row of stones, a wall, a house, etc automatically.

The first outcome of this project is the PythonTool Mod (official website, source code).

The key novelty here is that Minecraft players can hold a Python Script as a tool (see figure above), and execute it when clicking a button. It was previously possible to run Python code inside Minecraft using the rather neat RaspberryjamMod. What is new here, is the ability to do this within the setting of the game, i.e. instead of using an axe to dig into the ground when the mouse button is pressed, the script is executed - we called this gamification. First field trials with Minecraft enthusiasts suggest that this makes a big difference in their motivation to engage with the code.

The Python scripts (that are stored in a folder on the host computer) can be accessed through a computer block, which - in the normal Minecraft way - has to be crafted before it can be used (figure below). A computer can be crafted from 8 Cobblestone blocks and 1 Glass block; we have chosen this combination as something that is feasible to achieve, and reflects the common understanding that a computer has a screen. A picture of the crafting process and the computer block are visible in the picture below below.

More screenshots can be found in the user guide.

At the bottom of the page, there is a video introducing the tool.

Left: Crafting of Computer block. Right: Computer block

An introduction of the mod is availble in the video below.

We acknowledge financial support for this work from the EPSRC Centre for Doctoral Training in Next Generation Computational Modelling, grant EP/L015382/1, and the University of Southampton.

Comments