[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pygame networking redux
On 6/5/07, 12 Dogs <nathan.lanyon@xxxxxxxxx> wrote:
Don't know if this will be helpful, but a while ago i started writing a
lemmings clone using twisted for networking. the file in question is
available here:
http://thescarydoor.googlecode.com/svn/trunk/default.py i
Ah I can see how you solved the problem:
def main(self):
self.checkEvents(pygame.event.get())
... snip lots of code ...
#come back here at a rate of approx 30fps
reactor.callLater(0.03, self.main)
Basically you asked twisted to call your function, and when your
function finishes, you ask twisted to call it again.
I'd prefer not to use twisted this way. It turns what should be a
simple, tight inner loop into a function call which has to work its
way through twisted's scheduling mechanics for every frame.
-Sw.