I have a working basic network communication via udp for my hack&slay RPG game. I implemented reliability using acks.
Messages will be resend, if the ack didn't arrive within 2*RTT. Everything seems to work pretty nicely, but there is still one problem to be solved: the case when reliable messages are received out-of-order, which will lead to inconsitencies among the players.
As far as I know there are two ways to solve this problem:
- let all players live x ms in the past and hope that all necessary packets arrive during that time, if not, resynchronize the player, or kick him from the server
- do a rollback and send anti-messages for any reliable messages that where sent (those might in return trigger more anti-messages and so on)
I don't like the second solution, because it is rather complicated to implement and anti-message introduce much extra traffic. So I would opt for the first method. Or are there other more suited techniques that I don't know about?