Creating a Game
Paying for a Game with Metamask
Game Over - Three Player Game
Bands! - Remonetize Your Music Videos With the Power of the Ethereum Network!
Fans! - Share the Music Videos You Love with Other Music Fans while Raising Money for Your Favorite Bands!
EtherBandBattles is a fun game where players share videos that they watch together with real-time video stream synchronization provided by the powerful PubNub network. EtherBandBattles is a real Ethereum dApp currently running on the Rinkeby test network. It's a great way for bands (and later other video streamers) to remonetize their music videos and for fans to raise money for their favorite bands by having fun playing a unique game.
It's hard as hell for indie bands to make money these days and it's the fans that suffer the most! EtherBandBattles solves the problem of getting badly needed funds into the hands of starving artists by letting fans compete in an Ethereum based Battle of the Bands. It's also a tremendously fun way for fans to introduce new music to each other in a friendly social venue.
What it does
Each user submits a video of their favorite band, hosted on YouTube, and pays their entry fee to the game in Ethereum. In real-time, they watch together each of the videos they submitted, one at a time. Each player marks the spot in the video that they feel everyone will like the best, without knowing what spot the other players picked. When everyone has made their choice the round completes. The game server calculates the winner of the round by determining which person picked the spot in the video that is closest to the rest of the player's choices (i.e. - the most popular spot in the video based on the player's choices). That player wins the round. Then without the players having to lift a finger, the next video in the game is popped into all of their players automatically for the next round of play.
The game's vital details are written to a smart contract on the Ethereum network as the game progresses. The game server leverages the powerful PubNub real-time network to link together every player's video player, thus allowing people from all over the world to enjoy a shared video experience as they chat about their favorite bands. As a final treat, when the game ends the players enter the After Party. In this mode, if a player wants to show everyone a specific part of a video they love, they just drag the position slider and everyone's video player snaps immediately to that spot so they can discuss, argue, and enjoy that part of the video together!
When all the videos have been watched the game is over. The game server calculates and then publishes the list of winners. The contract then pays out the winnings to the bands and the players based on the following formula:
9% of all the funds goes to the "house" for administrative & development fees.
The remaining funds are paid out as follows:
Half of the remaining funds is split equally over the number of participating bands
The other half is distributed to the players in proportion to the number of rounds they won. This can be summed up by the following formula:
(Number of rounds won / Number of videos) * remaining funds.
Here is an example using a sample game with 3 players: Robert, Laura, & Manny. Since there are 3 players, then this means that there are 3 bands and also that there are are 3 videos:
Robert wins 2 of the rounds
Laura wins 1 of the rounds
Manny doesn't win any rounds
With these facts the payout would be:
Robert: Gets 2/3 of the funds reserved for the players
Laura: Gets 1/3 of the funds reserved for the players
Laura: Still wins because she spent the evening chatting with like minded music fans, while promoting her favorite band, and learning about two other bands she is now a fan of.
The motivations behind these game mechanics are:
The players know that no matter what happens, they will have helped raise money for the band they sponsored since the bands always get paid.
But, they still have fun competing with each other trying to win each round, and therefore win some extra Ethereum
They are introduced to new music from the other players bands in a fun, social manner
By trying to guess the video location that will be the most popular with everybody, instead of just picking their favorite spot, they are coaxed into looking more intently at each video in a way that encourages empathy and greater attention to the content.
Band Payout Notes - Escrow Payments
How does the server know what Ethereum address to use when paying the bands? The game server checks the band's YouTube channel description for an Ethereum public address. It gets the channel description from YouTube via the YouTube API, by querying that API for the owner of a video that was used in the game. If it finds an address in the channel description it makes payment to that address immediately. If no address is found, the payment is stored in the smart contract's escrow facility, with the payment tagged to the band's YouTube channel ID. Later, the band can add their address to their channel description, and collect any amounts stored in escrow from EtherBandBattles.
How I built it
- I used Node.js for the web site and to interact with the Ethereum network via Web3.js.
- I used the PubNub real-time messaging network for the server broadcasts that execute the game mechanics, which include interlocking the video players for real-time synchronized playback and notifying the players of the game results in a push notification manner.
- I used the indispensable Open Zeppelin smart contract library as the foundation for the smart contract that backs the game.
- I used the YouTube API for doing video searches and for querying a band's video channel details as described above.
Challenges I ran into
Coming up with the correct ideas to make the same smooth and enjoyable.
What I learned
Ambition is the root of all late night programming sessions and sleeplessness.
What's next for EtherBandBattles!
New game versions and multi-language support, and support for other video platforms beyond YouTube.