r/howdidtheycodeit • u/MaskedImposter • Jul 02 '21
Crowd Control (Twitch Extension)
For those who don't know, Crowd Control is an extension for Twitch that allows players to spend coins to influence the streamer's game. For instance they could deal damage to Mario in Mario 64, or give him a power up.
I'm more interested in how to set up the user interface portion. In the past I've used TwitchLib for Unity (https://github.com/TwitchLib/TwitchLib.Unity) which is a chat based solution, so you would have to enter in commands like !Damage or !Metalcap into chat if I were to do something similar. This was sub par as there wasn't a good way to show the viewer information.
Crowd Control on the other hand provides a convenient UI to viewers to let them know how many coins they have, how much commands cost, and even let's multiple viewers pool their coins together to activate a command.
4
u/ignotos Jul 02 '21
Most Twitch overlays are created by overlaying a webpage with a transparent background into the streamer's video feed, with streaming software like OBS.
So essentially you'd create your application as a webpage, using Javascript and perhaps a graphics library like p5.js or similar to draw the UI, and the streamer would then embed that page into their stream.
You could also have a separate page/web application which viewers can access if you want them to be able to view / manage things specific to them. Twitch has a feature called "Extensions" which allows these to be integrated directly into the UI on the streamer's page.
2
u/jakuu Aug 31 '21
Hey /u/MaskedImposter this video might help you out a bit as well. We did a 2 part episode for Crowd Control and gave some details of how it works and things. https://www.youtube.com/watch?v=EMRpBeg_U7c
Feel free to reach out to us on our Discord or PM me if you're interested in learning more!