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

Re: [pygame] SOC Proposal: Networking for Pygame



On 5/7/06, Rene Dudfield <renesd@xxxxxxxxx> wrote:
If the networking is threaded or async, then using the pygame event
queue is quite possible.  A blocking api is not useful for games.

I would agree that a design that spawns a thread/async handler that is
responsible for translating packets from the net layer into pygame
events is a good design...

...but what do you mean by "blocking api"? (I ask because I don't see
how that term would apply to anything mentioned earlier in this
thread)

The reason for using the SDL event queue is to keep event management
in one place.  If people already understand the pygame event model,
then they should be able to reuse that knowledge for the network
events.

One place doesn't mean the right place... I just don't see why I'd
ever want to have network packet handling code in my main message
pump. I don't do it with any windows api, don't do it with DirectX,
SDL_Net isn't structured that way, and I wouldn't want it that way
with pygame games I'm writing now. And if I was forced to do it that
way, I'd just end up having my event loop either buffer those events
or pass them on to some list of listeners anyways.

I do agree that reusing knowledge is good tho, which is exactly why I
think having a pump function required to get the events would be a
very bad design (because it would make something look like what you
are familiar with, but act very differently)