Panda as a Simulator


 I have created a small game prototype, which is supposed to be more like a simulator for my future AI implementations. For simulations, no graphics are needed, and speed is important... Is there a way to have the main loop execute faster without the rendering routines? Still, I need to maintain the spatial operations and such, since I have built things upon the scene graph and I will need the same program (or something slightly different) to be a game prototype, for the sake of presentation and further testing. I also have to scale this frequency without affecting collision in physics engine (which I expect to be ODE). So, is this some automatic result of not rendering things, or do I have to make some changes to the panda3d code?
Thank you for your attention and help

Edit: suggestions on how to verify it by test are also welcome =)

Not entirely sure what you’re asking. You want the physics and related operations to be performed more frequently than rendering a frame? How much more frequently? You could achieve this by writing your own replacement for the igloop task that only ran every once in a while, or that only calls base.graphicsEngine.renderFrame() only once in a while.

Panda’s task system is very simple: it executes a linear list of tasks, in a specified order. It executes each task exactly once. Then it goes back and executes them all again.

One of those tasks is igloop (ShowBase.__igLoop), which is the main rendering task. When this task runs, it draws a frame.

Thus, if you want to have some tasks run more often than other tasks (for instance, more often than the frame is drawn), you will need to find some way to suppress those tasks you don’t want to run every frame. There are lots of approaches.


Thanks, that’s what I wanted to know. I will elaborate a little on my ideas, though. I intend to have two NPCs fight each other, and then I’ll check the results, such as who lost, for instance. I actually don’t need to watch what is happening, so I can just eliminate frame rendering, which could make things go faster. I don’t have a particular desired speed for it, though; the faster the, better. But since the task execution is the way you’ve described, I think I can do what I had in mind. I will evaluate the performance just without reparenting things to render, and if possible or necessary I will tweak igloop and panda.

Thank you for the help; I will let you know its results when I have them.

For the purposes of a server that never intends to render anything, you don’t even need to open a window at all. One easy way to avoid opening a window is to put:

window-type none

in your Config.prc file. Then the igloop task will basically become a no-op.