Friday 9 August 2019

Minecraft Pi: Happy National Day Singapore!

The date is 9th August 2019, Singapore's National Day. Happy National Day! Few weeks ago I decided to hang the Singapore flag in a virtual world, the Minecraft Pi world my son and I built as a team. Here is the flag, on top of my castle.


I believe that with creativity, you can pretty much design anything. That is why I spend a significant amount of time with my son playing with Lego and Minecraft. He may become a designer for award winning products, or apply his creativity to other passions such as music. It is what makes us human. If you have read my previous articles, you will know that it is possible to use Python scripts to create monuments in Minecraft Pi. This time round, I decided to go into property development and retail. So I dug a hole to hell (as my son decribed it), levelled the land around me, and built a 22 storey shopping building. It has 13 floors below ground and 9 above. The interior is still a work in progress. Here is a snapshot taken from a link bridge from one of the castles. See the spiderman banner next to the building. Without image processing and programming it would take too long to make one. What can this do in real life? Converting photos of people into Lego mosaics that can be sold for money. Value add.


Here are a few more snapshots, where you can see a rooftop infinity pool (popular nowadays) and a helicopter landing pad for the rich executives.



Now, lets go inside the building to have a look. Notice in the photo below that the floors are numbered. This is to help me know where I am in that world. Too many floors and steps to count. The floors and ceilings are made of glass. This ensures the maximum use of natural lighting to make the building comply with new regulations.


My son started from the lowest floor. Note that the it is rather bright at the bottom. My kid had a lot of fun digging holes next to me. Whenever I fell into these holes, it resulted in the following:


He couldn't stop laughing whenever that happened. That also meant I had to respawn far away and walk back to the building. Kids tend to give you extra work for their notion of fun, right? 

Kids somehow love dinosaurs. Here is the dinosaur bone museum he built. I told him that it doesn't make money for the shopping centre building. He said people will pay a hundred dollars to go. So I gave him a reality check and told him that it is free in some places like London. Of course it was allowed in the building, as long as he built the retail shops for me.


On the floor above, he built a library, another venture that doesn't create revenue. I said okay as long as there are enough shops paying rental. Need to eat, and maintain the building. Here is the library.


Notice the water flowing through many floors. He wanted to create a waterslide after watching some Youtube videos. I let him do it. Difficult project because of leak issues when I break some glass blocks. Quite nice to see. Hope I don't have to dismantle these for more retail space. In real life, this has happened to AMK Hub.


Finally, my son built a McDonald's with an ice-cream shop next to it. Will need more shops to earn the rental revenue. He said this building should come with apartments. So maybe 9 floors of residential areas and 13 floors of retail. Apartments are worth more when they are above ground.


Now, we move to another part of the map. Outdoor movie theatre! Nice? May build one in the shopping centre. Need to consider the ergonomics and design seats accordingly.


My son wanted to build Spiderman statue on a new map. However, I convinced him not to as there was still a lot of space left for development. So I taught him to reclaim land to do that. Was the construction worker on the ground laying sand and grass to make sure this happened. He built the statue subsequently while I went somewhere else to dig a hole.


That is all for today. Will have more coming up in future.

Monday 1 July 2019

Minecraft Pi - advanced features and creative structures!

This is the second blog post about Minecratt Pi. Do read until the end to see something nice.

It is quire an amazing tool for honing a kid's creativity. My kid looked at some images online, and was able to create mythical creatures. It shows that his spatial sense is on the high side. Something to be proud of. Here is a creature that supposedly breathes fire. Amazing, isn't it?


The last blog entry used pictures from a Windows 10 laptop, via screenshots on VNC viewer. Not so user friendly, and I had to move on the Raspberry Pi to align the screenshor,while waiting for the laggy interface to update the image on the screen. Used Paint to crop. Time consuming, isn't it?

For the images in this blog post, I used raspi2png. Just need to read up on some of the settings to get it right. You can call it from a python script, which makes life many times easier. Align, start the script, and take the screenshot. It will crop and save the images accordingly. Say bye bye to ugly borders. For details, leave a message here and I will get back to you soon.

Here are some more mythical creatures built by my kid. Sea serpent that he led me to, and phoenix near the eiffel tower breathing smoke. Glad my kid has been trained to do this. Let's hope machines are unable to become creative in future.



We decorated the castle that I built with python scripts. See the flag on that newer castle. H (yellow) and J (blue). Many walkways were created to link different buildings. No covered walkways unfortunately because it is always sunny in Minecraft Kingdom.


My kid decided to build a greenhouse between the old houses in the village. To plant bamboo. No pandas here to eat it unfortunately. I built a long staircase up to the older castle, from a beach house. We also decided to help the Kingdom progress by building an 11 storey condominium on reclaimed land, with a bridge and pathway to the newer castle. The rooftop view is breathtaking, because it looks like there is a layer of clouds between the ground and the roof. As usual, my kid decided to decorate every floor with a different theme.




Here is another image of my kid's creation. He wanted Batman, Captain America and Power Ranger to be shown. See that bridge? It leads to the newer castle. Took a while to build that.


Somehow my kid is into interior design. He decided to overhaul the Batcave I dug. The original boring computer was replaced with a colourful one.


As he likes reading, he built a library for studying. That is where I would hide to take a nap.


Here is something fun that I did not manage to finish before sending my kid to his mum last weekend. Here is how it was created:
1) Take an image I want to build as a banner.
2) Scale it accordingly to the width I want.
3) Identify the bricks to use for it automatically.
4) Clear the space around me.
5) Build the banner.
To do this, you need some skills in image processing algorithms (too long to elaborate here).


Finally, the finale. Optimised a python script to take screenshots while I chased my kid around the map while dressed as Batman. This is as good as it gets (for now) until I find a better solution.


Hope you enjoyed reading this. Feel free to post questions here.






Thursday 13 June 2019

Minecraft Pi - Creating a beautiful world to explore

I have two Raspberry Pi Model 3B at home, just collecting dust until recent months. Have tried configuring many SD cards to enable different operating systems to run on the Raspberry Pi, from NOOBS, Ubuntu Mint, Raspbian to Retropie. Each have their own features, as well as pros and cons in terms of complexity. That is a topic for another post, another day.

The focus today is on the Raspbian system. It comes with pre-installed programs such as Python IDLE, Minecraft Pi, Scratch, as well as many other useful softwares. Decided to work on Minecraft Pi to entertain my kid, so that I would not have to buy the app on Android for around 10 dollars. This version of Minecraft can be quite educational for the little ones. The aim was to satisfy some of his wants while testing a way to motivate him to learn more about computers. We built many buildings in this game together, over the local network. Here is an example of a house with a chimney and a huge castle next to it. Still a work in progress as we are digging an underground level for rooms.


Imagine having a whole city full of different buildings for different purposes, as well as pathways and natural landscapes. The job would be too big for two of us. Thankfully, this version of Minecraft also comes with a Python library to allow extra features that the GUI does not grant access to. To summarise, it is possible to search for other players, teleport to them, blow up dynamite as well as choose special blocks for special effects e.g. lava and water. The library allows the use of mathematics and logic to produce very interesting structures very quickly. Wrote a library in Python to allow customized buildings to be produced quickly, so that we can work on interior design manually. The library allows the use of different materials, as well as parameterized structures to fit in different spaces. It also has automatic routines to enable the levelling of land around the player, in order to build something on it (kind of like urbanization). Here is an example of what it looks like on the inside of the house that was built using a Python function, after the manual work involved in interior design.


Now we fly to the sky to have a look at some simple structures. The Python functions can produce  buildings that look like Stone Henge, as well as pyramids and glass domes. It is really all just mathematics. Notice the houses partially hidden by the fog. These were built using functions as well. One of them is a greenhouse.


Now we go back to the ground to have a look at the landscape. Managed to grow some nice plants in the greenhouse, Built a nice hedge around the greenhouse for completeness. Notice the dirt track on the ground. That was built using a function too. Just activate, and walk around the map from one part of the city to another, and that dirt track follows you.


Now we teleport to another part of the city. Wanted a castle on top of a hill (this is the first castle I built). The second one is a lot bigger (see first image). Castles are essentially made of modules. Just needed to put a few functions together to get it done. Materials can be chosen based on aesthetic preferences. The glass tower below is essentially made from the same function as the 4 towers in the castle. The nice looking red power ranger and spiral staircase were made manually. My kid managed to make the power ranger all by himself. Job done training his dexterity and creative mind.



Notice the gold building on the right. The dome below was created using the same function used to create the glass dome in another part of the city. The top part was built manually to look like a flower tower. Notice the link bridges. These were built and decorated by hand. Suspect my kid is going to become really good at First person shooting (FPS) games in future.



Now, back to the ground. Took much longer to decorate the castle than building the main structure. After observing my kid digging his way around the map and laughing to himself, I decided to dig a moat around the castle, as well as dig hidden tunnels around the castle. See the nice lighting effects produced by the torches. This tunnel leads to a corner of the castle where a cliff is.


Finally, the view of the exit of the tunnel, where there are waterfalls. The water can flow for real, and it can be quite difficult to navigate the waters in the moat. Enjoy the view. This setup costs around 200 dollars in total, including peripherals. Would recommend doing this with a kid to hone our programming skills instead of spending on expensive game consoles.