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).