making .p3d files and practices.

Hey I am trying to get the p3d chain working for Second Anterean War.

I guess this should start with the “pdef” file, but there is just a little blurb about it?

class mypackage(package):
    file(Filename('neededfile.dll'))
    module('my.python.module')
    dir(Filename('/c/my/root_dir'))

Why another format (even if it is python with meta classes). Would not a sane interface to p3d.Packadge stuff be nicer then yet another format?

I guess we need to examine panda3d.cvs.sourceforge.net/view … nda3d.pdef to figure out what it does?

Will p3d package compile all py to pyo before including them? Does it do some import analysis or does it just grab all py files?

p3d system automatically converts all bam’s to egg. Normally what i do is ship egg’s and compile them to bam’s first time users runs the game. Then during update i always clear the tmp directory. Should I always ship bam files? What about shipping txo’s? Currently i shipped only png’s. And when users has super bad graphics card i can half all of the textures and create new txo’s and i guess new bams that include those half sized txo? Then whats the point of bams?

Reading and writing files. It looks like open() is not supported inside the p3d packed files, so i have to use vfs.readFile(), I think it would be useful to create open()-python-like file interface to vfs.

Temp files. My game creates some temp files as it runs. It also can download some files from the web like user profiles. Normally my temp files and my compiled bam files lived in this tmp folder. Should i still have a temp folder even if i will not ship bams? Where this tmp model cache should live in the p3d system?

Where should i put odd fiddly multifile switches such as wav’s should be compressed because then they cant stream etc… Don’t compress png and jpgs because its waste of time…

Can I substitute the default panda3d p3d loader with my game logo? Its not that i don’t want to advertise panda3d, but i also don’t want the main logo of my sci-fi game be a cartoon panda, when loading, updating etc… breaks immersion you know.

Because the pdef syntax is awesome and simple.

Yeah, I guess that’s helpful. You will probably want to put a require(‘panda3d’) line though. Really, the pdef syntax is not hard to figure out, just look at the existing pdefs.

It does import analysis and grab those .py files (and compiles them to .pyo).

Er, packp3d converts egg to bams, not the other way around.

Already exists:

from direct.stdpy.file import *

There are command-line switches to take care of that, run with -h to find out which. (I’m sure there is also pdef syntax for it.)

Sure thing. Just alter the *_img tokens:
panda3d.org/manual/index.php/Splash_image_tags

This also exists, if you prefer it. The equivalent calls to create your package are:

packager = Packager.Packager()
packager.installDir = '/c/my/install/dir'
packager.setup()
packager.beginPackage('mypackage')
packager.do_file(Filename('neededfile.dll'))
packager.do_module('my.python.module')
packager.do_dir(Filename('/c/my/root_dir'))
packager.endPackage()
packager.close()

But there’s a lot to be said for the convenience of having it all it a concise file format that can be invoked with a simple command-line tool, instead of having to write a new program for each package.

In fact this is supported, precisely via the stdpy module that rdb points out. The runtime system automatically replaces the global open() with the stdpy version, so you don’t even need to do anything special in your code to read your files (other than to find the files in the correct path, relative to base.appRunner.multifileRoot).

Sure, sounds like your temp directory is useful. You can create it relative to the start directory.

David

What do I do if I am not running it off a web browser?

I think you can pack your custom images in an “images” package. Take a look at the images package in coreapi.pdef.

You can specify any of the web tags, including splash_img and related tags, with the -t parameter to panda3d, e.g. “panda3d -t splash_img=http://my.server.com/myimage.jpg myfile.p3d”.

David

-t params look good. rdb does pdeploy support -t parameter?

Yes, it does. Just pass the -t parameter to pdeploy the same way that you would do for panda3d. See pdeploy -h for more info.

This will mean that it will contact the web server to grab the image the first time you run the game, though. Unless you use a local file:/// url.

Oh it can grab em off the web, even better.

Yeah. If you don’t supply -s to pdeploy, it will grab everything from the web.

Will it regrab the main .p3d file if it changes?

No, because the .p3d file is embedded into the binary.

Ok my .p3d file is just s shell:

class aff2aw(p3d):
    """ empty holder p3d that should download all other packadges """
    config(
        version="0.1",
        display_name = "AFF:Second Anterean War",
        platform_specific = False)
        
    require('code')
    require('data')
    mainModule('c')

So far I have seen it re download the new version when version string changes, i trust it would still work with pdeply - i have not tested it yet.

Ah, I see. In that case, if you don’t specify -s, the packages will be downloaded upon installation. I’m not 100% sure if they will be automatically updated when there is a new version though, probably not, because it requires root rights to modify installation dirs.

Does it put new packages into system folders not .panda3d/hosts ?

In the game directory. On windows that’s not a problem, as that directory is probably writable, but on Linux it will be /usr/share/yourgame/hosts/ so that won’t work correctly.

I still haven’t 100% decided on the correct behavior for locally hosted packages by pdeploy, though. I’m still in a bit of dilemma about this, and I’ll update pdeploy later when I have a permanent solution.

Then I would probably end up using just panda3d not deploy because I need the game to update itself fairy often.

You can use the “standalone” mode of pdeploy to generate a standalone self-updating binary for your game, you can pack that into a custom installer yourself.