On Thu, Feb 14, 2008 at 10:32 AM, Thomas Boucher <thomas.boucher@student.ecp.fr> wrote:
I am currently part of a MMORPG project in python, using Twisted
and python-ogre.

Hey, me too!  I wonder if anyone else out there is doing this -- it seems like a natural combination of technologies.

- First run python-ogre in the main loop. At a time, this loop launches
the twisted reactor in another thread

Everyone I've spoken to has recommended not using threads with Twisted.
 
- So I tried not to run Twisted in another thread, by using the way
described here [2]. Twisted is given the main loop and the
rendering is done frame by frame with the coiterate. It works sometimes,
the renderOneFrame in the coiterration is not really working.

I hadn't seen that discussion thread before, and I'm not that familiar with coiteration.

What I'm currently doing is this:

def renderFrame():
    ogre.WindowEventUtilities.messagePump()
    root.renderOneFrame()

renderSystem._initRenderTargets()
root.clearEventTimes()
renderTask = task.LoopingCall(renderFrame)
renderTask.start(0.01, False)
reactor.run()

I do my keyboard and mouse capture in a frame listener which I register with Ogre.

It works, but I've only done a little bit of network activity (e.g. an IRC client).

If any Twisted experts would care to comment on the above code, I'd appreciate it.

I'm also wondering what would be the advantages of using a coiterator...?

--
Bernie Roehl
Mail: broehl@gmail.com