Open lordmauve opened 6 years ago
@amigrave had some success doing this with Pyodide at the Europython 2018 sprints.
Single HTML would do just by creating a convenient HTML template that validates through W3C validator. Re the JS, perhaps there is no need for that and the whole source might be just used as a Brython within <script>
tags. :)
I have added the Brython branch with some code to explore running games in the browser. Brython seems to have come a long way; this is very workable now.
I think the next steps is to add a CLI tool that will pack Brython, the game scripts (noting that more than one is allowed), and the HTML framework into one HTML file. It will be a large HTML file but distributing one file is so much easier than many, especially for beginners.
Much of the Brython standard library will be useless so perhaps we could trim this.
A suggestion at PyCon UK was to also provide a browser based IDE for adventurelib games.
In order to distribute adventurelib games, it would be convenient to be able to build them into a single HTML file that can be hosted on a static webserver or e-mailed to friends.
The idea would be to use one of the several browser-based Python implementations to run the code or transform it to Javascript. While the compatibility of these implementations may not be perfect, I would expect that many adventurelib games are simple enough to run without issue.
@flexo made a start on this at Pycon UK - work is at flexo/adventurelib@cd0d0db2f2d7a6118892fcf710623499badca025