p3d and external files?

For the program I’m working on I need people to be able to access a txt file and modify it. If I’ll use the P3D system for distributing files, as far as I understand, such files will be included in the .P3D multifile and so not accessible the same way to users.
What can I do? Can you set some files to not be inlcuded in P3D? How would the path to the file be in code?

You can write files from your application. Any files you write will be normal files, not stored within the p3d, and which can be read again.

You might even be able to write a file with the same name as a file that you have already stored in the p3d, and the newly-written file will shadow the original p3d version. But I’m not 100% sure that will work. It’s probably better to write to a different filename. When you read the file, if you fail to open it, you can fall back to the original p3d filename instead.


I dont think I understand. I need to read, not write. Do you mean to read a file and write it to a folder, then read it again? That soudns pretty hacky.
But I dont think thats an option as the files are meant to be modified when the game is not running.

Oh, you mean a user-editable config file or some such. I thought you meant you were doing some in-game statistics that you wanted to record to a persistent file.

One problem with the p3d system is, if you embed the p3d file in a web page, then the web browser will impose stringent restrictions on the files it can access, as a security limitation. So you can only read and write to files in a special hidden directory that the user can’t easily find.

But if you are not planning on embedded the p3d in a web page, but rather asking the user to run it from his desktop, then it has access to the entire computer’s disk. So you can read any file you like.


Oh, very cool. I thought there was some kind of “virtual file system” to only access files inside p3d, as if its a folder, my bad.

There is, but it’s not exclusive. You can still access regular files too.

I just noticed that my buildbot 1.8.0 version doesnt have packp3d.exe or packp3d.p3d in the “bin” folder.

No, but you’ll find it in the 1.7.2 release.

Since the buildbot release is constantly changing, it doesn’t work well with the p3d system, which requires a server to host a fairly static version of the same contents.


Can you remind me about the link to cvs or soemthign which had the files? Do I really need to downgrade?

You can find the p3d tools here:

If you want to experiment with the latest unstable, you can use these:
It is highly inadvisable to redistribute p3d files made with packp3d, though, because they are designed to run on the daily build of the Panda runtime which may not be stable at any given point in time.

What choice do I have? (if I need the features from the buildbot version)

Is this that issue of redownloading the runtime each time or something?
Or do you mean just because buildbot versions are unstable?

Since the buildbot is unstable, it’s not guaranteed that a p3d file you give directly to someone today will still run tomorrow. Also, the release does get updated a lot, which means lots of redownloads.

To avoid these problems, your choices are:

(a) Wait until the features that you need are published before you release a p3d file to anyone. In the meantime you can build p3d files for your own purposes to test the whole process and make sure your p3d files will work eventually.

(b) Find a way to work without the features you think you need, and use the most-recently-published official version of Panda (in this case, 1.7.2).

© Build, publish, and host your own version of Panda that contains precisely the features you need. Not really recommended unless you know what you’re getting into.

(d) Use pdeploy with the -s option to generate a fully self-contained executable. This will package up whatever version of Panda you are currently using, and should be safe even with the buildbot version.


Option D works for me.

I downloaded packp3d.p3d and pdeploy.p3d, downloaded the 1.03 runtime, went to the “bin” folder ant typed


What I got:

Traceback (most recent call last):
  File "VFSImporter", line 153, in load_module
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 36, in <module>
  File "VFSImporter", line 153, in load_module
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\pandac\PandaM
odules.py", line 32, in <module>
  File "VFSImporter", line 153, in load_module
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\pandac\libp3v
isionModules.py", line 2, in <module>
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\pandac\extens
ion_native_helpers.py", line 79, in Dtool_PreloadDLL
ImportError: DLL load failed: The specified procedure could not be found.
Failure on startup.

“packp3d -h”

I was wondering if its possible to read from and write to the .p3d file at runtime. I can save models and maps externally, but I save references to servernames as text files. Also, I can’t seem to get it to load my models. Is there a specific path I need to reference to the .p3d file in order to get my model?

Well, then you could just say go read the manual, how about adding few more words? Like “you need to include egg loader explicitly”?

Sorry, I just assumed it was a syntax error from calling packp3d with the .p3d extension. Have you set all of your PATH and PYTHONPATH variables?

It is actually. But Im in panda’s “bin” folder when running it, do I need to set the PATHs then?

The problem is that you’re running it inside the “bin” directory. So it’s accidentally picking up the dlls from the SDK, which shouldn’t happen. Run it from somewhere else.

I thought it was meant to be placed there