Building for web

For publishing on itch.io, I’d like to be able to create a ‘runs in browser’ builds.

There is this forum post.

pygbag python module
No idea. Couldnt make sense of the instructions.

[Compiling Panda3D for WebGL](https://rdb.name/panda3d-webgl.md)
I get an error at the compiling the demos step.

from direct.dist import FreezeTool

ModuleNotFoundError: No module named ‘direct’

I kinda assume this means something is wrong with my pathing edits in the freezify.py file.

Some general notes about my proces:
I am currently still on windows. (the forced upgrade is coming, I will attempt to move to linux but havent moved yet)

I followed the steps.
Installed Git. (I almost never use git, I dont like it.)
Installed Emscripten SDK (they unhelpfully put the ‘oh, btw if you’re on windows, use these commands instead’ a couple lines lower under a new header)
Installed Python 3.12
used the python3.12 makepanda/makepanda.py command to compile Panda3D.
It spit out a bunch of warnings below the active line in PowerShell, which was a bit confusing, didnt know it was done till I scrolled up.

It was bumpy but I’m reasonably sure I got through these steps correctly.

I’d really like to be able to build for web with panda3d, so I can stick with it. Godot is easier to build for web with but I find the mix of editor and code to be needlessly fuzzy and it makes making changes and restructuring things way more complicated.

I have had success with this tutorial:

1 Like

That did work for me for the asteroids sample project that comes with panda3d. That is good. Thanks.

edit: do test if the webgame accepts inputs. I had a mysterious issue where my builds stopped accepting inputs. Havent figured out why yet, if it happens to you my best guess is maybe try rebooting? So far I’ve been unable to recreate whatever circumstances resulted in the build not accepting keyboard input in the browser.