adventurelib icon indicating copy to clipboard operation
adventurelib copied to clipboard

Allow adventurelib games to be built to run in the browser

Open lordmauve opened this issue 7 years ago • 5 comments

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

lordmauve avatar Feb 04 '18 12:02 lordmauve

@amigrave had some success doing this with Pyodide at the Europython 2018 sprints.

lordmauve avatar Jul 30 '18 08:07 lordmauve

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. :)

KeyWeeUsr avatar Sep 15 '18 00:09 KeyWeeUsr

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.

lordmauve avatar Apr 17 '19 23:04 lordmauve

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.

lordmauve avatar Apr 18 '19 08:04 lordmauve

A suggestion at PyCon UK was to also provide a browser based IDE for adventurelib games.

lordmauve avatar Sep 16 '19 16:09 lordmauve