---
title: "Discussion on \"An escape game on the TV, played with phones: keeping 5 screens in sync\" | Hashnode"
description: "Discussion on \"An escape game on the TV, played with phones: keeping 5 screens in sync\". How I keep a TV and up to five phones on the same game state: a server referee, public and private state, private realtime channels and video sync."
url: "https://hashnode.com/posts/an-escape-game-on-the-tv-played-with-phones-keeping-5-screens-in-sync/6af4ecbea256a75e226b0bb6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [An escape game on the TV, played with phones: keeping 5 screens in sync](https://remibouvant.hashnode.dev/an-escape-game-on-the-tv-played-with-phones-keeping-5-screens-in-sync?utm_source=hashnode&utm_medium=feed)

How I keep a TV and up to five phones on the same game state: a server referee, public and private state, private realtime channels and video sync.

Nov 11 · 6 min read · remibouvant.hashnode.dev  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#supabase](https://hashnode.com/tag/supabase)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#gamedev](https://hashnode.com/tag/gamedev)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[REMI BOUVANT](https://hashnode.com/@remibouvant)

@remibouvant

  
[View profile](https://hashnode.com/@remibouvant)

Solo developer from France. I build Escape &amp; Chill (escape-chill.com), an escape game you play at home on the TV, with everyone's phone as a controller. I write about what I learn along the way: Next.js, Supabase realtime, video sync and 3D in the browser.

## Responses 2

Markdown supported · ⌘↵ to post

[Mohan](https://hashnode.com/@resumeorbitz)

[6d ago](https://hashnode.com/posts/an-escape-game-on-the-tv-played-with-phones-keeping-5-screens-in-sync/6af4ecbea256a75e226b0bb6/comment/6af59400dede5433f1c90ab8)

"Describing a state rather than events" is the takeaway I'm bookmarking. The video sync with startedAt + offset + serverNow is so much cleaner than trying to sync play/pause messages between clients, and it gets reload recovery for free. Splitting public and private state on the server is a nice touch too: reading network traffic doesn't help a cheater. Curious: did you see any clock drift issues on phones, or does using serverNow in every message cover it?

[REMI BOUVANT](https://hashnode.com/@remibouvant)

[6d ago](https://hashnode.com/posts/an-escape-game-on-the-tv-played-with-phones-keeping-5-screens-in-sync/6af4ecbea256a75e226b0bb6/comment/6af59400dede5433f1c90ab8#reply-6af5965325e0a7d8036703c1)

Thanks Mohan, glad that part was useful.

For the videos, serverNow in every message has been enough. Each screen keeps the gap between its own clock and the server's, taken when a state arrives, so a phone whose clock is minutes off still lands on the right frame. The error left is the time the message took to travel, usually well under 100 ms, and you don't notice that on a video.

Where it did fall short is the flashlights: a phone moves the beam and the TV draws it, and there I wanted to measure delays of about 100 ms between two devices. The travel time isn't the same for the phone and the TV, so that gap was too rough. For that I added a small NTP-style sync: a few round trips to a /time route at page load, keep the fastest one, and take the server time minus the midpoint of the round trip.

Real drift during a game (a clock running fast or slow over an hour) I haven't seen matter, since the gap gets refreshed with every state.
