Multiplayer Tilescroller/client side/what sprite is controlled by the player

I want to make an online multiplayer game now that multiplayer has finished it’s beta phase (the extension appears in the non-beta editor) and I want to make a game with a tilemap. The problem is the camera. The camera can become a client side thing BTW.
What I want to know is how do I create a boolean or something that says whether the person playing is player x. I’ve tried non-multiplayer controls and other things. Please help me with this.

@jwunderl

Hey,

Could you clarify the intent on ‘whether the player is player x’? It sounds as if you are referring to having multiple cameras / views, which is not supported at the moment. To make this work properly without significantly harming performance, we need to make some changes in where the code is run that we were not able to make in time for this release – we still hope to release this in the future.

However, if what you meant was to detect whether a sprite is a given player, then you can check the sprite with something like this using the multiplayer extension:

assuming you previously had a call to set player 1 sprite to [a sprite of kind Player]

1 Like

Well, it could probably work despite not being supported, and the code would look something like this:
Do the player setup stuff
set tilemap to (tilemap)
If I am player (1)
Camera follow player (1)
Else if I am player (2)
Camera follow player (2)
Else if I am player (3)
Camera follow player (3)
Else if I am player (4)
Camera follow player (4)

Wait, nothing in makecode arcade multiplayer is client side. Everything is server side. Random numbers, random tiles, run time, string prompts, etc. It’s all server side, isn’t it?

Yeah! @jwunderl is there any way to do this?

At this time it is not possible. The feature is filed here https://github.com/microsoft/pxt-arcade/issues/5113, but requires https://github.com/microsoft/pxt-arcade/issues/5393 to be completed (which is moving the device that is ‘running’ the game from being player1 to being the backend server to reduce latency). As written, this would quadruple the uploaded data by the host of the game, and significantly inhibit performance (where if it is rendered server side, the total amount of outgoing data would actually remain the same, with less incoming data / host → server latency, so everything would be faster.)

1 Like

Oh… ok. Thanks :slight_smile: