Hello! I really enjoy working in pico-8, and I plan to use Raspberry Pi GPIO support to do some stuff with simple machines. I want to use an external process to handle stuff Pico-8 can't, like image recognition. My current plan is to rewrite a byte in the .p8 file and then reload that byte in the game periodically. Is there a better way to go about doing this? Thanks!
UPDATE: I had thought that Pico-8 might completely reserve access to the GPIO pins it's using, but this is not the case! After experimenting I've discovered that I can see changes made via another process within Pico-8. This way I can communicate with another process using the same pins.
I haven't tried this myself (really wish GPIO was available on the desktop version via sockets or something...), but you could check out the SPI or I2C protocols if you fancy getting your hands dirty.
They're fairly simple to emulate in software & although you sacrifice a couple of GPIO pins for them, one benefit is the transfer rate is controlled by a clock - i.e. toggling a pin on/off every _update() - so it's easy to synchronize with your external process & could help get you closer to maximum (reliable) transfer rates.
Theoretically at 60fps with one-way communication you could reach blistering speeds of 180-210 baud! (22.5 - 26.25 bytes/second)
Ah, that would be a good idea to minimize pins used, I'll need to test that. However, I've written a test cart that reloads a single byte from the disk and this seems to have the performance I need for my application. Also, my external process is also running on the pi, and I assume I'd run into issues trying to get access to the 8 GPIO pins pico-8 allows peek/poke operations on from a separate process.
[Please log in to post a comment]