[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] Re: [OLPC-Games] PyQNet project on Launchpad



> -----Original Message-----
> From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]
> On Behalf Of Mike C. Fletcher
> Sent: Monday, July 28, 2008 3:44 PM
> To: pygame-users@xxxxxxxx; Games for the OLPC
> Subject: [pygame] Re: [OLPC-Games] PyQNet project on Launchpad
> 
> Noah Kantrowitz wrote:
> > Mike C. Fletcher wrote:
> >> Hi all,
> >>
> >> Those of you who were at PyCon in Chicago for the OLPC sprint may
> >> remember Phil Hassey's impromptu lecture on how to build a
> networking
> >> API [1].  I've been hacking together a preliminary implementation of
> >> something like that API and have just moved the project to
> >> Launchpad[2] so that other people can play with the code.  It's
> >> definitely not finished yet, so if you want to work on something
> >> low-level and network-y, feel free to play.
> >
> > A similarly designed (and much smaller) library is also up at
> >
> https://coderanger.net/svn/school/2007/fall/egd/magnoball/pygamenet.py
> > . Also a WiP.
> PyQNet is split over 8 modules, but the actual number of code-lines in
> the library (excluding the tests) is pretty small (640 incl. comments
> and docstrings), pygamenet is around 591 when you take out the
> comments.  Though PyQNet is likely to grow substantially once I get all
> the features I want implemented.
> 
> The difference in size currently is likely because PyQNet is
> implemented
> as UDP with ordering and retry controlled by the Python code instead of
> using TCP-level operations.  The UDP operations should allow us to code
> adaptations into the library to optimize for low-latency game-y
> operation.

This is a common misconception. The reason to use UDP is not for low-latency
(just set TCP_NODELAY), but to accommodate lossy links. Generally this means
dealing with either bad connections or high congestion. And when I say "deal
with" I mean "detect and die", not just reimplementing retransmission on top
of UDP. As it stands there is no real reason to use UDP for games anymore
unless you really think the vast majority of your users will be on bad
connections. I don't think this is the case, even for OLPC (sat links are
slow, but generally not lossy).

--Noah