The development of the game “Guess a Sketch” for Twitch stream service on Python / Django

Since the appearance of the first Twitch Plays streams, I really loved this genre. A unique opportunity to watch the chat, which finds a way to beat the game to the end. Twitch Plays is a game in which control is tied to specific chat commands depending on the controller used in the game. For example:

  • UP — go up
  • DOWN — Go down
  • A — The operation under the A button
  • And so on …

Some of the most popular twitch plays streams were playing Dark Souls and Pokemon.

In February last year, I had the idea to make a game specifically for the Twitch, where users themselves upload an image which spectators would try to guess in the twitch chat.

How it works

Original Napoleon image

Take for example the image of Napoleon. As we can see one of the first problems converting the image to routes is the difference between the thickness of the lines. To do this, we need to get the skeleton of these lines:

Lines skeleton

The white dots in the image we can then be converted to an array, which is then brute-forced to find the neighbors of each point based on the motion vector. In the output we get individual routes which have a beginning and an end.

Individual line routes

Next, we connect the lines together for realistic drawing and add a thickness to them just by comparing the lines of the skeleton and the original image. Voila! We get a sorted array of points with a thickness that can easily draw in the Canvas. These are the miracles created with help of Numpy and Scikit-image.

And now let’s make a game!

So I told about the idea and its implementation for which there was one major problem — the speed of processing. Because of laziness and combining work with education, I was able to continue the development of this project in a year, adding to the algorithm also parallel processing. Plucking commitment and experience in web development, it was decided to create service for streaming.

Polymer framework was selected as the main instrument of labor, much loved by me this year. It is perfectly allowed to divide the site into components that really helped avoid confusion in the future. The server part of the site was developed on Django.

Streaming page
Upload image page

After 2 months of hard coding in my spare time, I am able to achieve my long-awaited dream of owning a Twitch plays stream where players can not only participate in guessing the word, but also think of their own!

Twitch: (subscribe to not miss the broadcast)