Is there any framework or method that will allow to use browser to run a 2D game made in python with pygame graphical library?
Is there a way to make a game that uses Python/pygame that will work through a web browser?
\$\begingroup\$ @DMGregory well, I just want to make a simple game that will not require to install anything on the gamers PC. I thought that was pretty obvious tbh, am I missing something here? \$\endgroup\$– GKozinskiMar 31, 2022 at 11:30
Since mid-2022, pygame has partial support for WebAssembly as upcoming python3.11 and allows for running the same pygame code on desktops and mobile/web.
You can publish your game on itch.io or github pages as some people have already done.
use pygbag from https://pypi.org/project/pygbag , some documentation is available from pygame-web.github.io
read documentation to adjust your main loop for async, and then use
python3 -m pygbag game_folder_with_all_extra_modules_and_assets/main.py
use replit https://replit.com/~. if you want to make your own website with your game iframe a replit in html
2\$\begingroup\$ This concept is not super intuitive, could you show an example on how you'd do this? \$\endgroup\$– Vaillancourt ♦Apr 29, 2022 at 18:52