Seperate Rendering Process

An attempt to seperate the logic from the rendering. It works fairly well, but calls between these two are slowish. This was a test of theory (and an intro into ipc/threads), it is very slow atm, but I hope to improve the speed eventually. (its not that panda renders slow–it seems about the same, and the logic is not slow (but they are seperate, so alot of logic=big speed up with multiple cores) it is talking between them that is slow)

There are two core files, SeperateRendering and pandaPart.
SeperateRendering has a class called SeperateRenderer which when called will start the panda process using pandaPart. All of the normal builtin stuff is still available to your script, like base, render, loader, and they seem to work fine.

This has only been tested on windows, but it seems windows is the most stringent/lacking of all the OSes when it comes to threads/processes so I have high hopes for the others!

There are three test files included.
testBasic which is just a rotating smiley-the bare minimum
testThreaded shows that you can use multiple threads on the logic end (although their effectiveness is questionable and they are not implemented in a “good” pythonic way.). On this one scroll around with the default camera driver (don’t have your hopes up too high).
testObject shows the exposed proxy class which is the main workhorse. In this version you can access anything through it that would normally be accessible by doing “from pandac.PandaModules import *”. The direct tree is simply a couple of include statements away.

mindstormss.googlepages.com/Sepe … rV1.tar.gz

TODO:
-allow dynamic import initiated in user’s script
-hide proxy object with fake “real” named classes at runtime
-allow batch instructions to be sent across–will fix the sequential reparenting/positioning especially seen in testObject and testThreaded
-maybe load all the methods when object is loaded instead of when method is called (there are pros and cons to this)
-get a threaded version of panda and pursue a more standard one socket per request (big speed up…hopefully)

Any pointers/bug fixes/suggestions are welcome!

(Use at your own risk :slight_smile:)

python + multithreaded = bad

I recommend removing the threads. Panda3d already separates the rendering in c++ and logic in python, i not see what is to be gained by separating them the way you have.