.txt and I’ve tried it with both -n and -e and I get the same problem. I’m trying to see if there is an easier way to do this with a multifile. Also, I may want to set up a “My Documents” sub-folder that keeps track of these and other documents that I can read from at runtime and load into the game.

On top of that, I’m doing peer 2 peer connections. Any suggestions on how to share image files across several connections?

You haven’t reported whether you can read the files that you extract from the p3d file with multify.

I’m not talking about creating a new multifile; I’m talking about using the command “multify -xvf my.p3d mypicklefile.txt” and then trying to unpickle the resulting mypicklefile.txt.

Presumably these are on remote hosts, and therefore don’t have access to the same hard disk, right? In that case you have to stream the images across the network. You can do that either with PNMImage or a Texture object; and pickle might be a fine way to convert the object to a stream in either case. If you use a Texture object you have to be sure it still contains the RAM image data.


Two things: I tried extracting the map from my p3d and unpickling it and it worked fine, so I’m not sure why its getting that error at runtime.

Secondly, I’ve tried mounting my own Multifile:

mf = Multifile()

vfs = VirtualFileSystem.getGlobalPtr()

if vfs.mount(mf, "/maps", VirtualFileSystem.MFReadOnly):
  print 'mounted'

But when I try this:

f = open('maps/'+mapname, r)

I get a File or Directory does not exist error.

You mounted it under ‘/maps/’, not ‘maps/’. Your open command needs to match the mount command, of course.

I haven’t been able to reproduce your pickle error with p3d. I’m able to unpickle files just fine inside a p3d. Can you make a simple example that shows your problem?


Not sure how quickly I can do that, but I can do the next best thing and show you where the difference is:

This is the print line that I get from printing the file instance in python using the SDK:

file: <open file 'maps/pond.txt', mode 'r' at 0x04C454F0>

This is the same print line in the p3d:

file:<direct.stdpy.file.file instance at 0x03DAD300>

I’ve tried ‘maps/’ ‘/maps’ ‘maps’ and ‘/maps/’ and still can’t get it to open.

Right, sorry, if you want to mount and open a file like that in a .py file (not in a p3d file), you also have to put:

from direct.stdpy.file import open

at the top of your file. This substitutes a custom version of the open() function that can look into Panda’s VFS. It’s not necessary to do this in a p3d file because it’s already done implicitly there.

However, in a p3d file, if you loaded the .mf file from your p3d file (as opposed to finding it as an actual file on disk) and then mounted it again, you’re double-mounting the mf file–it was already virtually mounted in the p3d file–which adds another layer of indirection, additional overhead, and might not even work (I’m not honestly sure). In this case having the .mf file isn’t really buying you anything; you’d be better off packing the contents of the .mf file into your p3d file, rather than the .mf file itself.


Except that I need to be able to add new files to the mf. I’m not sure if I can do that once its a p3d. What I REALLY should do is set up a remote directory on the owner’s system, keen to


Depending on the system of course. It would be something I’d want to add and remove in the install/uninstall process. The other reason I want to do this is so that they’ll have a directory in which they can load custom PNG files for their characters. I’ve asked my brother, who knows alot more about python than I do, but he wasn’t sure what the best way to go about doing that was.

Yes, a multifile is not really designed for live updates. You can do it, but it’s not very efficient. This is what a directory structure is for, and you should use an actual directory to do this sort of thing.

A p3d file doesn’t really have an install process; the whole point of a p3d file is that it’s self-contained and just runs, with nothing to install. It’s designed more around the web-plugin model than the downloadable-program model, so it will help to think of it more as the former rather than the latter. You can certainly create any directories you need the first time you run, of course.

An easy way to get a suitable directory name in Panda is to use one of Filename.getHomeDirectory() or Filename.getUserAppdataDirectory() as the root. I recommend the user appdata directory; that’s the place the operating system designates for this sort of purpose.

Note that the “home” directory won’t be available to you if you actually do run your p3d file as a web plugin, and the user appdata directory will be a special hidden directory instead of its normal location (this is enforced by the browser).


I’m likely going to distribute as an installer using pdeploy. From that point on I’m going to update it using the packaging system.

How do I flag a first time setup? Is there an easy way to write to the Config.prc file?

Just look for your expected file. If it isn’t there, call it the first time setup, and create it.