Giter VIP home page Giter VIP logo

phip1611 / guess-the-spotify-song-partygame Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 929 KB

This repository was part of a 24h hackathon with a friend. Afterwards I further developed the outcome if this :) It' about a party game where each player use his smartphone as a buzzer and the fastest one that guessed a song (just by audio) wins a point. The game needs one player as the moderator/game master.

TypeScript 95.86% JavaScript 1.47% HTML 0.65% Dockerfile 0.45% Shell 0.62% SCSS 0.96%

guess-the-spotify-song-partygame's Introduction

Hackthon

Idea + Concept

A game with the spotify api. There is a game master that can set a set of songs in his web ui. Then he can invite players through a link. Hence, everything is a website/webapp. If all players joined the game master can start the game.

The game master plays the song on his device. From this moment the buzzer buttons in the web ui on the players devices will be enabled. The fastest player or team can make their guess and the game master decides if its correct.

The game master gives points to the team in his web ui.

It's recommended to use a big screen where the moderator can show the solutions, which players has the most points and so on :)

Learnings

I learned how to work with Web Sockets (with socket.io). This was my first project with realtime functionality. Quite interesting stuff!

Build + Run

$ sh build.sh
$ docker run -p 8080:8080 phip1611:guess-spotify-song-game

How to play

Game master visits http://localhost:8080 (or https://domain.tld with reverse proxy) and starts the game. He should share his display with everyone for example on a big TV or a projector. An invitation link for other players will be generated that looks like this: http://localhost/game/123

The game master himself can participate the game as well if he joines in with another device.

Giving points to the players is up to the game master.

The only functionality on the players devices is the buzzer button and of course the selection of a player name.

Description of protocol between game master - server, player - server, and game master <-via server-> player.

(See common-ts/socket-events.ts)

Server

  • listens on all new sockets for either GM_CREATE_GAME(gameId: string), PLAYER_HELLO(gameId: string), PLAYER_RECONNECT(clientUuid: string), or GM_RECONNECT(clientUuid: string)
  • associates all this sockets a uuid and adds the socket to the sockets of a internal Game-object
  • returns SERVER_CONFIRM(uuid: string)
  • this uuid can be used for either GM_RECONNECT(uuid: string) or PLAYER_RECONNECT(uuid: string) so that the sockets will be attached to the internal Game-object
  • server returns SERVER_CONFIRM(uuid: string) also after reconnects (with same uuid)
  • forward GM to Player: GM_ENABLE_BUZZER(), `GM_START_NEXT_ROUND
  • forward Player to GM: PLAYER_REGISTER(userName: string), PLAYER_BUZZER()

Game master

  • Sends event GM_CREATE_GAME(gameId: string) and receives SERVER_CONFIRM(clientUuid: string)
  • or sends GM_RECONNECT(clientUuid: string) and receives SERVER_CONFIRM(clientUuid: string)

  • sends GM_START_NEXT_ROUND(), GM_ENABLE_BUZZER() ...

Player

  • Sends event PLAYER_HELLO(gameId: string) and receives SERVER_CONFIRM(clientUuid: string)
  • or sends PLAYER_RECONNECT(clientUuid: string) and receives SERVER_CONFIRM(clientUuid: string)
  • if not done yet: sends PLAYER_REGISTER(userName: string) to game master
  • send PLAYER_BUZZER() again and again..

guess-the-spotify-song-partygame's People

Contributors

phip1611 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

guess-the-spotify-song-partygame's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.