add custom config variables


i would like to give users the ability to change resolution or other custom stuff in my gamesmenu (then restart the game and have the userconfigs applied).
e.g. my menu should work like this:
*go to videomenu->resolution
*choose 1024x768
*please restart game
after restarting the game, the previously choosen resolution should be set.

also, i would like to specify custom variables in the config.prc, like “enableGlowEffect 1”. when starting the game, i would like to read the variables and save them.

is this possible, and if yes…how?

or do i need to write my own config?
well, no problem for “normal” variables, but the resolution must be set before importing directstart to be applied…

please help me,
greets, kampfgnu

You can write any variables you like to a mygame.prc file, which if you install it into the appropriate directory, will be loaded at application start. (All files named *.prc are loaded up together.) I recommend writing your dynamic variables to a separate prc file, rather than appending them to the existing Config.prc file, just because it makes it much easier to keep the dynamic settings separate from the static ones.

The “appropriate directory” is determined by the rules that built Panda. I’m not 100% sure what these rules are for the Panda that is prebuilt and distributed here. If nothing else, you can put it in the same directory with the existing Config.prc file, but it should also be possible to put it in the current directory when the application starts (presumably the directory that contains your application).

You can also make up new config variables that you can query at runtime easily. All of this is documented in the manual.