Here's a fun little project. By "fun" I mean "nightmarish" and by "little" I mean "countless hours of headaches".
Let's network a Pico-8 cart.
This operation involves careful controlled management of the game state and manipulating the player controls with a wrapper. If we're using an HTML5 build, we can already manipulate the player inputs with JavaScript trivially enough -- there's an API explicitly for that one purpose. It also doesn't sound too hard to pause the game whenever controls haven't been received, although keeping a frame-perfect lockstep sync might be a hassle in itself.
But the BEST networking would involve allowing the local game to run a few frames ahead of the networked player and carefully revert and re-run those frames whenever changes in input are received, so that the game still runs full speed and remains synchronized with just a little bit of reality-bending when there's latency. This requires a deep, deep control over the entire game state, and the ability to run the game (without rendering) much faster than it's intended to go.
Fun.
Maybe I'll try it sometime. The license explicitly states I'm allowed to alter and use HTML5 cartridges for any purpose. If I can't hack around that, maybe I can make my own Pico-8 emulator that runs off of the .p8 text format files... although that seemingly falls into the legal grey area of the license a bit, since it would technically require fabricating a 16 color palette and sound waveforms similar enough that they could be considered a derivative work or some such, ... unless I read the same data out of a JavaScript file generated by the HTML5 exporter...? Gah.
That's enough rambling for now. This post is just a reminder for fun things to try whenever I'm bored next.
Netplay would be good for Pico as not everyone has someone to play with locally.
I am one of those people. I have a lot of friends, but not one person in my house besides me is a gamer enough to enjoy Wright Fight with.
One of my friends has just successfully made a lockstep-synchronized multiplayer Pico-8 system using Cheat Engine for Windows (and a matching, compatible scanmem-based system for Linux) to push srand, button presses, and frame step data into Pico-8's Base RAM in the user-defined section nobody uses, at a full 30 frames per second over the Internet, which the cart can then read to produce a fully synchronized online multiplayer game between two people. :3 I'm really proud of them.
It's a little messy at the moment (it doesn't lose connection cleanly and such), so I'll let them refine it better before we think about releasing it here or something...
This is full of potential. I suspect that there are still to few people who play pico-8 games for there to be someone else online to play with at any time. But still.
Right now I have a really simple modem style modulator/demodulator script that can do about 2-4 characters of text per second over the audio channel. It's a proof of concept, but I can fire arbitrary alpha text to the sound card and have a script parse it on the other side.
I need to clean it up and get it reusable/presentable but eventually it could theoretically be much faster (more like a real modem) and used for things like Muds, turn based tactical games, role playing, etc.
The big challenge I'm going to have is getting input back into pico8. I'm imagining using base 6 input on the second player controller and having the modem script inputting keystrokes as fast as the system can receive them. Where I'm really hitting walls though is the DSP stuff on the pico8 audio channel; it's hard for me to get a clean enough signal to decode it quickly and I'm not all that great at pico8 yet.
That said it'd never be useful for a lockstep style multiplayer game. Good for async stuff though.
Maybe we could reserve a portion of the screen to output data to transfert. It's easy enough to draw Pico8 in a web canvas and read back the value. In a turn by turn system, a "data" frame could be outputed when transmission is required and not even displayed to the player. Of course, on the other end we would need to encode it in player inputs.
yeah, someone mentioned that in the IRC channel last night; I think it's a much better idea than my sound one. I'm going to get the sound modem working at 16 bits a second and then i'm going to switch over to the visual data idea.
Very cool! I love that you can up that, I have been dieing for multiplayer Lexaloffle forever! Thanks -DatBuilder
wow @JTE are you ging to post that game somewhere?
I was planning on getting a raspbarry pi 3 and I would love to add that game to my collection. :)
The game featured in the gif is actually Naughty Painters by oinariman
I remember trying this and thinking how cool it was, and I remembered it recently because I made this neat PICO-8 game that doesn't have a singleplayer mode. I wanted to ask if this was a generic solution for networking a cart, or if it had specific code for that paint game. Could it be applied to other carts??
there is a generic solution for HTML exports: the gpio memory is shared with javascript, so you can communicate data then have custom js code to do anything you want.
one example: https://github.com/freds72/pico8-net
we will get online scores at some point, so that will be come a standard way (supported with native pico8 and bbs too) to do some online multi (not intense real-time but reasonable turn-based).
[Please log in to post a comment]