January 22 | 2019
Magic Bullet’s ‘Twitch Slot racing’
Magic Bullet is our in-house digital production team that, apart from creating awesome work projects, come up with proactive, quick, and cool ideas in their downtime.
Just for fun, MB repurposed a slot race track for the platform Twitch.
“We decided to re-wire something physical into a new digital platform. We had already hacked an old 80’s slot race track, and re-programmed it so it could be controlled through the API of Twitch.”
You might wonder, what is Twitch?
“Twitch is a popular online service for watching and streaming digital video broadcasts. When it was founded in 2011, Twitch originally focused almost entirely on video games but has since expanded to include streams dedicated to artwork creation, music, talk shows, and the occasional TV series.
The streaming service boasts over 2 million unique streamers every month and more than 17 thousand of these users earn money through the Twitch Partner program, a service that provides streamers with added features such as paid subscriptions and ad placements. Twitch was purchased by Amazon in 2014 and it remains one of the highest sources of internet traffic in North America.” (source: Lifewire)
So, how did it work?
“Every channel on Twitch hosts a chatroom where people can communicate. By sending a specific character combination, such as ‘!A’, we could control the voltage of the track and move a slot race car. The race track itself had sensors built in, which communicated back to Twitch, recording lap counts. This way, we had a complete game-logic as every race started with a countdown and ended on one of the cars completing 5 laps.”
The video consisted of a top-view HD camera, a side-camera at the finish line and an extra camera in the corner. These video feeds were combined in OBS streaming templates, and we added space for advertisements on the bottom left, which read images dynamically from a server-folder. Combined the video stream looked like this, which was then directly streamed to Twitch:
The commands from the Twitch chatroom were sent through their API to our NodeJS server, which translated the commands to the screen and the racetrack controller. The racetrack Arduino controller controlled the cars’ speeds and picked up the sensor data, which returned to NodeJS.
The screen in the middle of the track displayed the lap counts, winner and countdown for the race.
In the Twitch chatroom we set up, you could be added to the race team, and you could start typing ‘!A’ for moving the red car and ‘!B’ for moving the blue car. The faster you typed the command (or copy/paste), the faster the cars would move.