Log In  

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.


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.

P#16150 2015-11-03 02:55 ( Edited 2015-11-03 07:55)


Netplay would be good for Pico as not everyone has someone to play with locally.

P#16159 2015-11-03 08:53 ( Edited 2015-11-03 13:53)

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.

P#16175 2015-11-03 13:04 ( Edited 2015-11-03 18:04)

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...

P#16701 2015-11-16 17:34 ( Edited 2015-11-16 23:23)

wow!!! post it whenever its ready

P#16768 2015-11-19 03:56 ( Edited 2015-11-19 08:56)

Me and gamax92
(I won, of course.)

P#16905 2015-11-22 23:44 ( Edited 2015-11-23 04:44)

oh wow, that is super cool.

P#16927 2015-11-23 13:25 ( Edited 2015-11-23 18:25)


P#16938 2015-11-23 19:00 ( Edited 2015-11-24 00:00)

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.

P#17055 2015-11-25 20:46 ( Edited 2015-11-26 01:46)

This looks awesome. Just awesome

P#17062 2015-11-26 05:20 ( Edited 2015-11-26 10:20)

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.

P#17374 2015-12-01 22:31 ( Edited 2015-12-02 03:31)

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.

P#17379 2015-12-02 05:59 ( Edited 2015-12-02 10:59)

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.

P#17381 2015-12-02 09:20 ( Edited 2015-12-02 14:20)

Very cool! I love that you can up that, I have been dieing for multiplayer Lexaloffle forever! Thanks -DatBuilder

P#17382 2015-12-02 10:55 ( Edited 2015-12-02 15:55)

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. :)

P#48990 2018-02-04 21:31 ( Edited 2018-02-05 02:31)

The game featured in the gif is actually Naughty Painters by oinariman

P#48995 2018-02-05 01:06 ( Edited 2018-02-05 06:06)

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??

P#113794 2022-06-29 05:28

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).

P#113801 2022-06-29 13:34

[Please log in to post a comment]