In-game voting - the correct way


I would like to implement a voting extension for my game.
A player who broadcasts the game would “roll the dice” by asking Twitch viewers to vote for an outcome of the next in-game event. Depending on the result of voting, a different thing would happen in game.
What would be the correct way to implement something like this?

What I currently have in mind is:

  • Implement an EBS with a web API
  • When a broadcaster wants to trigger a poll, he/she triggers voting via the EBS web API (with a voting timeout)
  • The EBS then sends a PubSub message to all viewers to show the polling UI (i.e. an overlay with buttons for different options)
  • Viewers cast votes by clicking buttons. That in turns hits an EBS web API endpoint with the selected option
  • The EBS validates and counts votes
  • Once the voting time has passed, the EBS broadcasts a message to the viewers to hide the voting UI.
  • At the same time the game uses the EBS web API again to retrieve the polling results. They are then used to trigger a specific action in the game.

Am I on the right track? Or perhaps there is a built-in system for voting/polling I missed? I am asking, as there is currently a way to cast a vote in Lumberyard that is basically managed by Twitch (as in, the voting options and a timeout are sent as an input, the server does the vote counting, and the results are sent back to the game; the viewers vote by typing text in the chat, though, no extensions are used).

Thank you,

Hey @Sly!

The approach you outline here pretty much sounds like the way I would do it as well. There’s definitely more than one way to accomplish this goal, but what you’ve described definitely sounds like one good way! :smile_cat:

— Amorelandra

Thanks for confirming that my rough implementation plan could/should work @Amorelandra! :slight_smile:

Out of curiosity, are there other ways for a game to communicate with a Twitch extension than via an EBS? One way would be to have the EBS implemented by the game itself I guess… though for an offline game the extension would have to use localhost urls, which sounds like a big no-no…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.