Building Dex in Minecraft on a Pi

Dex_in_Minecraft-1-1024x576

logo-bw-1-copy-2-235x300

To celebrate our new mascot Dex, we made a hack to build Dex from stone in Minecraft on the Raspberry Pi.  With a little bit of hacking we were able to write a Python script that generated Dex in Minecraft.  Dex arises from the horizon with stone, one block at a time, with a little Python code.  This process could be used to generate any logo or symbol!

How we did it:

1).  The first step we took was to reduce Dex down to a pretty small image.  Fortunately, he lends himself well to this.  We reduced the size and scope down to a 100×100 pixel BMP in black and white.

LOGO-150x150

2).  Next, we needed an ASCII file of Dex.  To get this, we fed the above image into picascii, which turned our picture of Dex into an ascii file of Dex.  We upload our picture of Dex, and we get back a nice text file like this.

Dex_in_Ascii-300x264

3).  Finally, we wrote a really simple Python program that opens the text file, and reads it and spits out stone in the shape of Dex.  The Python program goes through each line of the ascii file of dex, from the bottom up, and then reads every single character.  If the character isn’t blank space, it lays a Minecraft stone down where the non-space character is.

We ran the python script using the command

python make_dex.py

Dex_in_Minecraft-2-150x150Dex_in_Minecraft-3-150x150Dex_in_Minecraft-4-150x150Dex_in_Minecraft-5-150x150

4).  Voila!  Dex is built in our virtual world!  We put a small delay between each stone laying, so you can watch Dex get built in real time!

Dex_in_Minecraft-1-1024x576

You can try it too!  We put all the necessary files to make your own Dex in Minecraft up in Github here.

What have you done in Minecraft on the Pi?  And even better, how could we use one of our robots with Minecraft on the Pi?  Tell us in the comments!

0 Comments

Leave a reply

{"cart_token":"","hash":"","cart_data":""}