Send regular keyboard samples OR keyboard state changes over network
- by Ciaran
Building a multi player asteroids game where ships compete with each other. Using UDP.
Wanted to minimize traffic sent to server. Which would you do:
Send periodic keyboard state samples every from client every to match server physics update rate e.g. 50 times per second. Highly resilient to packet loss and other reliabilty problems. Out of date packets disacarded by server. Generates a lot of unnuecessary traffic.
Only send keyboard state when it changes (key up, key down). Radically less traffic sent from client to server. However, UDP can lose packets without you being informed. So the latter method could result in the vital packet never being resent unless I detect and resend this in a timely manner.