Here we go again, I’m implementing a little game with some characters walking around, here it is:
http://www.newdawnsoftware.com/miniad
The server may or may not be up. If its not hit the local server to try it.
Anyway, I’ve got the data I need to be sending back and forward happily sending/recieving and just had my first remote internet user log in. Surprise! Its all a bit jumpy.
I’m using TCP. I’ve turned Nagles off, or rather in Java land I’ve turned TcpNoDelay on. I’m using NIO for both the buffers and selecting. Its all done on non-blocking streams (apart from the ServerSocket). My client updates the server 5 times a second, and the server updates the appropriate clients 5 times a second. The players own character is maintained their end (and hence looks smooth). Character movement is interpolated on the client to smooth it out. However, the characters still jump around a fair bit.
Ideas so far:
a) Up the update rate (10 a second?). Bit spammy but maybe brute force is the answer.
b) Switch to UDP (yes I’ve read the killer thread at the top), doubt this will help a great deal but I’m willing to give it a go.
c) Some clever client manipulation of the data I don’t get yet.
d) Prevent quick changes of direction at the client.
Have you guys got any pearls of wisdom to divulge, or maybe just some experiences?
Kev