[Twisted-Python] Twisted and python-ogre

Thomas Boucher thomas.boucher at student.ecp.fr
Thu Feb 14 10:32:30 EST 2008


I am currently part of a MMORPG project in python, using Twisted
and python-ogre. I found some posts talking about the cohabitation 
between the two. However I couldn't find a definitive answer. What I am 
seeking for is more a general method than technical details.

What I would like to do is to put properly Twisted and python-ogre
together. To do that I have already tried the following ways :

  - First run python-ogre in the main loop. At a time, this loop launches
the twisted reactor in another thread with Thread(target =
The problem I am experiencing is described here [1]. The sendLine method
is executed immediately, but the data is received by the other side only
20/30 seconds after.

  - 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.

But it seems more logical to run ptyhon-ogre in the main loop and
twisted on the side (in another thread for example, as soon as the 
client has decided to connect to the server). Have you any ideas how I 
could do this properly (with threads, without threads, with the 
coiterrate ...)?

If Twisted was originally made for MMORPGs, why the reactor wants so 
much to be in the main loop and to manage itself the other threads (with 
callInThread for example)?


[1] http://archives.free.net.ph/message/20080102.113837.4c4513eb.en.html

Thomas Boucher

More information about the Twisted-Python mailing list