Inspiration

Twitch itself as a platform was an inspiration. It provides an Interactive experience to its viewers and streamers. Viewers can digitally interact with their streamers live. With game matched extension now this digital interaction could be made more specific to the content of the stream. In StarCraft 2, a strategy game, a player has to handle multiple functions at the same time, like building new structures, building new more powerful army units, attach enemy units, expand and so on.

Blizzard has published a library that helps in building SC2 bots. This was another source of inspiration, which got us thinking what if the Bot instead of being unmanned, could be remotely controlled by viewers from Twitch extensions. The streamer can play along with the Bot against an opponent. Hence, viewers also become a very core part of the gamers journey through StarCraft 2.****

What it does

The streamer installs and starts AlfredBot(Twitch based Desktop App). The bot is then used to start SC2 in controlled mode. Now the streamer can play SC2 normally while the Bot also active is listening for commands on streamer's channel.

The streamer enables the Twitch Extension for AlfredBot on their channel.

Viewers can now issue commands like build Pylons, Assimilators or Cybernetic Core engine etc, from the Twitch extension. These commands are published and AlfredBot running on streamer's machine executes them live in game.

Thus, the streamers can delegate some responsibilities in the game to their viewers.

How I built it

Frontend Twitch Extension UI:

  • Svelte 3 (Reactive UI)
  • Bulma CSS
  • Apollo (graphql-client)

Extension Backend Service

  • Hasura GraphQL Engine Over Postgres with query subscriptions support over WebSocket
  • A lightweight NodeJs Microservice with Redis Cache to manage a live game session
  • Docker to run Hasura and Microservice in containers on a single machine (this is so we can scale later if the need be)
  • AWS Lambda to create a Auth service which can validate Twitch tokens and also facilitates login with Twitch in applications.

AlfredBot - Twitch Application - Desktop App

  • A bot created using python-sc2 library. The bot can start the game in controlled mode and receive commands over network.
  • Electron to build a desktop Application which encapsulates the bot and also provides an interface to login the streamer into Twitch.
  • ZeroRPC, for starting and stopping the Bot from NodeJs bases electron.

Challenges I ran into

  • First challenge was, how to interact with the Python program running SC2 from Electron(NodeJs) code. Solved using RPC.
  • Responsive Design of the extension UI.
  • A GraphQL Subscription Client in python. There were no mature solution available. So created our custom library for subscribing to the new commands in Hasura GraphQL Engine.

Accomplishments that I'm proud of

  • The python desktop client, was developed in non-blocking reactive architecture, which does not degrade in performance with time.
  • The whole journey was kind of daunting, but to be able to complete the first cut release within the stipulated period of time really makes us happy.

What I learned

  • I learned how to build a Twitch extension and was really amazed at the detail documentation available which made this learning curve small.
  • RPC remote procedure calls, was a theoretical concept for me. Learned the challenges and hacks of implementing one practically.
  • Svelte 3 is another amazing UI framework, which we had fun learning and implementing UI.
  • Hasura GraphQL engine a no code platform for developing GraphQL queries and subscriptions.
  • How to find a problem, by doing surveys with Twitch Streamers and understand if a certain digital experience is really needed by the community or not.

What's next for AlfredBot4SC2

  • Currently the Bot only supports Protoss Race in game. Going forward support more Races.
  • Enable multiple player mode, wherein one streamer along with his/her viewers can go against another similar hive of a streamer and his/her viewers.
  • Expand the application of the concept of "Human Controlled Bots" to other strategy games.
  • Introduce support for Advertisers to unlock different offers based on number of commands executed.

Built With

Share this project:
×

Updates