Thursday, September 24, 2015

Visual programming for Minecraft

One of my hobbies is computer science education for children. Over the past year or so, I've been developing Raspberry Jam Mod (requires Forge and Minecraft 1.8), a Minecraft mod that implements the Raspberry Pi Minecraft API and allows one to write Python code that connects with Minecraft (this isn't that original: there are two other projects that do that). I taught some Python to gifted middle- and high-schoolers in the summer using this setup.

Over the last couple of days, I decided it would be nice to make something like this available for younger kids, using Google's Blockly graphical programming environment in place of Python. It's nothing very sophisticated, but you can use 3D turtle graphics commands to draw stuff in Minecraft. If interested, install Forge for Minecraft 1.8, then Raspberry Jam Mod version 0.50 or higher, start a single-user Minecraft world, and point your browser to robotblocks.appspot.com to get the Blockly code editor in-browser. The in-browser Blockly editor should then talk to your Minecraft.

Source code for the Blockly stuff is here.

8 comments:

Alexander R Pruss said...

You can now also do this with Minetest, which is free. Just drop the raspberryjammod folder from Raspberry Jam Mod for Minetest into the mods folder of Minetest. (Currently, Windows-only, and not compatible with the mingw builds of Minetest.

This should be nice for school activities where the school doesn't want to buy a bunch of Minecraft licenses. Minetest is more limited than Minecraft (at least with the stock package), but it is free, and it seems to run a lot better on older hardware than Minecraft does, which is a bonus for educational use.

Anonymous said...

Hi Alexander,

I tried it for Minetest. But when starting the game by selecting the mod, then it says,
'ModError: Failed to load and run script from C:\Users\Admin\Desktop\minecraft_server\minetest-0.4.15-win64\minetest-0.4.15-win64\bin\..\mods\raspberryjammod\init.lua:
: error loading module 'socket.cx64' from file 'C:\Users\Admin\Desktop\minecraft_server\minetest-0.4.15-win64\minetest-0.4.15-win64\bin\..\mods\raspberryjammod\socket\cx64.dll':
: The specified module could not be found.'

Could you please help me out?

Alexander R Pruss said...

Check if the file
C:\Users\Admin\Desktop\minecraft_server\minetest-0.4.15-win64\minetest-0.4.15-win64\mods\raspberryjammod\socket\cx64.dll
exists.

But I think the problem is that the mod is for 0.4.13.

Anonymous said...

Thanks a lot. I installed 0.4.13 and the issue is now solved. However, I still haven't understood the concept of using a turtle to draw stuffs in Minecraft. Also, can we modify the code to extend the features? Is the code in Python?

Thanks.

Alexander R Pruss said...

Have a look at my instructions for Minecraft: you can do basically the same things with Minetest. http://www.instructables.com/id/Python-coding-for-Minecraft/

Anonymous said...

Thank you so much :) I will let you know if sth comes up.

aprendiendo ruso said...

mr alexander, thanks for the software you have written. i am using jammod alongside minetest on linux. I've tried to set up blockly but i've been unable to do so. i cloned the git repo and ran build.py but i am stucked. the process didn't throw any erros but i don't know which port the blockly is running on. I plan to teach some coding stuff using minetest. we have done already some stuff with turtle. thanks in advance

Alexander R Pruss said...

I can't remember if jammod supports websockets. Does it?