MLH Local Hack Day 2018 - Twitch Plays Tetris
For the 2018 MLH Local Hack Day, I decided to try to make a “Twitch Plays” style of game. I began by working on the Twitch side of the system, which comprises of a Python script that connects via IRC to the Twitch channel’s chatroom, and a second Python script that runs a websocket server. Whenever the websocket server receives a message, it broadcasts it to everything that has connected to it - which under normal circumstances will be the IRC script and the browser running the game. (Incidentally, the university’s network blocked the ports required for IRC, so I ran these two scripts on a Microsoft Azure virtual machine.)
It’s also possible to play the game locally, as the JS also contains a key handling function which will imitate messages being sent from the server when the arrow keys or the “c” key are pressed. This came in useful during the writing of the game, as it meant I didn’t need to spam the chat window every time. A limitation of the project is that Twitch won’t let you send the same message in a 30 second window, or let you send too many messages in too short an amount of time. This can be overcome by giving the desired user a “mod” or “vip” role in the channel.
You can see the project in action here:
The hack was submitted for the both the “Best Open Source Hack on GitHub” and “Best Miscrosoft Azure Hack” categories, and of the 53 submissions for the Azure category, it was selected to be one of the three winners.