I had an idea recently. I think it would be a great idea for panda3d.org to provide a “Panda Runtime” distributable. I imagine something like a panda3d.exe, that will run the Python code and associated modules that are packaged up in whatever .mf file you give it.
Here’s the idea: Joe builds his really cool Panda app. He puts all of the stuff–python files, bam files, prc files, textures, whatever–into joesapp.mf, and emails it to his friend Fred. Fred, who doesn’t have the Panda development environment installed, installs panda3d.exe and then double-clicks on joesapp.mf, which is opened and executed by panda3d.exe. Boom, app-in-a-box.
Of course, Joe could have just used packpanda to build joesapp.exe. But there are a few advantages to having a separate downloadable runtime instead of bundling it all up together.
(1) Perhaps most importantly, we can pre-compile panda3d.exe using OPTIMIZE 4, which is Panda’s compilation mode for production environments of fully-tested code. We can’t provide the development version of Panda compiled in this mode, because a simple parameter mistake will make the whole thing crash. But we can provide the runtime-only version compiled this, which will make the whole thing run approximately 10% faster.
(2) It’s also automatically platform-independent. If Fred is running Mac but Joe only has Windows, it doesn’t matter–Fred will download the runtime appropriate to his computer, and Joe doesn’t need to do anything special to provide a Mac build.
(3) Joe’s distributable is relatively small, just his application data. If Fred downloads several different Panda applications from various friends, he only has to download the Panda runtime once.
(4) Fred can configure his Panda runtime the way he likes it. For instance, if he prefers to run in fullscreen 1024x768 mode, and he knows his DirectX driver is better than his OpenGL driver, he can set these things once, and they will apply to all of the .mf files he runs.
(5) It paves the way for an eventual Phase II, which is to make this Panda executable available as a browser plug-in! With a browser plug-in, Joe would only have to post joesapp.mf along with some suitable HTML wrapper code to embed his application in a browser window. When Fred visited Joe’s page, it could automatically fetch and install the Panda runtime, very much like Flash works today.
Of course, there are a few disadvantages too. I can think of:
(a) Panda hasn’t been very good historically at maintaining backward compatibility, so each application would be version-specific. We’d have to provide a panda3d.exe for each version of Panda that we release, or at least for the major version changes (e.g. panda3d-1.5.exe, panda3d-1.6.exe, and so on). Fred might need to have several different runtime versions all installed at once, in order to run his various friends’ mf files.
(b) It would be difficult to include additional third-party software in your mf file, like pygame or whatever. It would all have to be pure Python+Panda. I guess we might be able to work around this to a certain extent.
© We’d have to find a better solution for the sound library problem. FMod is non-commercial, OpenAL is full of problems. Bleah.
It would be really quite easy to do this, technically. We’d just need to write a tiny bit of glue code that would implement a Python importer over .mf files, mount the .mf file given on the command line, and start running it (for instance, by importing some standard file name, like “PandaMain.py”). Then we could use a tool like packpanda to build an executable of out of this glue code, and we’re done.
The real burden would be on the release maintenance. This would double the distribution burden, because now we’d have to have a Panda runtime as well as a Panda development release, for each version. Still, I think it might be worth it.
What do you think?
David