1v1 real-time game - UDP - resending player's lost position packets

Hello. I’ve read http://gabrielgambetta.com/fpm2.html && http://gafferongames.com/networking-for-game-programmers/reliability-and-flow-control/

p-pos = player’s position
#edit - i’m using Kryonet if this helps

I know, that there is a lot of knowledge in above links, but I still don’t understand how this flow-control should work. My problem was that some of the p-pos packets were lost, that’s how my character was moving from x==0 to x==2 (by two steps per tick on the opponent’s phone). That’s ‘normal’ with UDP. Guys on stack.gamedev gave me these links, to make the ‘packetflow’ more ‘reliable’. So - my problem is here that I don’t understand how it should work. I know that I just need to put a ‘sequenceNumber’ into each packet and increment it. On the server I need to check which packet was delivered last and ‘compare’ them???

The second thing is that this is a solution for one move right? Let’s see:

  • User inputs ‘move right’ into the Client
  • Client sends the request to the server ‘can i move right’ and ‘moves by one without confirmation’ cause it’s smart
  • Server allows him to move
  • while checking he reads client’s sequenceNumber and compares it with the current sequenceNumber on the server. If received is bigger than current, we allow to move (or something like that)

The point is here. If we move on the phone by 30 steps (step by step, but fast, we run) we send 30 packets, and let’s say that 14th packet is lost. What happens? It was explained in a second link, that we should send a bytearray with ‘30 positions’ or something, which I don’t get too (or we should save 30 last positions).

If there is anyone that could explain, how this should work, I would be very grateful. I know that this is hard but I can’t use TCP for this kind of game. And I just want to learn it - I just need a point, how it should look like in 5-10 steps.

Thank you.