I've been studying on different methods to use for networking movements on multiplayer gaming. I'm currently going with Photon Server & Unity, which I know both very well now. However, my main problem is understanding how to sync these movements (inputs,positions) between the client/server.
I've read some of the articles on Quake 3 and others that are linked here, but it's just not the easiest thing to understand. I've been testing out many different solutions and end up beating my head against the wall because I can't seem to get things in sync.
My project is a 3D Virtual Chat. It won't have much action besides moving/traveling in the world and chatting. Other than that, nothing major.
Currently, from what I've read I've thought about doing this:
- Include a sequence # in each packet. On the server store the last sequence # received for the client. When client sends the next one, update that and forward it to an outgoing queue.
- Send the event out with a delay of 100-200ms from when it was received. It will be checked to make sure the move is "legal" then process it and send it in the next 100ms interval.
- When the client receives it, it checks to make sure that sequence # is the next one to be applied, if so, it'll apply it.
- The packets will include movement type (forward,back,left,right) and position & rotation.
But I'm a little skeptical on it just due to the fact it's not based on times and instead relies on things to hopefully come in properly (with an extra delay for safety) and if the client's character has moved forward a little too much because it was late receiving that packet, it will just shoot the player backwards a little due to the position/rotation it received.
Any advice or guidance on this would be majorly appreciated.