Panda3D Game Loop

Can anyone point me towards documentation about how the Panda3D game loop works internally? I know about extending DirectObject and calling .run() which runs the taskMgr. However, I’d like to find out everything that happens in a given Panda3D loop.



I dunno for sure, perhaps this page is of help for you?


Hey, welcome to the forums! :slight_smile:

Basically, run() invokes, which polls the task manager in a continuous loop.

If you want to see what exactly happens inside it, you should look at which tasks are registered. I think you can do so by simply typing “print base.taskMgr”.

powerpup118 and rdb, thank you for your timely responses - they were both helpful.

I did go ahead and try printing out the TaskManager info and received the following details:

Task sort

resetPrevTransform -51
dataLoop -50
eventManager 0
ivalLoop 20
collisionLoop 30
igLoop 50
audioLoop 60

I really don’t know what tasks 1,2,4,6 and do. I would guess resetPrevTransform is simply acting on the graphics state to bring the rendering system back to the origin…but who knows. Maybe dataLoop repopulates the vertex/shader information? Just out of curiosity, anyone actually know those 4 tasks are responsible for?



You can look in direct/showbase/ and see for yourself how the tasks work and what they do.

For any future passerby of this thread who is also curious about these tasks, here are the descriptions of the tasks:

def __resetPrevTransform(self, state):
# Clear out the previous velocity deltas now, after we have
# rendered (the previous frame).  We do this after the render,
# so that we have a chance to draw a representation of spheres
# along with their velocities.  At the beginning of the frame
# really means after the command prompt, which allows the user
# to interactively query these deltas meaningfully.

def __dataLoop(self, state):
# traverse the data graph.  This reads all the control
# inputs (from the mouse and keyboard, for instance) and also
# directly acts upon them (for instance, to move the avatar).

def __ivalLoop(self, state):
# Execute all intervals in the global ivalMgr.

def __shadowCollisionLoop(self, state):
# run the collision traversal if we have a
# CollisionTraverser set.

def __collisionLoop(self, state):
# run the collision traversal if we have a
# CollisionTraverser set.

def __audioLoop(self, state):
    if (self.musicManager != None):
    for x in self.sfxManagerList:
    return Task.cont

def __igLoop(self, state):
# We render the watch variables for the onScreenDebug as soon
# as we reasonably can before the renderFrame().