MakeCode Arcade Online Multiplayer

Following up on my son’s wishes to show, test and play eachother’s multiplayer MakeCode Arcade games with friends and family that are not in the same room, I have tried without major success to find some good solutions for connecting two(or more) people to play games in the web simulator over the internet.

I therefore start this topic in the hope of gathering in one place the knowledge that already exists and in time will be discovered in the community about online multiplayer MakeCode Arcade.*

(*For the sake of my son’s and everybody else’s online safety, and true to the spirit of this forum, I am not seeking any solutions here with totally open and uncontrolled public servers or online play, but rather secure peer-to-peer connections with a known counterpart, or some safe and controlled online community like this forum(like maybe some kind of integration with the XBox network etc.).)

What I have found and tested so far:

  1. As mentioned briefly in an official MakeCode Arcade Advanced YouTube video, there was a Hackaton in 2020 that came up with a solution that is still online:
    https://microsoft.github.io/arcade-mp/

    It works fairly well, with some lag on the client game side, not sure if it sends screenshots from the server to the client, or if it just sends and keeps track of button presses between two separate game instance. I have so far only tested over LAN between to separate computers with different browsers(Mac and a Chromebook), and i am not yet sure if and how well it performs over the internet, whether it tries to establish a direct connection or relays through a Microsoft server somewhere etc.(though the lag on a fast LAN might indicate the latter). In the video @jwunderl** mentions that it might not work on newer games anymore. Since I don’t know about that many multiplayer games, I have only tested with the Taekwondo Fireball Magic Fight, an older two-player game, which worked ok.

  2. Parsec is a low latency solution for streaming games and multimedia over the internet. As a server, you can stream the whole desktop(including the MakeCode Arcade web simulator game, and it allows for connections to multiple clients, whose gamepad and keyboard button presses are sent from clients to the server. There’s a secure 2-step verification login system to invite trusted peer clients to connect, and apart from setting up the connection via Parsec’s own server(normally no need for firewall settings or port forwards on the router), the connections are peer-to-peer the MakeCode game server and client. It is possible to share only a browser tab instead of the whole desktop, and they also have an Arcade solution and community, but this is in beta and I haven’t tested it much myself.

  3. Moonlight game streaming works somewhat similar to Parsec, but requires a Nvidia graphics cards and GeForce Experience(unless coupled with the Sunshine gamestreaming host) on the server computer, only 1 client can connect to the server at once(2-player only) and there’s no login system included. However, hassle-free connections without firewall modifications or port forwards, as well as secure connections with trusted peers can pretty easily be achieved by Moonlight game streaming through a ZeroTier VPN LAN-over-internet. On the pluss side, my experience is that the graphics are faster and better through Moonlight, and both Moonlight and ZeroTier are open source and transparent(both Parsec and Moonlight are cost free for private game streaming use AFAIK).

(**By the way, @jwunderl: Are there any query strings or “magic” flags for the https://microsoft.github.io/arcade-mp/ webpage/server, that allows for loading an iFrame with a chosen game directly via an URL, like you can do with the #pub: in the MakeCode Editor, instead of always starting with the “Secure the river game” at https://aka.ms/jowunder-multiplayer?id=32777-59846-95775-11055&nofooter=1?)

There are of course many other game streaming options like Steam Link, Rainway etc. which I have not tested, and I am wondering if the Libretro/RetroArch Netplay solution maybe could work for native executables, since I have some vague memories from some years ago, when testing an emulator(C64?) which was neither “serialized or deterministic”, that it had some backup-solution that streamed button presses and game frames that accomplished peer-to-peer Netplay connections(not on any servers, but that is also the whole premise of this post not to prefer, anyways…)

Hoping to read here about some other and better working or easier/better integrated solutions for online multiplayer MakeCode Arcade games!

2 Likes

That arcade-mp demo was just using peer.js and mirroring over the screen / sending button events to and from the one who started the game, which is… not ideal for many types of games as we saw. As you saw in pxt-common-packages we’re still investigating some ways in which it could be implemented in a nicer way.

The reason it was stuck on an old version was because I had forked a lot of the code to get the multiplayer working in the few days I had for the hackathon, which is why I have it living at that aka link with an upload target. In fact, most of the code that was merged recently with e.g. the pxt-common-packages changes related to multiplayer was directly taken from the branches I made for that build and cleaned up a bit to get it into a state that it could be merged, so it’s likely we could get that cleaned up to just run off beta pretty quickly – I’m busy for the next week or so with ‘real work’ but I’ll try to find some time to get that hackathon site slightly updated so we can have something to play around with. (If you want to make any games in particular, I’d note that aka.ms link just goes to a custom build of arcade I made – so if you go to the link and run the ---run at the end it will bring you to the arcade homepage of that forked version. It looks like I had based it off arcade version 1.1.3 which is old but not unusable I guess (although there will be a few bugs you wouldn’t see in the real version, e.g. because of that hack I made for sending buttons it always has a second sim running :slight_smile: ))

There aren’t any query strings to set a default game but if I can get time to update the build of arcademp I can probably add that pretty easily :slight_smile:

(also, thanks for the research / write up on parsec / moonlight game streaming, it’s interesting to see what’s available as we look at other possible solutions.)

2 Likes

Can you send me the get hub link to the repo of the hackathon project in 2020

Thanks for your quick and informative answer!

I did not want to spoil your joy of presenting the great news of your recent online multiplayer efforts, so hesitated to mention it here until it was intuitively functioning and “official”. But now that the “cat is out of the box”, I hereby and relevant to this topic provide also a link to the recent multiplayer merge that you are here mentioning:

If I understand you correctly, the best of two world is maybe to have something similar to the hackathon site(or integrated into the beta simulator player) to play around and test the master/beta branch of the new official online multiplayer functionality and its development going forward?

Same here, that maybe query strings to load games directly in multiplayer mode or a multiplayer ready beta simulator player, could be an idea going forward?
(Just thinking about saving efforts and resources from having many different snapshot systems not following the main pipeline. But you know best yourselves how to rationalize; the community is probably just happy having it working somehow with their newest creations.)

Coming from an office Citrix/RDP background with choppy video and sound, I was just blown away by the technology and suddenly being able to stream an play games in 1080p(today 4K) near real-time(for me not a professional gamer and not as quick reactions as the youth, 10-20ms latency is real-time), immediate reactions to controller movements and streaming real graphic intensive games on the mobile on the go or at a mountain cabin, only needing one central powerful gaming rig server and weak and cheap RPis, Apple TVs and old laptops/Chromebooks elsewhere etc. -Even an old PS3 is casually playable going first into a capture card on the same gaming server, or streaming XBox One or GeForce Now to it, and then game streaming this further to the same devices and on the go(50-70ms)!.. -Almost as fun and impressive as MakeCode Arcade! :wink:

Anyways, and on that note, it might be worth mentioning:

  • The MS XBox/Cloud streaming protocol and MS Wireless display(as you probably know better than me) is quite capable as well and in-house(but less available for free use cases for the masses).
  • Parsec has an API and SDK which in the beginning was aimed at game streaming/online multiplayer for games, which probably was the reason why they were acquired by Unity. Though sadly not very permissively licensed.
  • The Moonlight/Sunshine are impressively industrious for being a side hustle started as a school project, and very helpful, forthcoming and responsive with a great user community.

Looking forward to seeing what more is coming in the near future! Keep up the great work!

Yeah, I meant since my forked code pretty much got merged in as is with only small tweaks there’s no reason for the hackathon site to be based off that super old version besides just that it takes a bit of time to update it.

Ah, I just meant adding to the arcademp github pages site something like an optional ?id={sharecode} that starts with that game instead of a the fishing like game, similar to if you had pressed the plus button :slight_smile:

@Lucas_M the repo itself is private for now as it was just a quick hackathon project

2 Likes

Both sound great, and looking forward to it!

1 Like

I’d love if we had a good way to do miti player

Is this:

  • somehow related to or already supporting online multiplayer(mp)?
  • and somewhere that could already alleviate your extra efforts to update the hackathon site?
  • or somewhere that would be an idea to include your online mp functionality of the hackathon site and recent mp commits?
  • and/(or just) a cross-platform (also offline) PWA with local mp and no possibility(or plans) for online/LAN mp?

“Scenario - classroom teacher wants to create an Arcade Kiosk populated with games from his/her students.”

Imagine how cool it would be with a cross-platform MakeCode Arcade app with multiple(any) games and that would also support local AND online multiplayer and with controller support!!! :wink:

1 Like

Ah, that’s unrelated to multiplayer experiences / that was made for making experiences like the kiosks we had at iste easier

in particular to play along with https://arcade.makecode.com/hardware/shoebox-controller and make it so eventually we could have it just like ‘follow these instructions to make a simple cabinet controller, then load this up in the browser to make a custom kiosk’. A little bit more to go to complete that goal though :slight_smile:

1 Like

Check out the multiplayer milestone to follow the amazing progress the great @MakeCode team is making for online multiplayer MakeCode Arcade!!!:

And will already the next mini game jam the first Monday in November be for multiplayer games?:

Christmas is coming early this year!!! :wink:

@jwunderl: …I’ll try to find some time to get that hackathon site slightly updated so we can have something to play around with.

Did you, by the way, @jwunderl, manage to find some time to update a site, maybe with a query string for a default game, like you mentioned earlier, where we already today could start making and testing multiplayer creations?

3 Likes

I didn’t find time to update that site, but that’s because I’m working on getting the new one running :slight_smile:. You actually have very good timing posting this as we just updated the production backend to make this testable the other day. I’ll list out a few caveats here to start with:

  • This is very much in flux, changes are occurring frequently and at any point it’s very possible that we’ll break something in the links I’m sharing further down in this post. Consider this an ‘early preview’.
  • Be careful when loading games – I’d personally suggest running this in a separate browser from normal (e.g. if you use chrome normally try edge, firefox), and if possible using a separate makecode account (e.g. if you use microsoft sign in normally try a google login) to make sure you do not harm your existing projects. The link is a beta link, so all the normal concerns there apply.
  • Please let us know if you run into issues! It’s possible we already know it’s an issue, or that we push a bad build and are already fixing it, but even then it’s super helpful to get feedback.
  • One more thing to not is that it’s no longer p2p like the hackathon version – it’s now host <-> server <-> guest, so inviting 3-4 players shouldn’t be harmful to the hosts perf from sending out extra messages as the server handles relaying the screen.

Anyways, with that out of the way, home page is https://arcade.makecode.com/beta--multiplayer, and https://arcade.makecode.com/beta--multiplayer?host=_VvPX5u9bx7fx will spin start up a session for you with a terrible ‘four players move with controller’ “game” I made in about 2 minutes.

In addition, in https://arcade.makecode.com/beta, at the end of the share dialog I added a ‘host multiplayer session button’ – you can see that it is currently very ugly (red icon on far right) so the color and icon will change soon (I picked a color at random with the thought that I needed something that would force us to actually pick a good one prior to release) but it works:

(one more thing to note, there is some lag when you join / host a session while the game is compiling where you can’t click buttons – should just be 2-3 seconds. I’m planning on moving compilation over to a webworker like in the main app so this doesn’t happen but I’m finishing up some other features first :slight_smile:)

7 Likes

Yes cool but it is very laggy

Hi Joey!
Any news about multiplayer is excited. :wink:
This multiplayer works only via internet?
Is there any solution for nearfield, side by side ? E.g. via wire/radio

This work is pretty computer / sim centric – it’s currently much closer to just making it so you can have a similar experience over the internet to what you would get by connecting four controllers locally, with no extra logic required in the code for syncing / etc. We plan to add more features in the future, but that’s pretty much the limit for our initial release.

In this case, it is done by broadcasting the screen image - which would almost certainly run into throughput issues when applied on physical devices. I’d have to describe this one as tangential to hardware multiplayer experiences for now.

@Lucas_M sorry to hear it’s laggy for you :frowning: we’re still working on it / still haven’t scaled out the backend completely so it’s possible it will ‘fix itself’, but I’m curious about how much lag you are seeing if you can share

5 Likes

This is COOL!!!
I like this extension a lot!
I actually have an idea for a game :eyes:

2 Likes

I have a couple of ideas for the future of online multiplayer in Arcade!

  1. I’d like to have a “persistent” session, where people can hop in and out using a code and for the room to not be deleted when the host leaves, but I get if not having dedicated servers would prevent this from being possible.
  2. I’d like to see something where there are multiple simulators - (a.) it could just be support for the radio extension that allows 2 simulators (but hopefully if this happens there will be support for 4 simulators in the radio extension - correct me if I’m wrong but I only saw the ability for 2 simulators in the radio extension. This way, people could scroll down to their simulator and play the game, but this would require extra code to sync the simulators’ games and performance may be slower. (b.) Another idea would be to sync it like the same game, and like the split-screen extension but with 160x120 for every screen and no visibility for other players’ screens. This would mean that the tilemap, sprite positions, and variables are the same for all games. This would require a new “back-end” reworking for some of MakeCode and would require coders to have some form of custom support for custom renderers besides tilemaps/basic sprites, but would be very easy for new coders making a multiplayer Jumpy Platformer. (c.) In my opinion, the best way to do it would be to have each game run separately but allow for “shared sprites/variables” that have the same value for all games in a session, and for it to be a (boolean) flag for every variables like “synced in multiplayer”. A system like could be difficult to achieve, but it may be worth it! This is an approach that is kind of a mix of the two previous approaches, but it would be an extremely flexible system, and easy for advanced game devs making custom renderers as well as just-starting-out game devs.
3 Likes

I made A Kiwi’s Space Adventure into split-screen multiplayer that supports online multiplayer!

I may host a game of this while on the Arcade livestream (via a code on the chat), so that’ll be fun!

2 Likes

A lot of the lag when away on my side but there is lag on player 2s side.

Check out the official announcement and stream about online multiplayer!:
[Announcement] Online multiplayer is now available in beta! https://www.twitch.tv/videos/1639847555

2 Likes

Yeah I’ve seen those