Send regular keyboard samples OR keyboard state changes over network

Posted by Ciaran on Game Development See other posts from Game Development or by Ciaran
Published on 2012-04-05T12:36:18Z Indexed on 2012/04/05 17:47 UTC
Read the original article Hit count: 1321

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:

  1. 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.
  2. 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.

© Game Development or respective owner

Related posts about networking

Related posts about keyboard