Timezone independent Date.now() for node.js game

I have a game I'm working on using node.js and socket.io. The issue I'm having is that I'm trying to have it so that players execute whatever actions they inputed about 50ms in the future, giving everyone a chance to stay relatively in sync. I've got frame-independent code running, which works well until a client has a different time than the server. To predict when the client should act out movement code from the server, I use: Date.now() >= command.timeStamp The issue I'm having is that sometimes the client isn't in the same timezone as the server. For instance, someone I'm testing with is just one minute above/below my server time, resulting in commands being 900 milliseconds in the past or future, which is non-ideal. Is there some way I can use a common timestamp across clients and server?
Take Your Experience to the Next Level
NewDownload our mobile app for a faster and better experience.
Comments
0U
Join the discussion
Sign in to leave a comment