Panda Without Render Window

I would like to run a server application that has all the non-render internals, such as the TaskMgr, but not have a render window. Does anyone know a good way to do this?

thanks

I once asked David Rose this same question. His reply: “You can always put ‘window-type none’ in your Config.prc to avoid opening a window when you import DirectStart.”

Also, note that it’s now possible to programmatically change the values of these config variables:

from pandac.PandaModules import *
ConfigVariableString(“window-type”,“none”).setValue(“none”)
import direct.directbase.DirectStart

That way, you don’t have to edit the global Config.prc or create a local one.

  • Josh
2 Likes

When debugging client/server applications, it’s a pain, because both try to use 100% CPU, and windows isn’t always smart about assigning priorities.

If you add this to your code:

base.setSleep(0.05)

then the main loop will sleep for 0.05 seconds every frame, which is enough to prevent it from using 100% CPU. Which in turn is enough to run a client and a server on the same machine.

  • Josh

Can I put the base.setSleep(0.05) anywhere (like a one-time initialization function), or must it be in the main loop?

That’s a one-time initialization function.

Neat! I had rob’s exact problem!(I’m trying to run a server on a Linux shell, not in X11, and it yells at me for not being able to open a window) But now, I can run my server perfectly! Thanks!

Another fine way to address this is to not import DirectStart at all. Just import the modules you need to use. For a small server program you generally don’t need most of the things that ShowBase provides. This saves memory and can give you more control over how the process is run as well.

Something border-line like that…
What if you include no display modules in your config file? Would it be possible with window-type none ?

I also want to know if it’s possible to compile Panda3D on a 'nix box without OpenGL and/or DirectX support.

Yes, with window-type none you do not need to include any display modules. You can easily run a headless server-only version of Panda.

David