Multi-player and screen capture using a Chrome app


Continuing from the discussion of using a USB host or peer-to-peer, I have written a Chrome app which allows you stream serial data from one Arduboy to an unlimited number of Arduboys and screen capture from the Arduboy to the computer.




Screen capture:

[CONTEST] Arduel
Multiplayer Game: TeenyTank
Multi-player linked Arduboys via a USB host (PC)
Screen Mirroring Guide / How To Screenshot Your Game
Arduboy Game Loader by TEAM a.r.g

Cool thing you made @davidperrenoud, you should make a very simple pong version as a first test !


If someone wants to have a look or make a pull request, here is the source:

Multi-player linked Arduboys via a USB host (PC)
(Andrew Beer) #4

Does the Arduboy need to request the data from the server, or do you just stream all data to all ports?


All data is streamed to all ports (except the port from which the data is coming).

I would advise to define the first Arduboy to start multiplayer as the “server”: it would manage the game logic, receive keypresses from the other Arduboys and send them data.


Coming soon…

Using a PC to increase animation frames available
(Josh Goebel) #7

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.

(Josh Goebel) #9

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 multiplayer


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

I need some help on the basics
(Ash) #12

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.

(Ash) #14

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

(Cody) #15

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.

(Cody) #17

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.

(Jezzamon) #19

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.

(spinal) #20

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.