gabrielflorit / script-8.github.io

A JavaScript-based (React + Redux) fantasy computer for making, sharing, and playing tiny retro-looking games.
https://script-8.github.io/
MIT License
646 stars 35 forks source link

Add ability to export game as standalone html file #175

Closed gabrielflorit closed 5 years ago

Kethku commented 5 years ago

Can you talk a little bit about how you were thinking of doing this? I would really like to embed the game into my blog but I can't really as things currently are. Maybe I could help push this forward?

gabrielflorit commented 5 years ago

The absolute easiest way is to give readers an <iframe /> embed tag that points to the game part of script-8 (on github.io). And I think that's probably not a lot of work. But it does mean they are not hosting the game on their pages.

Some more thoughts, in no particular order:

If you're feeling adventurous, I'd start by experimenting with the <iframe /> route. Make it so the embed code has the game id, e.g. <iframe id=gameid />. Then, in Iframe.js, we'll have to find a way to make it fetch the id if it's an iframe attribute. After that you should be good to go.

Kethku commented 5 years ago

Good points. I am concerned about the fact that APIs are still in flux. What happens if a post is written that depends on old APIs and embeds the current version of the game. Embedded games will fail in weird ways. pico-8's strategy seems to be export an entire copy of the engine so that the embedded game doesn't depend on future changes. This strikes me as much harder though...

gabrielflorit commented 5 years ago

Good point. This requires some further thinking.

gabrielflorit commented 5 years ago

Done mostly by https://github.com/script-8/script-8.github.io/commit/ab2a65ec7aa8065e442637e93a5a19df063df1cb