1

Building a real-time game, and I'm not sure of the better way to handle the in-game timer.

Should I have:

  1. Socket.io emit the current game time of the model every second.
  2. Socket.io emit a game.started() function that starts a client-side clock, which ticks down independently in the browser.

The first option seems much more costly but maybe not unrealistic, yet much more synched up. The second one can cause issues with in-game logic if the clocks every are not in-sync.

Is there an industry standard? Is socket.io emitting a message every second too performance intensive?

aks.
  • 386
  • 1
  • 12
  • 1
    I would recommend doing any logic that requires the clock to be accurate on the server. Then send those results to the client. Checking against a clock on every client is just asking for trouble. – rgvassar Mar 21 '16 at 20:43

0 Answers0