Build a Live Multiplayer Programming Trivia Game

Let’s build a live multiplayer trivia game using Socket.IO!

Trivia game features

The following features will be part of the game:

  • Each player is required to enter a name and a room to join a game.

  • Multiple players can join a single channel/room. Multichannel support isn’t part of MVP(model-view-presenter), so only one game can happen at a time.

  • Within the game channel/room, we’ll use the following features:

    • Players can chat with each other in realtime.
    • Players can view who else is in the room as well as the room they’re currently in.
    • Any player can initiate a game.
    • Each player is allowed to submit only one response per player.
    • Each player must submit a response before the answer can be revealed.

Starter code

There’s no starter code for this section. We’ll follow the steps described below to build the project from scratch.

Task 1: Installing Express and Socket.IO

  1. From our terminal, change into our course directory: $ cd /path/to/your/course/directory

  2. Create a new directory: $ mkdir trivia-game

  3. Change into the /trivia-game directory: $ cd trivia-game.

  4. Turn the respective directory into an npm package, and use the information extracted from the current directory to configure the package.json:

Get hands-on with 1200+ tech skills courses.