Multiplayer Quiz Flow
Understanding the data flow for multiplayer quizzes in IntelliQ
Overview
The multiplayer quiz flow in IntelliQ involves several API endpoints that handle quiz generation, submission, and leaderboard functionality. This guide explains the complete flow from quiz creation to viewing results.
Flow Diagram
-
Generate Quiz (Admin Only)
Generate a new quiz with specified parameters:
The response includes the quiz structure with questions and answers.
-
Create Quiz Room (Admin Only)
Create a new quiz room with the generated quiz content. The
roomId
is a unique identifier for the multiplayer session.The response includes:
quizId
: Unique identifier for the quizquestions
: Array of questions with their IDs
-
Get Quiz Questions (Players)
Players retrieve quiz questions without correct answers. Response includes:
- Quiz title and ID
- Questions with options (no correct answers)
- Question IDs for submission
-
Submit Answers (One at a time)
Players submit answers one at a time, with the time taken to answer:
The server:
- Validates if the answer is correct
- Calculates points based on time taken using the formula:
points = Math.round((1 - (timeTaken / timeLimit) / 2.2) * 1000)
- Adds bonus points for fast answers (under 10% of time limit)
- Updates the user’s total score
- Returns the calculated score and submission details
-
View Leaderboard
Retrieve the current leaderboard for the quiz room, showing all players’ scores and correct answers.
Response Examples
Scoring Mechanics
The time-based scoring system rewards both accuracy and speed:
- Base Formula:
points = Math.round((1 - (timeTaken / timeLimit) / 2.2) * 1000)
- Fast Answer Bonus: +50 points for answers under 10% of the time limit
- Minimum Points: All correct answers earn at least 100 points
- Incorrect Answers: 0 points
Each user’s total score accumulates as they answer questions, and their submission record is updated rather than creating multiple records.
Error Handling
The API will return appropriate error codes and messages if:
- The quiz generation parameters are invalid
- The room ID doesn’t exist
- The question ID is invalid or doesn’t belong to the quiz
- The user is not authorized to access the room
Written by Ricky Raveanu