Exporting Pygame Games to Web

preview_player
Показать описание

Short Summary:
Skip to 00:24 , do `pip install pygbag` and then go to 00:39.
skip to 02:29 then just do `pygbag .` in project root folder and test that it works on localhost:8000
go to 03:42 and do `pygbag --archive .`
end result: 05:30

Links:

Assets Used:

Chapters:
00:00 Pygame game demo
00:24 Installing Pygbag
00:39 Changing the code
01:44 Warnings
02:27 Running Pygbag
03:32 Testing game on browser
05:42 End

This was an old video that I decided to redo since it had bad audio quality.
Рекомендации по теме
Комментарии
Автор

NOTES:

- Your main entry point for the game must be `main.py`.

- You cannot use .wav or any other sound format. You must use .ogg for pygbag to work

- If your game doesnt work first try, add #debug to the url and reload to see the current python output. It can help with debugging.

- Pygbag doesnt always have the latest version of a module, so you might not be able to use the latest features of a module


- If you're using numpy and other complex modules then you should put them at the very first lines of your main.py(numpy must be in the first line)

- In order to use the gpu in pygbag, you need to do `pygbag --template noctx.tmpl .` instead

- instead of pygame.display.flip() you can also use .update() too, nothing changes

- I forgot to mention this but you should set a limit to how high your dt can be because if the browser is minimized and then opened back again the delta time will be a really high value which CAN break your game.
use this to limit your delta time: `dt = min(dt, 1)` (in seconds)

- You can place an file named favicon.png to your game so that pygbag can replace the default tab icon(favicon) with your games icon

- Your game will be slower when its running on the web.

- You can delete your pygbag cache by deleting the build folder

notenlish
Автор

I am stuck on the “downloading” section, the game itself never loads for me

phosphorusXD