RE: [Twisted-Python] Unreliable UDP

Interesting! Appreciate any info on semi-reliable UDP Twisted-based projects? Sven-Erik Tiberg. -----Original Message----- From: twisted-python-bounces@twistedmatrix.com [mailto:twisted-python-bounces@twistedmatrix.com] On Behalf Of Jean-Paul Calderone Sent: den 19 oktober 2006 05:27 To: Twisted general discussion Subject: Re: [Twisted-Python] Unreliable UDP On Wed, 18 Oct 2006 21:47:51 -0500, Mike Wyatt <mwyatt@wi.rr.com> wrote:
First, just use TCP, unless you have already implemented the game using TCP, done performance testing and discovered problems tied to TCP which are resolved by UDP. Assuming you have done that, come up with a list of the kind of traffic your game needs to exchange between hosts. Based on that, you may be able to narrow your search (there are lots of kinds of "reliable" UDP) or you may find that existing solutions aren't suitable. Twisted itself doesn't offer any kind of reliability layering on top of UDP, but there are various Twisted-based projects which use UDP for semi-reliable messaging. Whether any of them might be of use to you depends on how closely your message model matches theirs. Most likely, you'll end up implementing something yourself, assuming you actually need a UDP-based solution at all. Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Yeah, I would like to check out some of these projects. As for using TCP, that is a valid option. It would be even nicer to just start using a reliable UDP layer right from the start, though. I'd rather not reinvent the wheel if I don't have to. By "reliable", I mean a library that guarantees delivery and keeps the packets in order. Similar to enet (http://enet.cubik.org/), but for Python. I may end up writing a Pyrex/Boost wrapper for enet or RakNet, but that would be a bit of a pain. That would probably convince me to play with TCP for a while, then replace the networking layer with reliable UDP when I have the time.

On 10/19/06, Mike Wyatt <mwyatt@wi.rr.com> wrote:
Really, truly, honestly, this doesn't make sense. You want *both* reliability *and* guaranteed delivery order: that is precisely what TCP does. Why do you want to use anything else? If you don't want to reinvent the wheel, use TCP. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

Check out Q3 and Q4 in the GameDev.net "Multiplayer & Network Programming" Forum FAQ: http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15 The problem with TCP is summed up nicely in Q4: /"...to make this guarantee, TCP must suspend all packet delivery to the receiving end, if one packet is lost, until that packet can be detected as lost and re-sent."/ You can also check out this classic multiplayer design article: http://www.gamasutra.com/features/19990903/lincroft_05.htm. The author is *very* against TCP. Apparently the X-Wing vs. TIE Fighter developers were seeing pings of up to 50 seconds using TCP. On the other hand, Q3 of GameDev's forum FAQ recommends TCP for real-time strategy games, or UDP in "extreme" cases. This makes me more comfortable with using TCP, at least for early development, since testing on my LAN shouldn't have any problems with dropped packets. The collective experience of the game development community seems to /lean /towards UDP for most game development. I'm not against using TCP, but if I can find a solution that makes UDP equally easy, I'd like to use that. <http://www.gamasutra.com/features/19990903/lincroft_05.htm>

I've been doing more research since my last message, and I found some pretty interesting results. Check out the posts from Simagery, hplus0603, and Ranger_One in this thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=370603&whichpage=1� <http://www.gamedev.net/community/forums/topic.asp?topic_id=370603&whichpage=1�> A good summary of that thread is this quote from Simagery: "...all of that above knowledge [UDP's superior flexibility] is based on the "state of the art" networking code circa 2000. Today, with wide availability of broadband, faster CPUs, higher quality NICs and better TCP/IP implementations, it all may be moot.". I think that may have convinced me to stick with TCP. Here's another great thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=262742. I didn't read the whole thing, but it includes more discussion of UDP vs. TCP. There is even someone who questions the accuracy of the X-Wing vs. TIE Fighter article.

On 10/19/06, Mike Wyatt <mwyatt@wi.rr.com> wrote:
I think the most important thing here isn't what the game industry says you should do, but what your own stated requirements were. You specifically said you wanted ordered, guaranteed-delivery data, and that's something that UDP doesn't give you and that TCP does. If you had some good reason to *avoid* either of those qualities, perhaps UDP would be appropriate, but since you need that reliability, and TCP does exactly that, it is the clear winner. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

* Christopher Armstrong <radix@twistedmatrix.com> [2006-10-19 23:17:20 -0400]:
I'd like to reiterate this; I'm familiar with a number of games using UDP for networking, and they specifically do *not* make use of ordered or guaranteed-delivery data, thus making UDP a reasonable choice. On the other hand, there are plenty of other games using TCP under different circumstances, so it very much depends on your specific use case. -- mithrandi, i Ainil en-Balandor, a faer Ambar

Yeah, I would like to check out some of these projects. As for using TCP, that is a valid option. It would be even nicer to just start using a reliable UDP layer right from the start, though. I'd rather not reinvent the wheel if I don't have to. By "reliable", I mean a library that guarantees delivery and keeps the packets in order. Similar to enet (http://enet.cubik.org/), but for Python. I may end up writing a Pyrex/Boost wrapper for enet or RakNet, but that would be a bit of a pain. That would probably convince me to play with TCP for a while, then replace the networking layer with reliable UDP when I have the time.

On 10/19/06, Mike Wyatt <mwyatt@wi.rr.com> wrote:
Really, truly, honestly, this doesn't make sense. You want *both* reliability *and* guaranteed delivery order: that is precisely what TCP does. Why do you want to use anything else? If you don't want to reinvent the wheel, use TCP. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

Check out Q3 and Q4 in the GameDev.net "Multiplayer & Network Programming" Forum FAQ: http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15 The problem with TCP is summed up nicely in Q4: /"...to make this guarantee, TCP must suspend all packet delivery to the receiving end, if one packet is lost, until that packet can be detected as lost and re-sent."/ You can also check out this classic multiplayer design article: http://www.gamasutra.com/features/19990903/lincroft_05.htm. The author is *very* against TCP. Apparently the X-Wing vs. TIE Fighter developers were seeing pings of up to 50 seconds using TCP. On the other hand, Q3 of GameDev's forum FAQ recommends TCP for real-time strategy games, or UDP in "extreme" cases. This makes me more comfortable with using TCP, at least for early development, since testing on my LAN shouldn't have any problems with dropped packets. The collective experience of the game development community seems to /lean /towards UDP for most game development. I'm not against using TCP, but if I can find a solution that makes UDP equally easy, I'd like to use that. <http://www.gamasutra.com/features/19990903/lincroft_05.htm>

I've been doing more research since my last message, and I found some pretty interesting results. Check out the posts from Simagery, hplus0603, and Ranger_One in this thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=370603&whichpage=1� <http://www.gamedev.net/community/forums/topic.asp?topic_id=370603&whichpage=1�> A good summary of that thread is this quote from Simagery: "...all of that above knowledge [UDP's superior flexibility] is based on the "state of the art" networking code circa 2000. Today, with wide availability of broadband, faster CPUs, higher quality NICs and better TCP/IP implementations, it all may be moot.". I think that may have convinced me to stick with TCP. Here's another great thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=262742. I didn't read the whole thing, but it includes more discussion of UDP vs. TCP. There is even someone who questions the accuracy of the X-Wing vs. TIE Fighter article.

On 10/19/06, Mike Wyatt <mwyatt@wi.rr.com> wrote:
I think the most important thing here isn't what the game industry says you should do, but what your own stated requirements were. You specifically said you wanted ordered, guaranteed-delivery data, and that's something that UDP doesn't give you and that TCP does. If you had some good reason to *avoid* either of those qualities, perhaps UDP would be appropriate, but since you need that reliability, and TCP does exactly that, it is the clear winner. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

* Christopher Armstrong <radix@twistedmatrix.com> [2006-10-19 23:17:20 -0400]:
I'd like to reiterate this; I'm familiar with a number of games using UDP for networking, and they specifically do *not* make use of ordered or guaranteed-delivery data, thus making UDP a reasonable choice. On the other hand, there are plenty of other games using TCP under different circumstances, so it very much depends on your specific use case. -- mithrandi, i Ainil en-Balandor, a faer Ambar
participants (4)
-
Christopher Armstrong
-
Mike Wyatt
-
Sven-Erik Tiberg
-
Tristan Seligmann