I am making a small game using node.js for the server and the .js file embedded in the HTML5 canvas for clients. Each player also has an object with which they can be moved using the arrow keys.
Now I made two different ways to update the game, each time sending a new player position every time he changed. It worked, but my server had to process about 60 x / y pairs per second (the update speed for the client was 30 / sec, and there were 2 players who moved non-stop). The second method was to send a new position and speed / direction of the playerβs object when they change the speed of their direction, so basically on other clients the playerβs movement was interpolated using the direction / speed from the last update. My server had to handle very few x / y7speed / direction packets, however, my clients experienced a slight lag when packets arrived since the interpolated position was often slightly different from the actual position recorded in the packet.
Now my questions are: which method would you recommend? And how do I make backlog compensation for any method?
Wingblade
source share