Building a real-time multiplayer game in the browser presents a unique set of challenges. Latency, state synchronization, and reliable messaging are critical to ensuring a fair and competitive experience.
For WordWave, we opted for a modern stack: Next.js for our frontend and Supabase for our backend and real-time database capabilities.
Supabase provides robust real-time subscriptions built on top of PostgreSQL. When a player creates a room, a new session is initialized in our database. Every action—joining a room, starting a round, or guessing a word—triggers an update that is instantly broadcasted to all connected clients in that room.
Handling latency is the tricky part. We had to ensure that the timer starts synchronously for everyone. We achieve this by relying on server-timestamps and standardizing the countdown logic on the client side based on a shared "round start" event.
In the future, we might explore moving to dedicated WebSockets or WebRTC for even lower latency, but for now, the current architecture comfortably handles our 60-second word-guessing sprints!