Author Topic: rUDP and why - a quick discussion on avoiding TCP!  (Read 6864 times)

hippocoder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
rUDP and why - a quick discussion on avoiding TCP!
« on: August 27, 2013, 06:20:06 PM »
REF 1: http://gafferongames.com/networking-for-game-programmers/udp-vs-tcp/
REF 2: http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM

Brief:

Basically having TCP and UDP can induce more packet loss than normal with UDP, therefore I need to figure a robust and easy way to do reliable UDP and avoid TCP entirely in order to prevent the occasional TCP packet (these can be a couple of times a second, such as a grapple that MUST be applied or a gun that MUST fire). Rather than pressure Aren to do this (which I consider incredibly impolite - you buy a product with what it says on the tin, you don't pressure the author to change it) - I would like to spark some discussion in how we may do this ourselves for faster TNet games. Likely, many who adopt TNet will stumble across threads like these and wonder what options they might have.

In this case I am considering just having ping and pong. Basically UDP is sent, but buffered. If there is no reply by the time 1.5 x your ping time, then it's safe to probably send it again. What are your thoughts on this matter and do you have any advice? Is this the correct way I should go about it?

Thanks for reading!

hippocoder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: rUDP and why - a quick discussion on avoiding TCP!
« Reply #1 on: August 27, 2013, 07:22:20 PM »
Note: I haven't actually done any proper testing on this - I suspect it would only start to affect packets over a given size.

Masaaki

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: rUDP and why - a quick discussion on avoiding TCP!
« Reply #2 on: August 27, 2013, 08:55:18 PM »
So I guess something like this?

1 - Reliable messages are given a flag indicating they are reliable (used by the receiving end), in addition to some kind of incrementing message ID.
2 - A given message once sent will be resent periodically until acknowledgment is received.
3 - A given message, when received, will be buffered and only processed if the message just prior to it has been processed (so reliable messages 1, 2, and 3 are guaranteed to be processed in the exact order they were sent)
4 - A given message, when received, will be discarded if the message ID has already been processed.

That should pretty much cover everything, right? Should be easy enough to do with SendQuickly.

hippocoder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: rUDP and why - a quick discussion on avoiding TCP!
« Reply #3 on: August 28, 2013, 06:35:54 AM »
Yep sounds about right, thanks!