When creating my fantasy sports spinoff, Fantasy Congress, I thought it was important to offer a live draft. I implemented this, but it needs to be...
For further actions, you may consider blocking this person and/or reporting abuse
Welcome to the distributed systems and time hell!
You may want to check how real-time multiplayer games solve these problems, there are more approaches. You already have a start (the server is the source of truth) now you just need to sync the clients.
One issue may be if you use JS timers/timeouts, if the tab doesn't have the focus the ticks will be in slow mode. You can use workers (I think) and read the local time to improve the accuracy.
One way would be a mix between server signals, server time and user local time.
If you know in advance at what time a specific players turn can begin (even 1 minute should work) you can send it beforehand, and his client can begin its phase based on its local timer.
Even if the connection is slow its PC time should work ok and the player should see that is his turn. If the command arrives at the server and is not its actual turn ofc the server will reject it.
Bottom line 1 minute could be a too small time window if the users/game is casual, or 1 second sync times too big.
Interesting idea using the PC time. I was thinking I need to adopt some multiplayer game techniques but I don't know the first thing about video game development. Will look into it.
I stumbled upon a video that treat all 3 subjects and I remembered this topic:
youtu.be/GX4595KeZyc
Maybe Firebase Realtime Database would be of use here. I haven't used it a ton, but in my experience the realtime updates are really quick. This thread says its updates are around 100ms latency, which should be more than enough to broadcast time changes every second.
Omg if that is true this would be perfect. Will look into it ๐
Firebase will do the trick, just a reminder to calculate your payment prediction for a year or so, I heard some horror stories about it.