-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Introducing <script type="py-game"> #2265
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
Introducing <script type="py-game"> #2265
Conversation
87f2976
to
7c62a30
Compare
f0632d9
to
dd708b3
Compare
Question was asked in the newsletter about how to signal "pygame": Reasons:
|
I agree with @Neon22. As it stands, there's a pretty clear separation between the The newsletter expressed a concern that "this doesn’t make it obvious from the |
as internally mentioned,
When a new type is used, like it is for If py-game was out of a config flag, it would not be just an opt-in for scripts that used to work before that, so in that sense Yes, I fully agree I am not strongly convinced it was the best decision, but I am sure having py-game-ce just as package that automatically will break or change the way pyodide works and interferes with currently supported attributes ( I hope this helps clarifying why this was the decision at the time this MR landed but I am happy to hear solutions around these concerns. |
I admit I don't know much about the internals here. I guess the main thing I didn't understand about the newletter's description of the feature is: if it "uses PyScript’s built-in plugin system", then couldn't it be activated using the |
Ahh I see how the implications are going to be hard to clearly communicate. So a "script tag" is probably the only viable solution. Just as you have already identified. Perhaps the tagname could indicate a limitation in some way. |
the tag name could be explicitly The thing with We have historical guards around ensuring a unique pyodide instance can't be arbitrarily polluted with multiple tags on the same main page, but as As summary, now that you know all the reasons py-game was shaped this way, do you still think having it as part of just py would be more beneficial than problematic? |
worth mentioning in here too: having conflicting attributes on the same tag has no precedent in the Web history ... so "just add We never wanted to support multiple config on the same main thread so that, unless that changes, meaning we change entirely the bootstrap of PyScript on the main thread, I am not sure that's a good way forward ... a dedicated type for games fells way easier to reason about to me, happy to hear alternative suggestions though. |
I've already discussed this with @WebReflection and just want to capture my feelings on this.... I do think that using a specific Anyway, for now, I'm totally supportive of rolling this out as an experimental feature under an experimental type and defer these architectural decision later |
strongly agreed, too bad we don't support multiple configs or multiple pyodide bootstrap to date on the main thread (just workers) ... if this is the drop that makes us change such historical status-quo, I'd be all in to make it happen so that users can create as many pyodide or micropython dedicated environments also on the main thread and we just bootstrap those based on each dedicated config: multiple games, multiple envs, users in charge 👍 edit for context, polyscript (the one bootstrapping PyScript) already supports this via the |
175ccde
to
2530528
Compare
for more information, see https://pre-commit.ci
@ntoll this is how I would describe this MR once landed: PyGame -
|
Folks, thank you so much for your thoughtful and collaborative input on this. This is how open-source coding is supposed to work! 🎉 Approving this on the proviso that it's experimental. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👾
Description
This MR would like to land an experimental implementation of the py-game special type with the following features:
<script type="py-game">
with either content or ansrc
and an optionaltarget
to reach the desired canvas, where by default it expects to be a<canvas id="canvas">
as suggested by the SDL2 Emscripten implementationwindow.screen
required + cursor not working and so on and so forth ... no worker driven for now)<py-config>
and it doesn't have an<py-game-config>
custom config type ... by defaultpygame-ce
is used as package and extra packages can be added manually as explicit config ... this might change in the futureChanges
Checklist
make build
works locally.