MonocleBios wrote:Since you're using UDP, how are you structuring your packet sending/receiving? ie. Do you validate the order of the packets? What kind of headers do the packets have? etc.
The packets have a byte that tells the receiver what the packet is for. This is followed by an int that is used to validate the order of the packets. Old packets are ignored.
Clients send the keys and mouse buttons being pressed with two bytes, and their rotation (pitch and yaw, roll is ignored).
Servers send the positions and other important stuff about the nearest NPCs, players and "unpicked" Items, and the Items in the player's inventory. The Event states will be worked on later.
MonocleBios wrote:EDIT: The keystroke thing, not the distance vector thing; though that's good too. You mention that the client has little authority over where it moves. Does this mean that the client waits for confirmation from the server? Or do you let the client run as usual and rubberband when it de-syncs? Or do you do something else entirely?
It will move if it a server's packet is lost or takes to long to arrive, but if the positions de-sync then the client goes to where the server says.