I have a game I'm working on using node.js and socket.io. The issue I'm having, is 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-independant 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 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?