Yeah, I already got a few testing functionality in my network layer, such as latency and packet loss. I am missing functions for duplication and out of order though. I´ll make sure to implement that.
While we are at it, how do you guys handle lost or out of order client input? I would say client input needs to be ordered, but that would also imply that you would have to wait for a resend of lost client packages, since it´s not ordered when you are missing one package.
Should I really wait for such packages, or should I just let the client input get lost? This would result in a correction of the movement on the client, since it predicted the movement wrong.
Current state of the game: Client-Side Prediction and Interpolation seems to work quite well in my current implementation, but I am not reacting to lost, duplicated and out of order packages yet. That´s my next step :-P
I'm toying with sending inputs in a sort of reliable fashion. It's a queue of inputs, and I keep sending them until they are acknowledged. I also have a bandwidth throttle to keep the bandwidth usage in check. If I run out of buffer space (because the server hasn't aknowledged the 3, 4 times the latency or so, or the past second, the buffer with a limited capacity becomes full and I cannot push any more inputs, ect...), then the client would pause, keep resending, until it gets acknowledgements from the server.
It's slightly OTT in a way. Some games (Quake3 for example), naively duplicates inputs (it's a console command you can tweak) so that in case of mild packet loss, you can still reconstruct the stream accurately, with minimum delays. Then if the stream is hopelessly broken (packet loss sometimes happen in bursts, so duplication from one packet to another isn't gonna help you), the server just ignores the client since the break, and correct him to his best ability. It depends how dependent you are on the reliability on your input stream (for example, fully deterministic games like Starcraft 3 which requires fully reliable input streams to work), how much more bandwidth naive duplication would consume, versus how much you have available.
Edited by papalazaru, 24 September 2012 - 06:54 AM.