Server-Authoritative State
All scoring, timing, and round flow live on the server; clients only render and emit intent, preventing client-side tampering.
Real-Time Multiplayer Quiz Game
A real-time multiplayer trivia game where everyone who connects shares one live match. A Socket.io server holds the authoritative game state, broadcasting each question, running a synchronized 30-second timer, and scoring by difficulty plus a speed bonus, so the leaderboard updates instantly on every screen.
Hosted on a free tier, so the first load can take about 30 seconds while the server wakes. Open two tabs to play solo, or share the link to play live with friends.
Role
Full-Stack Developer
Year
2026
Collaborator
Matheus Camilo Ferraro
// Loadout
The server owns the clock and the scoreboard. Clients never decide outcomes; they render what arrives and emit a player's intent. That single rule is what keeps a room full of browsers perfectly in sync.
connect A player opens the page and joins the single shared game. There are no separate rooms, so everyone competes in the same match.
gameConfig The server sends the category list and the current settings for category, difficulty, and number of rounds.
joinGame The player submits a name. The server sanitizes it with xss and rejects duplicates. The first player to join auto-starts the match.
joinSuccess + playerList The server admits the player and broadcasts the updated roster to everyone connected.
newQuestion + timerUpdate The question is broadcast to every client at once, and the server ticks a 30-second countdown one second at a time.
submitAnswer The server scores the answer using a difficulty base of 10, 20, or 30 points plus a speed bonus of half the time remaining, then returns the result.
roundEnd When the timer reaches zero or every player has answered, the round closes and the correct answer is revealed.
nextRoundIn or gameOver A 5-second countdown leads into the next question. After the final round the game ends, shows the winner, and resets the scores.
Every transition is driven by the server, so all clients stay in lockstep.
Every answer re-broadcasts the roster to all players at once, so the standings shift in real time as the round plays out. The top three earn gold, silver, and bronze, and a check marks who has locked in their answer.
Illustrative view. The board re-ranks on every submitted answer.
Building a real-time multiplayer game that synchronizes question delivery, answer submission, scoring, and leaderboard updates across all connected players simultaneously, without any perceptible lag. The networking layer needed to handle player joins, disconnections, round transitions, and game-over states cleanly.
We used Socket.io for bidirectional WebSocket communication between the Express server and all connected browser clients. The server manages game state centrally: fetching trivia questions from the OpenTDB API, broadcasting questions to all players, collecting answers within a 30-second countdown timer, scoring by difficulty plus a speed bonus, and pushing live leaderboard updates. We sanitize player names server-side with the xss library and validate every action against the authoritative game state, and built a settings system allowing any player to configure category, difficulty, and round count before the match starts.
All scoring, timing, and round flow live on the server; clients only render and emit intent, preventing client-side tampering.
Socket.io bidirectional communication for instant question delivery, answer collection, and live score broadcasting.
Dynamic player ranking with gold/silver/bronze medal system, sorted scores, and visual answer-status indicators.
Players choose trivia category, difficulty level (Easy/Medium/Hard), and number of rounds before starting.
Countdown timer per question with automatic round progression when time expires or all players answer.
Server-side xss sanitization and duplicate-checking on player names, with every game action validated against authoritative server state.
Game-over screen with final scores, winner announcement, and automatic redirect to lobby for replay.