Web distribution limitations

Hi, I’m new to Panda and wanted to know something. How does c++ code work with Panda3D and web distribution? Is it possible to distribute Panda3D code programmed mainly in Python but with small C++ optimizations?

Thank you

Yes. You can compile your C++ code to dll’s and include them in the directory when you process it with packp3d, then import those dll’s from Python code, just as you would normally.

Of course, doing this will eliminate the platform-independent nature of Python code; and your p3d file will only run on the platform(s) for which it is compiled. You can reduce this problem by compiling for several different platforms and determining the correct dll/dylib/whatever to import at runtime. Or, if these are only optional performance optimizations, you can consider writing your Python code so that it will fall back to a (slower) Python implementation if it is unable to load the dll.

David

Thank you. Just what I need. I guess I can compile for windows and python and have a fallback alternative. I want to showcase a physical technique to render explosions but I’m afraid python code may not have the efficiency I need.

What security concerns are there from the user’s side? How does a user know a Panda3d application he is going to run in his browser isn’t running malicious code?

The security is described in the manual. You have to sign any p3d file you provide with a certificate; the first time the user visits a web page containing your p3d file, he or she must decide whether to approve your certificate.

If the user approves your certificate, any code that you signed with it is understood to be trusted. If the user declines your certificate, none of your code is run.

David

Thank you for taking time to answer. You gave me a quick overview in what I need so now I know Panda3D is what I need.