In my web distributed .p3d I need to distribute over 2 gb of maps, in standard bam format.
These maps will be downloaded via HTTPClient and I already have all of this covered…
the problem is, I need to find a (system-independent) way to store my maps on the users computer, the maps should be held in a folder aka a folder I have named, and stored in there.
I need to make sure that this folder is never removed (except for by the user, of course) so tmp folders are no option.
I could hard code it to C:/program files/myapp/maps
but for linux I need to make sure the folder has write permissions, and I’ve never seen a mac’s folder layout so I would have no idea where to put them on macs, but my app should be capable of running on macs…
My question is:
Does the .p3d interface provide a way to store persistant files for a specific application in a system-independent way?
This is really what the package system is all about. If you put all of your maps into a “package”, using the ppackage command and the pdef file format to define it, you can then install the package at runtime with the DWBPackageInstaller class, or with “-r package” on your packp3d command line, all of which is described (at least a little bit) in the manual.
Installing the package places it in a system-independent directory on the user’s hard disk, and makes it available to your application.
This assumes, of course, that your application doesn’t need to modify the data at runtime. If it does, then this won’t work. To store local application-specific persistent data, the easiest approach is create a subdirectory of the current directory and write everything there. The current directory is the directory Panda3D/start.
Hi, I was looking at using the package system for this, however I have some special needs:
users will be able to upload a .bam to my web server, and at runtime (without restarting the game) it will download these maps as the client requires them… for instance:
Walking around in the field, you see a town, you walk into a teleporter and it goes through this sequence:
-> Do we have the map? No.
-> Download it from the webserver. (I have this code done)
-> save it in an area on the hard drive for future use
later on it will check the MD5 of the map, if it’s different that means the map was updated and to download the newest version, even if we already have a version of the map
So in theory I could do the following: