I would love to have the ability to make API requests from PICO-8, and I think it would open up loads of opportunities for projects such as home automation controllers, carts that retrieve information from publicly available APIs such as weather information, etc.
The only example of networking functionality that I've seen in PICO-8 so far is using WebSockets in browser-based carts, and while HTTP requests would also technically be possible in web-based carts I would love to have this be a feature on local carts.
I can understand that some users may not want the carts they download to be able to make HTTP requests, so perhaps this could be an optional feature that you enable in the config or via a command-line argument.
Anyone else have thoughts on this?
gpio in html is the only solution so far.
it leverages browser ‘sandbox’ security, while admittedly reducing the ease of programming.
I certainly wouldn’t like any pico8 game to be able to fiddle with network or my hard drive (remember ActiveX, Flash...?).
Depends on the use case!
If it's a local cart mean to connect to a home server to display things or control for example a media player, then embed credentials and no worry.
If we take the example of using newgrounds API to integrate medals and leaderboard: the game API key will have to be in the game code, and anyone could take it and send fake scores, no different than current HTML games have to do.
For something more delicate, I suppose you'd have to ask the player to enter an API key, using real or emulated on-screen keyboard!
Very cool to see that I'm not the only one interested in this, even if it has been a year! Thanks for reviving the thread @crazyrems.
@merwok I think you're pretty much spot on regarding API credentials. For a private project that you never intend to publish you could hard-code creds. If it is something you plan on publishing, I think the two simplest options would be EITHER to require to user to load the cart and edit their API key into the code, or to build a simple on-screen method for the user to enter their own API key, as to support consoles such as the Gameshell that just run Splore and don't present an easy way to edit carts.
Of course I understand that this feature may not be for everyone as I mentioned in the original post - for those who do not like this feature, it could be disabled in config (this may even be the default state), or they may just choose not to use it themselves.
It's been a while since I played around with PICO-8, mostly due to time limitations, but I for one know I would have a lot of fun messing around with HTTP requests were it implemented down the line.
For something equivalent with the regular pico8 program, you could use stdin/stdout for communication, or the '-i file' / '-o file' parameters added in a recent version. See the section "Serial I/O" in https://www.lexaloffle.com/bbs/?tid=38665
scorchware: an HTML version of pico8 itself is a whole another thing than the topic of this thread :)
[Please log in to post a comment]