Config.prc

I’ve been making a light-weight, stand-alone installer for Panda games and I need to know three things regarding Config.prc:

  1. What lib/dll file reads and processes the Config.prc file?
  2. How does that lib/dll know where to find the Config.prc file?
  3. Can Panda programs run without a Config.prc file and just let the script set all the config variables at run-time?
  1. The code to do this is managed by dtool/src/prc, which gets compiled into libdtoolconfig.dll.

  2. There are lots of options. The exact set of rules for locating prc files is decided by the person who builds Panda; see panda/src/doc/howto.use_config.txt for more information. I believe the Windows installer version available for download from this web page bases this decision on the directory in which libdtool.dll was found; it may also search the directory named by $PRC_DIR, and/or the list of directories named by $PRC_PATH.

  3. Sure. Rather than setting them one at a time with setValue(), it is probably better to load a whole file explicitly like this:


loadPrcFile('mypage.prc')

Or even a “file” defined within the code like this:

myVariables = """
load-display pandagl
win-size 1024 768
"""
loadPrcFileData('internal', myVariables)

David

As David says, it’s up to the guy who compiled panda. If you’re using a prepackaged distribution, that’s me. The prepackaged distribution works like this: it starts in whatever directory contains “libdtool.dll” or “libdtool.so,” depending on whether you’re on windows or linux. It looks for an “etc” directory containing PRC files. If it doesn’t find one, it goes up a directory and tries again.

Let’s say, for sake of argument, that libdtool.dll is in:

c:\chicken\tastes\good\panda3d\lib\libdtool.dll

it looks in these directories, in order:

c:\chicken\tastes\good\panda3d\lib\etc\Config.prc
c:\chicken\tastes\good\panda3d\etc\Config.prc
c:\chicken\tastes\good\etc\Config.prc
c:\chicken\tastes\etc\Config.prc
c:\chicken\etc\Config.prc
c:\etc\Config.prc

Also, you see the “airblade” installation on our website? That was created using the same packaging system that we use for panda in general. Would that packaging tool be ok for your game? If so, learn how to use “makepanda.” Then, check out the command-line option “ppgame” (prepackaged game). You may need a hand using the command-line option, it’s not documented. But it may do just what you need.

It’s also possible to access config variables individually:

from pandac.PandaModules import *
ConfigVariableString(“load-display”,“pandadx8”).setValue(“pandadx8”)

just to pick a random example.