Anthony tests his ability to influence real-world objects from within the Minecraft universe.
While I was never a child that knew what I wanted to be when I grew up (and I still don’t), as I grew older, I did have a few notions of what would be great. Aside from being Joe Montana’s replacement or taking gigs from Hans Zimmer, I was always amused by Disney theme parks and the thought of being one of the Imagineers that helped create them.
This combination led me to building my own theme park ride: a little digital minecart coaster that triggers real-world lighting to match the in-game illumination.
Take a look at the short clip for a demonstration:
While riding the rail, lighting in real life imitates lighting in the game. That’s flattering.
By casting light over the entire range of vision, as opposed to merely casting within the size of the television or monitor, an illusion of being engulfed is created. Much like how surround sound immerses a movie goer in a scene, surround lighting places the user right in the center of the action.
Undoubtedly, the most difficult part to hacking on Minecraft is setting up your own server. Official OS X support is scarce, so finding the needed files takes a bit of hunter-gathering. A few of the sites you’ll find in your journey reside in some murky Internet neighborhoods where you’ll ask yourself, “Is this THE link? Or is this a chancy download laden with viruses? Oh! 25 celebrities you forgot committed horrible crimes? How can I not click that?”
Once you get your hands on the needed files, setting it up takes quite a few steps and a decent amount of time. With the right guide I was pleasantly surprised to get through the 20 plus steps without much resistance.
Feeling good about getting the unknowns and sketchier parts of the coding out of the way, it was time to get to the lighting control. I’m using the Philips Hue smart lighting system. Controlled via wi-fi, the Hue has proven to be very reliable with a super simple API. The basic kit used in this project contains three LEDs and a central communication hub:
Image courtesy of Amazon.
They are a bit pricy on the surface, but have real everyday utility and are worlds apart from the expense of traditional home lighting control systems.
Setting up the lighting system is straightforward. Here is the link to get you rolling. You can hardcode the bridge ip for a quicker setup while testing. Just be careful to ignore or delete any sensitive data if you are saving to version control, such as Github. If you plan on spending more time using the lights, it’s well worth making your own module you can reuse across several lighting control apps.
As for the event scripts themselves, I kept them in the plugins directory as recommended in the README.. I also created a few custom services for the lighting within the modules directory. While this project is still in its infancy, the source code can be found here.
My initial test was to simply trigger a light on/off action with the flip of a lever. I was able to accomplish this using a redstoneChange event. However, this tied all redstone changes to a single event. Great for turning a light on and off. Not great for creating a scalable and expandable amusement park experience. This is where I admittedly struggled using ScriptCraft. I was looking for a simple leverTriggered-like event that returned coordinates of the said lever. Mapping an action to that would be pretty trivial.
Flip that switch and amuse your friends as the living room light turns on.
After much digging I was still unable to return any meaningful event-fired data. Searching the source code and following the docs led me deep into Java territory where my comprehension was similar to a first-year Spanish student watching Shawshank Redemption on Univision.
I settled on a temporary janky implementation. Seeing that I could not tie a single action to an action ID, I went with a custom event counter, incremented anytime a redstone change hook was fired -- basically a top-to-bottom scripting of actions triggered by the running count.
I started by laying down a few activator rails spaced between regular rails. Successfully logging the count as the hook was fired proved things were on the right track. One immediate issue that surfaced was the count falling out of sync if all events were not fired in the circuit. Thus, real-world actions will not match their in-game counterparts. To remedy this, I tied a function that resets the counter to a Minecraft lever pull.
Okay, let’s build!
While not pretty, the ability to influence real objects from within Minecraft gave me the proof of life needed to continue with this hack project. The focus now shifted to the more mindless fun. The goal was to create an environment that emphasized the illusion of total immersion. The best way - extreme contrast of lights and darks. To have total control of this, we had to go underground. So it was time to roll up the sleeves and put in work breaking brick.
After mining a long tunnel under the surface, I started working on the overall vibe. To keep the tunnel dark even with the iridescent redstone tracks, I layered the entire cave with obsidian. Despite the lighting physics being a little wonky in Minecraft, you are still able to create a pretty dark atmosphere with this technique.
The first section above ground was to set the eyes up as they adjust to the brightness. As per any respectable ride, we had to set a serene, peaceful scene first. A little flat cruise with a shout out to our homemade Augmented Reality rig took care of that. As we break the plane of the first dip, we trigger the first activator rail. The lights go dark to match the onscreen action. The extreme change from all bright to no light causes a dramatic start as the eyes struggle to adjust.
For the next section, I was aiming for that flickering light effect you get while driving through highway tunnels cut into mountains and lake beds, or crawling along under LAX on the PCH while convincing yourself it’s still quicker than the 405. For this, a few lights equally spaced are used to represent the sconces -- for lack of any Google-able better word -- that you find in these tunnels. I went with red to make the flickering more ominous.
The next section just shows off the ability to trigger lights individually. Keeping with the mood lighting theme, I went for blue and purple for a soothing effect. You deserve it for following along this far.
The last section flips the intro. An extreme dark-to-light transition leads to involuntary squinting and a dramatic bird’s-eye-view before the final drop brings the experiment to a close.
You won’t find this attraction at Disneyland anytime soon (Disney, you can change this). However, the goal was to create a bit of real-world immersion on the cheap, both in labor and cost. Bias aside, it does a decent job at this. It also served as a proof of concept for more things to come:
- Some reasonable: Incorporate an Arduino/Raspberry Pi controlled fan to simulate wind resistance while zipping down 15-blocker drops.
- Some more elaborate: Use a grid of lights that are locationally aware of the direction the player is facing.
- Some just plain ridiculous: Build a replicate real-world cart that mimics the motion and angles of the in-game cart using actuators. Think if Tim “The Tool Man” Taylor built a fancy flight simulator.
Hmm, does anyone make a smart torch system? Safety optional.
All in all, the experiment produced more joy and less frustration than expected. I’ll surely sink another weekend in the near future taking this to the next level.
Night falls as another day of my life is consumed by Minecraft.
BTW, we blog about other tech-related stuff often. Subscribe here for updates.