Multi-player and screen capture using a Chrome app

Coming soon…



LOL. Ok, I’m totally interested in a network game for Arduboy now that I know Chrome can do serial port communication. Could imagine a big game with a web UI that showed overall progress while each played was plugged into USB and had their own individual view of the world.


Cool to see you posting again @Dreamer3!

Indeed, I am still waiting for the first multiplayer game, but you could do much more advanced stuff (online multiplayer, streaming data, etc.) and it only takes a couple dozens lines of code to use Chrome’s Serial interface.

Oh boy, what’s the simplest version of that that could be fun?

Ok … on TEAM a.r.g. 's to do list: Pixel Fighter redacted multiplayer

Moderator Note:
Links to Team ARG’s website have been removed due to malicious new owners.

1 Like

I finally updated the Chrome app with the image streaming that you can see in the video above!

As always, you can stream text to other Arduboys with Serial.println() and receive with Serial.readStringUntil('\n').

But now, you can also send the content of your Arduboy screen to the computer by changing these lines in Arduboy.cpp to:

void Arduboy::display()
  Serial.write(sBuffer, 128 * 64 / 8);

Cool, I suppose this could be used to raw dump a screenshot or output the game to a video file on a PC?

Exactly. :wink:

You have an example in the video above.

1 Like

lol I completely missed that, sorry, browsing in work is a pain as it blocks loads of scripts/sites/etc!

Cool multiplayer for arduboy not sure if I have the concept but could you use this for teeny tank?

Yes, of course. You can just send values or keys back and forth between the two Arduboys. Have a look at this for an example:

I also began to make a Ukulele Champion game but never finished it.

cool good code but could you modify teeny tank and use this code

I won’t have the time, but maybe try to convince @Jezzamon? I can give my support for any technical question.

Seems like an interesting idea, although the original idea of TeenyTank was to make a game that was multiplayer with just one Arduboy. As it’s turn-based, the pass-and-play style makes more sense there, I think.

It’s probably not too hard to do, but I am also not very time-free at the moment. The code is available at Github, if you want to have a go at modifying it yourself:

I think what you’d want to do is to use the concept that @davidperrenoud posted above, and edit the updateAim() function so that it either takes input from the buttons or from the Serial port depending on which player is playing. Then you just need something to figure out which player is going to be first.

1 Like

After getting this to stream, can I make a request?
Is it possible to have some sort of frame reset option? every now and then, the display goes a bit wonky if there is any sort of interruption in the data.

1 Like

Multiplayer does not interest me. But the possibility of doing screen captures for the purpose of making YouTube videos that show off your Arduboy apps seems like the real potential of this process. Think you could steer development of this more in that direction?

@BenMcLean Screen capture is already implemented. You just need to follow the instruction here.

@spinal What kind of string/bytes could we use to reset the screen? We have to be careful because then this series of bytes cannot appear in a picture.

good question… maybe a delay then? perhaps make sure there is a gap between frames, not too big, but big enough to be detected?

When I use this application nothing shows up on the screen capture for some reason (It does show an error though: Receive error on serial connection: device_lost ). The Arduboy also seemed to be taking a huge performance hit while the app is open, reducing the frame rate from 30 to about 10 or so.

Here’s a generalized version of my code:

void setup()
	// setup arduboy, etc

void loop()
	// ...
	// ...
	Serial.write(arduboy.getBuffer(), 128 * 64 / 8);

I uploaded a program similar to this onto my Arduboy and, while it was still on, opened the app and got the results described above. Any reason why something like this is happening?

1 Like

The serial port stuff is very slow, esp at 9600.