Loading...

About the project

It's a multiplayer web-party game, of which you can play with up to 4 players.

Game rules

  1. Enter into a lobby and wait for the host to start.
  2. Start entering random words to fill the amount needed.
  3. Each player will receive random words out of the total entered words.
  4. Complete the sentences with the word you think is the most suited or funny.
  5. Vote for the best word for each sentence and see who won.

Purpose

everyone likes a web party games, and I had to try to implement one when I found out about Firebase realtime database.

It wasn't too hard to set it up and it was a very fun experience.

How the database looks like?

the database has two seperated fields :

  • array of premade sentences.
  • array of rooms
    • each room has:
      • players: player has the random words, amount of rounds won in the game.
      • sentences : randomly selected upon starting match.
      • stage: indicator of current stage.

it has more into it, but that's the core.

players are subscribed to the room, so they can update the related fields when neccessary.

Some unimportant stuff

  • when player leaves, his player object will be deleted.
  • when the game ends, the room will be deleted.
  • when the last player leaves the room, it will also be deleted.
  • there is a cron job that run daily to delete still existing rooms with stage that indicates that the game is over.