pygame and socket.recv
Hendrik van Rooyen
mail at microcorp.co.za
Thu Apr 2 08:19:51 CEST 2009
"Aaron Brady" <casti.. at gmail.com> wrote:
> I tried writing a small game on a pygame layer. The graphics are
> fine, and at the moment, it is not graphics intensive. It is multi-
> player, and for the communication, I am sending a pickle string across
> a LAN, once per frame.
How big is this pickle - i.e. how many packets does it translate to
on the wire, given that an ethernet packet is less than 1500 bytes?
What is the maximum number of full size packets that a simple
echo server will echo per second on your setup? I predict that
you will find that this is far less than what a calculation based on
the bit rate will suggest...
> I'm observing some latency. It seems that socket.recv isn't
> performing consistently. The server is using time.clock and
> time.sleep to keep the frame rate at 40 frames per second. Latency
> occurred regardless of whether the connection was ethernet or
> wireless, although worse with wireless.
What does "some latency" mean? - barely visible jitter, or a half
What do you do when the total round trip time takes longer
than your target of one fortieth of a second?
The fact that wireless is worse (54Mb/s? - down from 100Mb/s)
makes me think you are running out of bandwidth, or that the
LAN is busy and that the bandwidth is wasted on collisions.
What happens when you drop the frame rate to 20 per second?
(it is parameterised, isn't it?)
> Does anyone have any hints or suggestions? I am on Windows XP.
What else is running on the machines at the same time? - your game
may be sucking at the hind tit of processor time...
More information about the Python-list