
Show HN: Teachcraft – Learn Python through Minecraft - emeth
https://teachcraft.net/
======
Confiks
Looks like a great guide to get started with coding with Minecraft. There have
been some efforts over the years, but this looks really complete. One obstacle
for schools to get started with this however, is buying all the Minecraft
licenses.

To this end, I've been toying around a bit with an open source Minecraft clone
called Minetest lately [1][2]. It's surprisingly complete, and could also have
great uses in (programming) education.

It has a C++ core based on the Irrlicht 3D engine, but many of the game
mechanics are implemented in Lua. Modifications like the examples in
Teachcraft can also be built in Lua. For example, this [3] is a mod to spread
flowers and mushrooms around the map.

The Lua language isn't used much currently in the education environment, which
is mostly focused around Scratch, Python and sometimes Javascript. Then again,
seeing different languages and noticing their similarities can be educational
in itself.

Finally, I've been wondering how hard it would be to port something like
Minetest to Emscripten. Irrlicht seems to be compatible already [4]. The non-
JIT version of Lua is compatible as well [5]. Obstacles in Minetest that I can
identify would be the heavy use of the filesystem, the use of UDP sockets and
memory sharing between threads.

Would anyone know more about how hard porting something like this would be?

[1] [https://github.com/minetest](https://github.com/minetest)

[2] [http://www.minetest.net](http://www.minetest.net)

[3]
[https://github.com/minetest/minetest_game/blob/master/mods/f...](https://github.com/minetest/minetest_game/blob/master/mods/flowers/init.lua)

[4]
[http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=51...](http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=51809&start=15)

[5]
[https://github.com/vvanders/wasm_lua](https://github.com/vvanders/wasm_lua)

~~~
corobo
> buying all the Minecraft licenses

All the schools I know of have an iPad per child these days. I doubt it's an
issue [Edit: Ok roger that, not all schools. Consider me told]

There's also this
[https://education.minecraft.net/](https://education.minecraft.net/)

~~~
JPKab
Dude, the majority of people in the United States don't live near a Whole
Foods, let alone the rest of the world.

If you think most schools have an Ipad per child, you live in a bubble.

~~~
corobo
Quite possibly. I didn't think at all outside of my "jesus these schools are
giving kids ipads now? When I were a lad the school had 2 PCs for the entire
building" bubble.

For reference I was also talking from within a UK only bubble too.

~~~
JPKab
In fairness to you, I suspect the government schools (we call them public in
the US, but I recall that "public school" means something entirely different
in the UK) in your country are much better funded. I may be incorrect.

In the US, public schools are funded primarily by local governments, and are
therefore extremely unequal in their funding, even within a relatively small
geographic area.

I graduated high school from an impoverished rural county in 1999. The school
I attended had a smattering of Windows 95 machines, enough so that about a 1/3
of the classrooms had a computer in it. There were only 2 machines in the
entire school with internet access, and they were in the library. This was for
a student body of roughly 600.

When I went to university, students from other (wealthier) parts of my home
state of Virginia had been in schools where each student had a computer, and
all had access to programming courses starting in middle school. Not
surprisingly, students from these schools were disproportionately represented
in my uni, and my "Intro to Computer Science" course was mostly filled with
kids who had been programming for years. It made it very difficult to learn
when more than 80% of the students have a huge advantage going in, and give
the professors a false perception of how effective the teaching is. I sure
hope the UK isn't like that.

~~~
pnutjam
I'm in a relatively well off US public school district. All kids have Ipads,
but the parents must provide them or pay to rent them. If you qualify for the
free lunch program they waive the rental fee.

------
Macuyiko
Nice! A while ago, I also worked on a Python <-> Minecraft interaction which
is not based on mcpi (and RaspberryJuice), but instead spawns a full Jython
based Python interpreter session server-side allowing you to directly use the
full Bukkit API [1]. This allows to use various commands mcpi doesn't support,
such as creating lightning, explosions, and dynamically writing events using
Python, either by using a client (sending Python code over the wire) or from
the chat console in Minecraft.

The way how mcpi works is by creating a network bridge between the
RaspberryJuice plugin and Python. Commands in Python are send to the Minecraft
plugin over the wire and handled there (using the Bukkit API), with output
send back to the Python client. This is safer in the sense that you don't have
the full Python environment running on the server and that (in theory) you can
use both Python 2 and 3 (Jython support for Python 3 is not there yet). The
drawback is that you can only utilize commands that are manually implemented
and that the full Bukkit API is not directly exposed.

At one point, I also had a plan to expand this into a tutorial series but
didn't really follow up on this due to a lack of time. I'd really like to do
this some day, though.

[1]: [https://github.com/Macuyiko/minecraft-
python](https://github.com/Macuyiko/minecraft-python) and video:
[https://www.youtube.com/watch?v=j4JfwS5hNlw](https://www.youtube.com/watch?v=j4JfwS5hNlw)

~~~
Diederich
Wow! I believe this is exactly what I've been looking for.

One of my goals is to get my son, who is really into Minecraft, also
interested in programming.

The github project seems to be receiving updates too.

If I end up making some reasonable progress on this, I might just contact you
later on, if that's ok with you!

~~~
Macuyiko
Sure! At one point, some group of volunteers also created a spin off project
with the aim of putting more focus on creating a whole web interface around
the concept, but I think it's inactive now. I try to maintain this repo from
time to time and to keep it as bare-bones as possible.

At one point, I plan to experiment with ZipPy
([https://github.com/securesystemslab/zippy](https://github.com/securesystemslab/zippy))
to see if that would be a viable option to get Python 3 support underway.

------
lowpro
I was thinking about this just yesterday, and wondering if python could be
taught _in game_ like ComputerCraft uses Lua, except for python.

Maybe certain object/data types could have a physical presence like a database
could be a shelf, and hooking them up physically would create a real database
will multiple tables that could be interacted with in the game. I was thinking
about this more in the sense of actually helping me model applications instead
of teaching, as it would just be more fun to work with. Does anyone else have
interest?

Another way of thinking about this could be like a library with bookshelves in
game that you can actually walk though, and program an in game robot to get
certain books when you want certain things (querying), and it could help
visualize how a database and application were set up and working together.

~~~
openfuture
I've had the same idea for a while, it'd be amazing if someone made this sub-
game in minetest!

------
soulnothing
I remember working with a few people who had families several years back.There
was a bring your kid to work day. Around mid day I saw all the kids playing
minecraft on their laptops. They were probably about 8 - 12 I think. As I
talked to them, they got really excited. Wanting to show off their private
worlds. They had created custom modules in java, were running servers, and all
these other things. This was like the lego blocks for their generation. In
addition it bought a lot of STEM knowledge to boot.

Seeing stuff like this is really cool. Adding more to the community and
growing opportunity.

------
Rjevski
This is really nice, however I wish someone makes an in-game version of this,
so you don't even have to get a development environment running - just install
the mod (which kids are already familiar with), jump in game and develop
there.

~~~
lowpro
I was thinking about this as well, maybe something like ComputerCraft which
uses Lua but build on top of it, try and make it more visual though.

------
nikkidurkin
This looks great! I run after-school coding lessons for Australian kids aged
8-12, teaching them to code Minecraft mods using scratch-like code blocks (if
you're interested, its
[https://codemakers.com.au](https://codemakers.com.au)).

I've been looking for a solution for teaching the more advanced students who
want to start using a 'real' language. I was initially looking at using
Scriptcraft, but TeachCraft looks like another great option!

~~~
Guyag
Neat - I'm in the process of making a similar system which will spit out
Spigot plugins, with the aim of letting kids create some simple ones
themselves and hopefully planting the seed for getting them interested in
programming. As part of this I included a 'split screen' view showing the
generated Java in addition to the normal block work area, though this is read-
only.

It's been more of a challenge than I thought it would be to design the blocks
such that the end set isn't near enough a 1:1 mapping to Java - showing it to
a non-technical friend of mine made it clear that my intuition was way off.
Would be interested to hear how you approached this (if you don't mind).

Also interesting that I didn't find your website when I was initially
researching, though I did come across
[https://www.learntomod.com/](https://www.learntomod.com/) (and even that was
hard to find). I suspect my base search term of "minecraft blockly" isn't the
most common one used by the target market to find something for their kids
though.

------
cjdell
This looks awesome. Minecraft is a fantastic way to teach programming, and not
just to kids! There is something magical about seeing code you write doing
something visual that you can interact with.

Here's a shameless link to a thing I created a while back when I was running
workshops. Minecraft-like world that runs in pure browser aimed at teaching
JavaScript:

[http://webblocks.uk/](http://webblocks.uk/)

------
travbrack
Any parents here have any success inspiring their child to code who was averse
to it? I've tried scratch, tynker, roblox, etc without much luck.

~~~
travbrack
I guess I gave the impression that I'm shoving it down his throat. I'm taking
the approach where I'm trying to inspire by showing him different kid friendly
coding tools, not forcing anything and being totally okay if he doesn't want
to do it. I was just curious if anyone had any success at inspiring a child to
be excited by coding who wasn't into it at first. I know there are a lot of
parents out there who try to force activities on their child, and I'm not one
of them.

------
rb808
Kids around here mostly use Minecraft PE on tablets. I know previously this
didn't work with shared servers but maybe it does now - I'm not really up to
date.

Would these Python customized servers work with tablet Minecraft now?

------
SeanDav
Would love to try this out as my kids love Minecraft (when played at friend's
houses) but:

"Step 1 - Install Minecraft"

I can't get Minecraft to work on my Windows laptop. Minecraft crashes after a
few seconds with a Java error:

"Java (tm) Platform Binary SE has stopped working"

Tried searching for a cause and tried everything I could find. Perhaps someone
here has some suggestions?

 _EDIT:_ Re downvotes: that will teach me to post a half finished piece while
I went to check on actual Java error! Not complaining - my fault entirely for
posting half-assed reply which sounded aggressive.

------
danso
Minor meta note: this site has almost no HTML metadata, which is probably not
great for SEO but also makes it less visible when sharing on social media:

[https://developers.facebook.com/tools/debug/sharing/?q=https...](https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fteachcraft.net%2F)

[https://cards-dev.twitter.com/validator](https://cards-
dev.twitter.com/validator)

------
laurentoget
[https://education.minecraft.net/faq/how-much-does-it-
cost/](https://education.minecraft.net/faq/how-much-does-it-cost/)

minecraft education is $5/year, with 'opportunities for volume licensing'
which sounds affordable, but then it feels really misguided for microsoft not
to give it away for free. Getting future developers to have some contact with
the microsoft ecosystem is worth more than $5 i would think.

~~~
nikkidurkin
Unfortunately you need Minecraft for Mac/PC: Java Edition to use mods, so
modding won't work on the education edition.

~~~
laurentoget
This is even worse than i thought then.

------
didymospl
Well, I haven't played Minecraft since around 2013, but this tutorial so
entertaining that I will probably install it again as soon as I get back from
work today. This reminds me of the great game called Colobot, where players
could program their robots to gather resources, fight the enemies etc using
Java-like language. It would be nice to have a simple API to script NPC in
Minecraft too.

------
kitd
This is great.

FYI, Minecraft Pi has this facility too. My daughter loves playing with it.

[https://www.raspberrypi.org/learning/getting-started-with-
mi...](https://www.raspberrypi.org/learning/getting-started-with-minecraft-
pi/worksheet/)

------
throwawayjava
This is really great. All the existing "program in minecraft" solutions were
pretty hacky IMO; lots of cruft to work around, which is really bad for my
target audience of middle school students.

------
mathattack
Nice! I was just looking for something similar to this for my minions. Looks
like it assumes programming knowledge (beyond say Scratch) already, no?

~~~
Hydraulix989
Check out our latest project BlockSchool, we teach programming to kids using a
Scratch like programming language in a Minecraft world. Happy to give you a
demo!

------
mstjohn1974
I think that is great...I wish there would be more like that out there so kids
and adults can learn playing a programming language

------
blubb-fish
How about a guide on proper usage of fork, knife and spoon by teaching how to
juggle with them?

------
ericfrederich
Front page has example code of a busyloop with a time.sleep.

Not a stellar example of coding.

~~~
ghostbrainalpha
What is wrong with that? Will it eat up RAM or crash the box if it was left to
run for too long?

------
navbaker
The instructions say to install Python 2.7. Does this not support 3.x?

~~~
purrcat259
Its not like the people who will learn off this still be writing 2.x code in
2020... right? :) /s

~~~
offbyone
Getting 3.x to work with mcpi is actually super easy; the library works nearly
out of the box, and the code is basically the same as far as I can tell.

