Log In  

I am working on a Pico game with some Backyard Baseball-esque mechanics. However, I would like to work in Twine for some more advanced dialogue options.

So the question: Is it possible for a Pico game to communicate with other embedded HTML games in the same webpage. Specifically, I am hoping to embed a Twine game, side by side with the Pico game and have the gameplay switch back and forth.

Would I be able to accomplish this via GPIO? I have found the documentation to be confusing and a little thin, focused mainly Raspberry Pi implementation. I think I would need to send a message to the embedding website (a page on my own website) and then send it to the other game? Is that even possible in HTML5.

Alternatively, I have considered the games to somehow "call" each other from inside their respective HTML/JS code, replacing the other game temporarily. Again, I am not quite familiar enough with HTML/JS/CSS to know where to begin here. Thanks in advance for any help

P#89396 2021-03-23 17:09

Yes, it’s possible! But this is as much a JavaScript project as a PICO-8 one.

The GPIO interface in PICO-8 is used for two different things: communicating with custom hardware on a raspberry pi or pocket chip, and communicating with JavaScript code in an HTML export. (These seem different but they’re both about sending or receiving some numbers, and they can’t be used at the same time, so PICO-8 uses one region of its memory for this.)

People have used the GPIO JavaScript interface to send high scores to leaderboard services or implement limited multi-player for example. Communicating with another game is certainly possible! From the PICO-8 cart side, you can read/write numbers from/to specific memory addresses using peek/poke. The meaning of the numbers is specific to your game. You’ll need to write JS code to communicate between the two games, and then something on the Twine game side to communicate with JS. Something will also be needed to swap focus between the two games.

People have published JS libraries on this BBS or sites like github to make it easier to write your code; you could look for that and see if it helps you!

Good luck

P#89398 2021-03-23 17:54

Thank you. This is very helpful. Excited to dive in, and will post code if I get it working.

P#89402 2021-03-23 18:53

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 04:25:50 | 0.006s | Q:11