Attempt at multi-viewport local multiplayer game

After I came across Mask extension, I thought of a way I might be able to use it to do a multi-viewport game since it seems multiple view ports aren’t supported yet.

Here is a link to the game I was able to create. It’s a simple game where four players sail pirate ships and fire their cannons at each other until only one remains. Full code download available here:

I did this by making clone objects for every game object, one for each viewport, that are masked by the viewport so each player effectively gets their own camera. Two main problems I had were:

  1. Mask extension only works with sprites
  2. Creating all these extra clone objects and updating them to match the game objects every frame is bad for performance. On my PC its still playable though, but wouldn’t work with a much larger game.

I’m not sure how to improve it further from here; if anyone has any suggestions I’d love to know.

Has anyone tried any other solutions to make a multi-viewport local multiplayer game?

Not one I tried (yet), but thought about. It’s similar in that it would use masks.

But instead of multiple instances of each object, I’d have all the objects on the base layer, and a layer for each player, and the mask for that player on that their layer.

Then move the camera on a player’s layer so that it follows the player character on the base layer, and move the mask so that it stays in the same position relative to that layer’s camera.

Yeah, and is more prone to bugs. Also the masks can be processor hungry.