Jump to content

How to approach Phaser 3 multiplayer with Physics?


Recommended Posts

Hello :)

I need to make a Phaser multiplayer game (turn based) that will use physics. I can deal with the server, sockets and basic Phaser setup, but I am not sure how to approach the multiplayer physics part.

The game will go as follows:

  • Player 1 is on the left
  • Player 2 is on the right
  • P1 shoots a cannon towards P2’s castle
  • If the castle is 100% broken - P1 wins
  • If the castle is not 100% broken - it s P2’s turn
  • During the shootouts the castle is breaking with physics (different parts are broken, or moved by collisions). One needs to hit the princess at the center to win.

My initial idea was that I could run the physics locally and use sockets to send the parameters of how to shoot the cannon. P1 shoots, the socket sends {velocity:{12, -2}}, then on the other player I shoot the cannon with the same parameters. But basic testing showed that repeating the same action on different devices does not reproduce equal results. The difference is small but it will build up with repetitions.

Any ideas and advises are welcome.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...