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

Re: [pygame] SOC Proposal: Networking for Pygame



wait() is useful if your game is minimised or paused.  So that it
doesn't use cpu when it's not supposed to be doing anything.

There's some non games on the project page using pygame.

My two non-game wait programs are: An upload program that prints the
url for copying when it uploads.  A musical pad program which uses ddr
mats to trigger samples.  Both of these I want to use as little cpu as
possible and wait is good for that.

Latency is the other main reason to do networking in another thread. If your game is going at 20fps-60fps or whatever, then it means you
are adding 1/20th-1/60th of a second latency to all networking every
frame.



On 5/9/06, Peter Shinners <pete@xxxxxxxxxxxx> wrote:
On Mon, 2006-05-08 at 01:59 -0700, Bob Ippolito wrote:
> select.select blocks exactly no longer than you ask it to.
> pygame.event.get blocks until it gets an event. For an application
> that mostly just waits for events (mouse, keyboard) via
> pygame.event.get is not going to interoperate well with network
> events if it only polls the network after some user input.

The whole point of select is that a single threaded application can do
nonblocking IO. There aren't any real games that use pygame.event.wait()
because it means you can't have any animation. So there shouldn't be any
sleeping or blocking the networking or input needs to interrupt each
other.

I would still prefer to see a single threaded solution. But as long at
it is transparent (like SDL_mixer) I don't have a problem with threads.