Planning¶
QuizBattle Concept Document¶
Product Vision¶
QuizBattle is a web-based multiplayer quiz platform with two main styles of play: a relaxed asynchronous mode in the spirit of Quizduell and a competitive real-time ranked mode. Registered users build a persistent player identity through match history and leaderboard progress.
Game Modes¶
Practice Mode (Casual Duel)¶
A player receives 10 questions from a random mix of categories.
Unranked (Best of Five Battle)¶
Five rounds are played. Each round contains three questions from one chosen category. The loser of the previous round chooses the next category from three proposed options. This mode is also available to guest players.
Ranked (Best of Five Battle)¶
Five rounds are played. Each round contains three questions from one chosen category. The loser of the previous round chooses the next category from three proposed options. Elo adjustments are applied after the match ends.
Website Pages¶
Public¶
Leaderboard
Practice mode
Unranked mode
Session settings
Login Only¶
Ranked mode
User settings
User profile
Session Flow¶
Database¶
user¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
NOT NULL |
|
|
NOT NULL |
|
|
DEFAULT now() |
session¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
NOT NULL |
|
|
NOT NULL |
|
|
|
|
|
|
|
|
match_participant¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
FK -> |
|
|
FK -> |
|
|
DEFAULT 0 |
|
|
DEFAULT 0 |
|
|
DEFAULT false |
session_question¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
FK -> |
|
|
FK -> |
|
|
NOT NULL |
|
|
NOT NULL |
question_cache¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
UNIQUE |
|
|
NOT NULL |
|
|
NOT NULL |
|
|
NOT NULL |
|
|
NOT NULL |
|
|
|
|
|
DEFAULT now() |
leaderboard_entry¶
Column |
Type |
Constraint |
|---|---|---|
|
|
PK |
|
|
FK -> |
|
|
DEFAULT 1000 |
|
|
DEFAULT 0 |
|
|
DEFAULT 0 |
|
|
DEFAULT 0 |
|
|
DEFAULT now() |
Technical Additions¶
Question Caching¶
Responses from the-trivia-api.com are stored in question_cache. Before each
API call, the backend checks whether enough unused questions already exist for
the requested category. This reduces latency and avoids rate limit pressure.
Matchmaking¶
For unranked mode, a simple FIFO queue is sufficient. Ranked mode should use Elo-based matchmaking where players are matched within a tolerance window of about +/-150 Elo, expanding after longer wait times.
Real-Time Communication¶
Unranked and ranked sessions should use WebSocket-based communication so both players can see progress and answers in sync.
Authentication¶
JWT tokens manage sessions, and passwords are hashed using bcrypt.