Showing posts with label Minecraft. Show all posts
Showing posts with label Minecraft. Show all posts

Friday, November 27, 2020

Scratch coding in Minecraft

Years ago, for my older kids' coding education, I made a Minecraft mod that lets you program in Python. Now I made a Scratch extension that works with that mod for block-based programming, that I am hoping to get my youngest into. Instructions and links are here.




Saturday, October 27, 2018

Minecraft cake cake

Our youngest wanted a Minecraft cake for her birthday. We settled on a Minecraft cake block cake using this clever method. (But we froze the frosting overnight on parchment paper—maybe wax paper would have been better—and instead of candy melts just used more frozen colored frosting; we also used only two layers.) The brown bottom is cinnamon—we had three people apply it simultaneously.


Wednesday, August 10, 2016

Random dithering of images

I wanted to wrap a rectangular texture of, say, the earth around a sphere in Minecraft to make a 3D image (using RaspberryJamMod and Python). The problem was that my color palette would be limited to Minecraft blocks, and not all blocks would be appropriate--with my son's help, I selected a subset of 82 that would work well for general purpose image rendering. So I needed to reduce the color in the texture. One could just choose the nearest color available for each point in the image, but that would lose a lot of detail. The standard family of techniques to solve this is dithering. However, most dithering algorithms like Floyd-Steinberg or ordered dithering are designed for flat two-dimensional images.

One could come up with a 3D version of one of these algorithms, but I went for a different tack: random dithering. Random dithering isn't much used these days, because it is thought to produce really bad results. But while that would no doubt be true with a two-color palette, it doesn't seem to be true with a larger palette, like my Minecraft 82 block palette. The method I used was to add to each color channel a random perturbation, with distribution either uniform or a cut-off Gaussian, and the results were gratifying. Not quite as good as Floyd-Steinberg, but close.

The original is on the right. "Gaussian X/Y" means a perturbation with sigma X, cut off at -Y and Y. "Uniform X" means a perturbation uniform over the interval [-X,X].





And here's how it looks wrapped on an egg (uniform 20, I think):

Actually, on this cartoon stuff, the dithering is hardly needed. A photograph benefits more from the dithering. It's a dung beetle I photographed outside of our house some years ago.

Original:

Minecraft renderings:









In both cases, uniform 20 and Gaussian 20/30 seem good enough. Source code here.

Tuesday, July 19, 2016

Falling-block game in Minecraft

Over a recent trip, I had fun writing a little Python implementation of the classic falling-block game in Minecraft.


Wednesday, June 29, 2016

IRToWebThingy

For quite some time, my older daughter has wanted me to make her Great Wolf Lodge Magiquest wand do something at home. So I made a simple IRToWebThingy (the link gives build instructions). It takes infrared signals in many different infrared remote controls and makes them available over WiFi. As a result, we can now watch Netflix with a laptop and a projector and the ceiling and play/pause with the Magiquest wand (and adjust volume with our DVD remote) with a pretty simple python script. My son (with some help) made a 3D etch-a-sketch script that lets him draw in Minecraft with the DVD remote. I made a fun script that lets you fly a pig in Minecraft with a Syma S107 helicopter remote (see photo). You can even control rooted Android devices with IR remotes and shell scripts.

Sunday, June 26, 2016

Teaching programming with Python and Minecraft

Last summer, I taught programming to gifted kids with Python and Minecraft. Here's my Instructable giving a curriculum for a course like that.

Thursday, June 23, 2016

RaspberryJamMod for Minecraft/Forge 1.10

My RaspberryJamMod, which enables the Minecraft PI API for Python programming, has been updated to work with Minecraft/Forge 1.10. Still alpha-quality, but everything I've tried seems to work.

Sunday, March 27, 2016

Christ is risen!

Happy Easter, everyone!

Here are Easter eggs in Minecraft generated using my pysanka.py python script (included with Raspberry Jam Mod). The middle one is based on the design here (I am trusting that the amount of deformation and transformation is sufficient that it not be a copyright issue to post the Minecraft version).

Here are instructions on making eggs like that.

Tuesday, December 29, 2015

RaspberryJamMod for Forge/Minecraft 1.8.8

I just updated RaspberryJamMod, which allows one to run python code in Minecraft (using a variant of the Raspberry PI Minecraft API), to work with Minecraft 1.8.8 (with the latest beta of Forge). Merry Christmas!

Here's a rebel fighter from Space Janitors (using a mesh in their Janitor's Closet) generated with the render.py script.


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.

Friday, July 10, 2015

More Minecraft fractals

I posted an Instructable with a whole bunch of fractals in Minecraft via Python scripts.




Saturday, June 13, 2015

Generating looping color gradients with a limited palette

I was trying to generate a Mandelbrot set fractal in Minecraft using a python script. But the palette available is very limited, which led me to thinking how to generate a pleasing color progression out of a limited palette, and then I had a neat idea: just solve the Traveling Salesman Problem for the palette in RGB space. This generates a color progression that can be nicely used for looping the colors. The first version uses the larger palette of wool+hardened clay+redstone (and a version of this simulated annealing code), while the second drops the hardened clay (and now we can get an exact solution using this code).


Thursday, June 4, 2015

Python coding for Android Minecraft PE

I've been sensitized to the fact that there are many children who have no access to a PC but do have access to a smartphone. So in the interests of computer science education, I made a mod that allows for Python scripting of Minecraft Pocket Edition on Android. Instructions and links are here. The screenshots are from my Galaxy S3.






Tuesday, May 19, 2015

Lifelikeness of fractals

It's well-known that fractal-type objects can be quite lifelike and easy to generate. I've been scripting Minecraft with Python, in preparation for teaching this to gifted middle- and high-schoolers this summer, and wrote a simple 3D turtle graphics class with pitch/yaw/roll support. Like many kids of my generation, I did 2D turtle graphics programming with LOGO in school, but a 3D turtle just has a load of new possibilities. In particular, the 3D turtle allows for nice 3D fractal generation.

Instructions on how to do this stuff in Minecraft are in my Python coding for Minecraft instructable.

It was very easy to generate the following fairly lifelike tree with a simple bit of recursive code and some randomness.


An L-system does a pretty lifelike job even without randomness (using rules from geeky.blogger):



There is something glorious about a world where structures are mirrored on multiple levels. It makes the different parts and levels of the world be like a work of art, with themes and intertextuality.

Tuesday, April 21, 2015

Deep Space Nine in Minecraft

My big kids and I are Deep Space 9 fans. Here's a Deep Space 9 station rendered in Minecraft using our modifications to Martin O'Hanlon's rendering script from a mesh by Joerg Gerlach. For more on python and Minecraft, see here.


Saturday, March 28, 2015

Instructable for python coding for Minecraft

If anybody is interested, I wrote up an Instructable for python coding for Minecraft using my Raspberry Jam Mod.



Friday, January 23, 2015

Minecraft and python: Raspberry Jam Mod

I have a special interest in programming education for children, mainly because I have children and because so much of the fun I had as a child was from programming. Not too long ago, I came across the fact that on the Raspberry PI, you can control things in Minecraft with simple python code--in particular, you can procedurally generate objects. This is very attractive because my kids of course are really into Minecraft. But we don't have a PI, and while they're cheap, they need an HDMI display device and we don't have one. It turns out that there are plugins (e.g., Raspberry Juice for Bukkit) for Minecraft servers that implement (most of) the PI's protocol, but it seems overkill to run a private server just to do this.

So this January I made a mod for Minecraft 1.8 and Forge that implements most of the Raspberry PI protocol and works with most of the python scripts that work with Minecraft PI Edition. For instance, here's a spiral and a glass torus with water inside.



To install, you'll need python, Minecraft 1.8, Minecraft Forge, my Raspberry Jam Mod and the Minecraft PI Python package. Then:

  1. Install Forge for 1.8. 
  2. Create a Minecraft profile that uses it.
  3. Create a mods subdirectory to your Minecraft directory (%appdata%\.minecraft on Windows, I believe).
  4. Put my mod in the mods directory.
  5. Create an mcpipy subdirectory to your Minecraft directory.
  6. Put the contents of the Minecraft PI Python package into the mcpipy directory.
  7. Create a Minecraft profile that uses the 1.8 Forge.
  8. Run Minecraft and create a world.
  9. Run python scripts via commandline or straight in Minecraft via /py scriptname. E.g., /py nt7s_sphere will draw a sphere.
The scripts communicate with Minecraft via ASCII messages sent over port 4711. The python API is described here. The subset I implement is the Raspberry Juice one. There is a lot of information on python programming of Minecraft here (and the author of that site has a book which I've ordered for my kids but it hasn't come yet).

I am hoping that this will be great for both programming education and  teaching 3D geometry. 

It turns out that someone beat me to this by a couple of weeks, and has a mod for 1.7.10 that does the same thing. (In fact some of the ideas in the current version of my mod are based on the ideas from that mod.)