[Twisted-Python] Two main loops, revisited

Bernie Roehl broehl at gmail.com
Tue Nov 27 22:56:26 EST 2007


Hi everyone

So, I've been trying the suggestion that was put forward when I asked my
earlier question about having two main loops in my game (one for the
rendering engine, one for Twisted).

Basically, what I'm doing is this:

def renderFrame():
    ogreLock.acquire()
    ogre.WindowEventUtilities.messagePump()
    root.renderOneFrame()
    ogreLock.release()

renderTask = task.LoopingCall(renderFrame)
renderTask.start(0.01, False)
reactor.run()

I'm using the Python implementation of the Project Darkstar client, which is
built around Twisted.

Unfortunately, I'm running into two problems.

The first is that I appear to be losing messages, which makes me wonder if
Twisted isn't getting enough cycles and is somehow missing incoming data.

The second is that my application hangs randomly.  When I call renderFrame()
in a simple loop (no Twisted), everything is rock-solid.

Has anyone done anything like this before (realitime 3D application with
Twisted), or am I breaking new ground here?

Any suggestions would be much appreciated...


-- 
  Bernie Roehl
  Mail: broehl at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20071127/055c77b2/attachment.htm 


More information about the Twisted-Python mailing list