Author Topic: Using Send and SendQuickly together  (Read 2298 times)

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Using Send and SendQuickly together
« on: June 21, 2014, 05:53:06 PM »
This is more of a "Should I do this?" kind of question.

I have a scenario where I want to set a boolean as quickly as possible to everybody in the channel. Should I send the same message twice with both SendQuickly and Send back to back?

  1. tno.SendQuickly(2, ...)
  2. tno.Send(2, ...)

The idea is that the send quickly will try to get there as soon as possible, while the send makes sure it gets there if the UDP call gets dropped. If both calls are successfully received, it basically ignores the latest one.

It's hard to see if it does anything bad since I can only test instances on the same computer, but it seems to work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using Send and SendQuickly together
« Reply #1 on: June 21, 2014, 07:36:22 PM »
TCP will be used automatically if UDP isn't functional. The ideal usage for SendQuickly is for stuff like position updates that can be sent several times per second, and each new call overrides the state of the previous. I'm not sure what your usage is like, but I'd pick one and stick with it, not both.

fretnoize

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Using Send and SendQuickly together
« Reply #2 on: June 30, 2014, 10:36:48 PM »
Aren,
Has there been any consideration as to also making a reliable UDP RFC? I've come across some things suggesting that mixing TCP and UDP can cause UDP to become more unreliable. (one can be found here http://gafferongames.com/networking-for-game-programmers/udp-vs-tcp/) I'm, by far, no expert in this field so I don't know if this is a huge thing to implement, or if you feel it's really needed. I'd be interested in your thoughts on it, though.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using Send and SendQuickly together
« Reply #3 on: July 02, 2014, 06:15:28 AM »
Well, in short it would require me to completely re-do TNet. So nope, no plans at this time. TCP+UDP approach has been used successfully before, even on a larger scale. Dark Age of Camelot MMO used both, for example. Also note that Reliable UDP is nice, but it's also a lot more resource and GC-heavy. It's a great thing to implement in C++, less so in C#.

fretnoize

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Using Send and SendQuickly together
« Reply #4 on: July 02, 2014, 09:27:03 PM »
Cool, thanks for the explanation. I'm working on an FPS which is why I'm so concerned about precision and performance. Locally everything seems fine, which I expect, but I'm not sure how it will perform when we get around to testing it on the internet. For now I'll continue on, sounds like I might be okay.