A multi round trivia game built with Open Trivia API.
Here's the game flow:
-
Welcome to the Quiz Game:
- User provides their name.
- User selects the number of rounds to play.
- User specifies the number of questions per round.
- User selects the question difficulty (easy, medium, hard).
-
Category Selection:
- User is prompted to select a category for the current round from a list of available categories.
- Once a category is selected for a round, it is removed from the list of available categories for subsequent rounds.
-
Question Display:
- Questions corresponding to the selected category are displayed.
- Each question is presented with a countdown timer based on its difficulty level (90 seconds for easy, 60 seconds for medium, 30 seconds for hard).
- User can answer or skip any question except for the last one.
-
Automatic Skip:
- If the countdown timer elapses and the user hasn't provided an answer, the question is automatically skipped.
- If it's the last question of the round, the game proceeds to the next round or the score screen based on the remaining rounds.
-
Round Completion:
- If there are remaining rounds, the user is prompted to select a new category for the next round.
- Repeat the same process until all rounds are completed.
-
Finish Game:
- User clicks on the "Finish Game" button after completing all rounds.
- User is redirected to the score screen.
-
Score Screen:
- Display game completion time.
- Show the total score.
- Include a pie chart to visualize the distribution of correct, wrong, and skipped questions.
- Display a stacked bar chart to visualize correct and incorrect answers (wrong or skipped) for each round.
- Provide a line chart to show the time taken for the user to answer each question.
- Next.js - for bootstraping a react project
- Shadcn-ui - for components
- Tailwindcss - for styling
- Open Trivia Database - for trivia questions
- Tanstack Query (previously react-query) - for fetching data
- Clone the repo
git clone https://github.com/ahmedsomaa/open-trivia.git
- Install dependencies
cd open-trivia && pnpm install
- Start the dev server
pnpm dev