Running Panda3D faster then real time

Hi all,

I am new to Panda3D, does anyone know if Panda3D support running a game with 100x or 1000x original speed? I am cautious that the physics might get messed up when the game has sped up 100 times normal speed (that happened in Unity3D). Does anyone has similar experience?

Hi, welcome to the forum!

Yes, you can adjust the global clock in Panda3D to run at any desired rate, which will speed up and slow down all animations and other timing in the engine. See this for the possible clock modes:

You can set this programmatically (access base.clock to get at this object) or in Config.prc, using something like clock-mode non-real-time or what have you, with dt or frame rate configurable using clock-dt or clock-frame-rate. You can also use “slave” mode and manually set the frame time each frame.

For physics, if the timestep is too large, you will run into problems with things flying through walls. You can counteract this easily by running the physics simulate call (or collision traversal) in a loop based on the amount of time that has passed. Eg. you could say that you want the physics simulation to run at least 30 times per in-game second, and run the simulate call often enough until that condition is satisfied.

1 Like

Thank you for the reply. This is interesting, I assume your suggestion can easily be applied to collision type of physics but how about water physics? It seems to me that the water for example will need to support the object at every frame? Also, does Panda3D includes a simple physics package for water? Or is it something that I would need to build from scratch?

Note that rdb is suggesting not that physics be done on intermittent frames, but rather multiple times per frame. So if this were applied to a water simulation then it would indeed be applied to any relevant objects every frame, just more than once per frame.

Although I’m not aware of one (but I’ll let rdb answer that definitively), let me note that there might be a third option: if Panda doesn’t provide one, it might be worth searching around to see whether there isn’t a middleware package that offers a water simulation.

By the way, on a general note, I would like to add that the success of running a simulation at faster-than-realtime will of course depend not only on the features provided by the engine (whether Panda or otherwise), but also on the hardware on which the simulation is run, the implementation of the program, the complexity of the simulation, and so on.