Config.prc - per game or global?

Is config.prc to be modified directly in my SDK install, or can I have a local config file - per each project?

It seems rather odd if it is to be modified globally…
Thanks!

Yes, you are intended to create a custom Config.prc for each project. You can set the environment variable $PANDA_PRC_DIR to the directory to search for your custom project.

David

For every project I create I must add it to the environmental variable?

would that be “PANDA_PRC_DIR” in PATH on windows? And what is the format I should put the path’s in? The standard windows path or panda-specific path?

It is an environment variable, e.g. as set with the “set” command in a bat file. You can set it to either a Windows-style path or a Panda-style path. You can also set it to “.” to indicate the current directory.

I agree it’s a little clumsy. We hope to have a better system in place soon.

David

You might want to consider changing the Prc settings within your script. For myself I found it easier to store settings in a YAML file and apply them when the game loads up:

import yaml
config = yaml.load(file('assets/data/config.yml'))

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'framebuffer-multisample 1')
loadPrcFileData('', 'multisamples %s' % config['video']['aa'])
loadPrcFileData('', 'fullscreen %s' % config['video']['fullscreen'])
loadPrcFileData('', 'win-size %s %s' % (config['video']['width'], config['video']['height']))

Note you need to install YAML module to do this, it doesn’t come with Panda.
Of course you don’t have to use YAML, you could use pickle or just write the values right in the script like the “framebuffer-multisample” entry.

Thanks!

Why mess with environment variables, change formats (not that I have anything against YAML; I quite like that format) or even iterate through a file and call loadPrcFileData() for each line? Isn’t loadPrcFile() just as fine?

from os.path import join

from panda3d.core import loadPrcFile

path_to_prc = join('path', 'to', 'file.prc')
loadPrcFile(path_to_prc)

That’s the approach detailed in the Manual (http://www.panda3d.org/manual/index.php/Accessing_Config_Vars_in_a_Program). You just have to make sure to load it before initialising your ShowBase instance.

Hm… true, somehow I missed that part…

 in the same way that an Egg or Bam file is searched for when you use loader.loadModel()