My Favorite Extensions: Multiplayer

Kiki Prottsman
Kiki’s Corner
Published in
4 min readFeb 6, 2023

Support for the creation of multiplayer games has been a longtime coming inside of Microsoft MakeCode Arcade. It has been possible for a while to create simple two-player games, but anything larger required a lot of extra work.

Recently, MakeCode Arcade released an update that not only makes it easier to create games for up to 4 players, but it allows you to play your games safely over the internet against friends.

Since safety is extremely important to Microsoft, we made the decision to prevent open chat, but we do allow for an exchange of emojis during play. You can read more about the experience here: https://arcade.makecode.com/multiplayer

Adding the Multiplayer Extension

With the new Multiplayer extension, it’s easier than ever to create your own 2, 3, or 4 player games.

The easiest way to get a feel for what’s new is to try one of our multiplayer tutorials, like Arrow Battle or Horse Race.

If you want to create your own game, visit arcade.makecode.com and click “New Project”.

Give your project a name and click “Create”, then you’ll be ready to add the extension.

Click the “Extensions” category in the toolbox, and you’ll open a library of options.

Enter “multiplayer” in the search and you’ll find what you need. You should also see the “arcade-carnival” extension. I like to add both.

Now that you have your extensions, you’re ready to build!

Create a Multiplayer Game

Even after adding your extensions, you can build your games the same way you always have, adding additional sets of actions for each player…but there’s also an easier way if you’re willing to explore.

Setting-Up Multiple Players

One of the most useful (and most advanced) actions you can take with the new multiplayer extension is to add players in a for loop so you can add one set of blocks to initialize everyone, instead of including a full set of blocks for each player.

This method does get a little complicated if you want to assign the player sprites inside the loop. For that, you’ll need an array.

You can get around using the array if you leave all of the sprites blank inside the for loop and set the images afterward…but once you get used to arrays, this structure works just fine.

Also, notice that there’s a lot of converting happening here. Throughout the game, we’re going to need a combination of sprites, players, indexes, and attributes to get everything working properly. Sometimes, that will require converting one to another with the help of the various multiplayer value parameters.

These are useful when converting to and from players

If you don’t want to use the loop, you can always set-up players as they join:

This has the added benefit of only creating as many players as will be joining the game.

Detecting Player Events

The new extension also allows you to write one set of code for when a button is pressed, and it lets you apply the appropriate action to the appropriate sprite.

You can even detect sprite overlaps and attach them back to the correct player.

By initializing players and detecting player events, you’re able to create a large number of games for 2–4 players…whether you know how many people will be joining, or not!

--

--

Kiki Prottsman
Kiki’s Corner

Kiki is an author, educator, and the Director of Education for Microsoft MakeCode