I'm creating a topdown RPG game for learning purpose using Netty. The server and client works so far that player can join a game and run around and see each other. But my problem is that it's not a smooth movement.
My game works like this: the client sends his input to the server once every ~9 ms(like my up key is pressed).
The server then has a main loop which runs about 20 times a second and checks if a player is moving set his coordinates appropriately and then send a snapshot of the game world(containing all actor coordinates and so on) to all the clients. When a client receives a snapshot it will copy that data to the clients (local) game world.
My question is about interpolation like when server receives a client input(like moving up) should it update that players coordinates to received coordinates + distance traveled during client delay/ping? And if so how do I detect a clients ping? I was thinking about including the client System.currentTimeMillis() in the packets and just compare that to Servers System.currentTimeMillis() but how will I know if the client system time is synchronized?
I hope I made my question clear if not just ask.