Monday, 1 April 2013

Minecraft: Pi Edition - Manhattan Island

How about a stroll around Manhattan?  Well a stroll around Manhattan in Minecraft, perhaps admire the Empire State Building or the pay $25 to take in the view from the "top of the rock"?

Empire State Building
View from "Top of the Rock"
I decided to see how much I could push the program I wrote which uses the API in the Pi edition of Minecraft to render 3d models in the Minecraft World.  It turns out I could push it a LOT, I fancied creating a city scene, and is any more dramatic than New York, Manhattan Island.


I found a Google sketchup model of Manhattan and using OBJexporter, exported the model to an OBJ file.

Sketchup 3d model of Manhattan
To give a scale of how massive this model is, previously the most complicated model I had produced in Minecraft was of a girls head, that took about 3 minutes to render, this took 1 hour 25 minutes, and that was after I had already cleared a suitably large area!  The Pi took it all in its stride though and while it took a long time, there were no errors or glitches.

The model is pre 9/11, so the iconic Twin Towers still dominate the skyline.

Iconic buildings
Download and run
I have updated my program to include the new york model, which you can download direct from git-hub, so run minecraft, open/create a world and follow the instructions:

sudo apt-get install git-core
cd ~
git clone https://github.com/martinohanlon/minecraft-renderObj.git
cd minecraft-renderObj
python minecraft-renderObj.py

If you want to know more about how this works and have a go yourself, head to this post, http://www.stuffaboutcode.com/2013/03/minecraft-pi-edition-create-massive-3d.html.


2 comments:

  1. Hey, I get this error when running the v2 program on RPI:

    2016-01-17 00:39:46.632447
    obj file loaded

    Traceback (most recent call last):
    File "/home/pi/minecraft-renderObj-master/minecraft-renderObjv2.py", line 422, in
    mcDrawing.drawFace(faceVertices, materials[faceCount][0], materials[faceCount][1])
    File "/home/pi/minecraft-renderObj-master/minecraft-renderObjv2.py", line 57, in drawFace
    self.drawLine(lastVertex.x, lastVertex.y, lastVertex.z, vertex.x, vertex.y, vertex.z, blockType, blockData)
    File "/home/pi/minecraft-renderObj-master/minecraft-renderObjv2.py", line 69, in drawLine
    self.drawVertices(self.getLine(x1, y1, z1, x2, y2, z2), blockType, blockData)
    File "/home/pi/minecraft-renderObj-master/minecraft-renderObjv2.py", line 65, in drawVertices
    self.drawPoint3d(vertex.x, vertex.y, vertex.z, blockType, blockData)
    File "/home/pi/minecraft-renderObj-master/minecraft-renderObjv2.py", line 21, in drawPoint3d
    self.mc.setBlock(x,y,z,blockType,blockData)
    File "/usr/lib/python2.7/dist-packages/mcpi/minecraft.py", line 138, in setBlock
    self.conn.send("world.setBlock", intFloor(args))
    File "/usr/lib/python2.7/dist-packages/mcpi/minecraft.py", line 22, in intFloor
    return [int(math.floor(x)) for x in flatten(args)]
    TypeError: a float is required

    I converted the minecraft into mcpi

    ReplyDelete
    Replies
    1. When I wrote this I was using an earlier version of the api, which is in the 'minecraft' directory. By converting it to mcpi, you are using a later version which isnt compatible with the program.

      Delete

Note: only a member of this blog may post a comment.