Thanks to the research performed by MakeCode Scientist@WoofWoof, I’ve created an extension that lets you take advantage of the ability to have more than one screen on multiplayer. I present: riknoll/arcade-second-screen!
From the README:
A MakeCode Arcade extension that allows you to have two screens in online multiplayer games: one for player 1 and one for players 2-4. This extension is perfect for 1v1 games and asymmetric 1v2 or 1v3 games!
With this extension, you can:
Create sprites that only render on one screen or the other
Create two cameras that follow different sprites
Set different background images/colors for different screens
Note: There is no way to have more than 2 screens or to allocate the screens differently (e.g. players 1+2 on one screen and players 3+4 on the other). There will always be one screen for player 1 and one for all of the other players. This is due to how MakeCode Arcade’s online multiplayer is implemented and there is no way to workaround it.
And here’s an obligatory demo game:
And here’s another demo game that has a tilemap and separate cameras for the players:
Was I dozing off during the stream? I swear y’all didn’t finish this during the stream runtime.
Buy anyway… Quite the BIGGEST invention of MakeCode Arcade history.
Every screen update, the host sends a copy of the screen to all the other people. We just make it send a different screen instead and remove the loop that sends the normal screen.
This is super cool! I can imagine so many things that are possible that werent possible before. Only limitation is that its for two players only, not four, but still, this is extremly usefull. I have so many ideas on how this could be used.
Richard if you really don’t want to cast as any, you can do this:
function unregisterMultiplayerHandler() {
for (let handler of game.currentScene().eventContext['frameCallbacks']) {
if (handler.order == 210) {
game.currentScene().eventContext.unregisterFrameHandler(handler)
}
}
}