Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default settings producing apk #189

Open
mollyjames2 opened this issue Jan 4, 2025 · 4 comments
Open

default settings producing apk #189

mollyjames2 opened this issue Jan 4, 2025 · 4 comments
Labels
question Further information is requested

Comments

@mollyjames2
Copy link

I am trying to use pygbag to turn my py script into a web game that i can host on github pages. However, running

python -m pygbag --build main.py creates a apk file, when i am expecting wasm.js etc.

on an unrelated point, could you advise me on how to make sure my assets are included? They are in the same folder as main.py in a folder called 'assets'

many thanks in advance

@pmp-p
Copy link
Member

pmp-p commented Jan 6, 2025

wasm/js and cpython stdlib are located on pygbag cdn url ( github pages) .
The .apk follows android zip assets layout so all your assets are compressed and stored there.

for hosting on github pages you can use CI directly eg https://github.com/pmp-p/pygame-breakout-wasm/blob/main/.github/workflows/pygbag.yml

@mollyjames2
Copy link
Author

Hi, thank you for your quick reply.

Apologies I'm new to this! I'm not trying to create an apk - is this the default behaviour of pygbag? I'm also having issues with the cdn url. when running the index.html in debug i can see that it is linking to a non existant url:

<html lang="en-us"><script src="https://pygame-web.github.io/archives/0.8/pythons.js" type=module id="site" data-python="cpython3.11" data-os="vtx,fs,snd,gui" async defer>#<!--

`// this dict is available under PyConfig.config from main

config = {
xtermjs : "1" ,
_sdl2 : "canvas",
user_canvas : 0,
user_canvas_managed : 0,
ume_block : 1,
can_close : 0,
archive : "ourfirstdate",
gui_debug : 3,
cdn : "https://pygame-web.github.io/archives/0.8/",
autorun : 0,
PYBUILD : "3.11"
}

</script>
<title>ourfirstdate</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="height=device-height, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes"/>

<link rel="prefetch" href="https://pygame-web.github.io/archives/0.8/pythonrc.py">
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.8/vt/xterm.js">
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.8/vt/xterm-addon-image.js">
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.8/vt/xterm-addon-image.js">

`

would you be able to advise please?

thanks in advance

@pmp-p
Copy link
Member

pmp-p commented Jan 11, 2025

apk mode is the default because it is the proper way to ship assets from a desktop game.
everything around main.py will be packed except for some hidden files and unwanted raw formats.
when on GNU/Linux or wsl2 with pngquant+ffmpeg installed the assets will also be optimized for web release ( agressive images decimation/ audio compression )

script mode exists, but it not suitable except for snippets / procedural assets games.

your pygbag version is too old you should upgrade to 0.9.2 which use python 3.12 / 3.13

@pmp-p pmp-p added the question Further information is requested label Jan 11, 2025
@mollyjames2
Copy link
Author

mollyjames2 commented Jan 13, 2025

thank you. i've updated but these links still point to non-existant URLs
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/pythonrc.py"> <link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm.js"> <link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js"> <link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants