I'm creating a networked game and I have a huge problem understanding how to keep everything in sync. Right now I have a server and a client and the client can log in and move a character around using the keyboard arrows.
When a arrow key is hit I send data to the server, that then sends that data out to all the clients and then it moves the appropriate character in a specific direction.
However if I keep on hitting arrow keys eventually the result on two different clients will look different and they fall out of sync. So what is the best way to stop this from happening?
I've read that 1 method is to send data back and forth to figure out the latency between each client and then to include that into the movement, is that really the best method around at dealing with this? In which case would anyone be kind enough to explain in more detail how that works exactly?
Thanks