Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Modding Minecraft with PHP – Buildings from Code!
Oct 20, 2016 @ 15:58:47

The SitePoint PHP blog has posted another Minecraft-themed tutorial from Christopher Pitt, this time explaining how you can mod Minecraft with PHP without having to learn Java.

I’ve always wanted to make a Minecraft mod. Sadly, I was never very fond of re-learning Java, and that always seemed to be a requirement. Until recently. Thanks to dogged persistence, I’ve actually discovered a way to make Minecraft mods, without really knowing Java. There are a few tricks and caveats that will let us make all the mods we desire, from the comfort of our own PHP.

The method he's come up with talks directly to the Minecraft server (using AMPHP) to communicate via a RCON connection and place items in the world based on messages from the user. He uses code created previously to listen to the logs and grab the messages from the user. With this data he then sends a "blueprint" over the RCON connection with a set of coordinates of locations to build the blocks. The end result looks something like this.

tagged: mod minecraft tutorial build rcon command

Link: https://www.sitepoint.com/modding-minecraft-with-php-buildings-from-code/

SitePoint PHP Blog:
PHP, Arduino, And… Minecraft? Connecting an Arduino to PHP!
Jul 12, 2016 @ 15:39:38

The SitePoint PHP blog has continued their series looking at connecting the real world with the online world via Minecraft and an Arduino. In this new post author Christopher Pitt picks up where he left off in part one and brings the Arduino in to the picture.

In the first part of this series, we learned a bit of Minecraft and the circuitry we can make inside it. We also made a circuit to alert us when the door to our mansion was opened. We then hooked this virtual alarm to a listening PHP script, so we can know when the door is opened in the context of a PHP script.

In this part, we’ll build a small Arduino-based alarm circuit. We’ll learn how to trigger the alarm, using the the official IDE and programming language, and then using something called Firmata. We’ll round the series out by connecting the alarm circuit to the Minecraft circuit, so we hear a real alarm for Minecraft mansion.

He takes some time at the beginning of the post introducing the Arduino hardware and what they have to offer. He lists the parts you'll need for this setup to work and how they need to be set up. He then gets into the code for the Ardunio side and how to get it over to the board. He presents another option to the potentially painful change-reupload cycle of debugging Arduino code: using the PHP "carica/firmata" library to connect to and add listeners to hook into the board. He uses this to then set up a PHP script to watch for changes in the Minecraft log files and fire an event to the waiting Arduino board.

The final item in this part of the tutorial series talks about bringing in the "Gorilla" extension for Carica Firmata to help prevent issues with too fast connections to the board interrupting the boot sequence.

tagged: tutorial series part2 minecraft arduino alarm connecting event loop

Link: https://www.sitepoint.com/php-arduino-and-minecraft-connecting-an-arduino-to-php/

SitePoint PHP Blog:
PHP, Arduino And… Minecraft? Combining Minecraft with PHP!
Jul 07, 2016 @ 18:35:15

On the SitePoint PHP blog author Christopher Pitt has a new tutorial posted about combining PHP, Arduino and Minecraft and combine the physical and software worlds in an interesting IoT combination.

Some of the most interesting programming I’ve done has been in Minecraft. It’s an open-world, sandbox game developed by Mojang, (recently acquired by Microsoft). Minecraft began as a canvas for creative expression, and while I do very different things in it these days, it still is that for me.

I’m going to take you on a journey, as we build a Minecraft mansion, and then secure it with a real-world alarm system. There’s quite a bit of ground to cover, and though I plan for this to be a two-part series, I’m going to have to leave some of the tangential details for you to discover!

For those not familiar with "programming" in Minecraft (not the backend language, but using things like redstone) he gives a brief introduction. He then sets up the situation - the creation of a "sprawling mansion" in your Minecraft world and a need to secure the front door. He includes the command to set up the "door open" test on a command block. He then shows how to hook this into a loop to continuously test if a door is open or not. With this open/closed door check system in place he then brings PHP into the mix, having it check log files for the "whispers" when the door actions happen. He then creates a watcher for these events and has it respond with a chat message back to the user. That's all in this tutorial but a future part of the series will add on the physical aspect - the Arduino.

tagged: tutorial physical arduino minecraft notification watcher series part1

Link: https://www.sitepoint.com/php-arduino-and-minecraft-combining-minecraft-with-php/


Trending Topics: