How do I fix the multiplayer sync from peer to host?

0 favourites
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • Pras

    Those two explains it quite easily to understand:

    youtu.be/rAKvWdPRzlA

    construct.net/en/tutorials/full-round-based-multiplayer-game-with-photon-1239

    The construct 2 tutorial also shows you some helpful screenshots on how it works.

    Basically photon works mostly with the "raise event" function between both players (there is no host and no peer)

    Example:

    - Player 1 Raise event (code: 1) with (data: "10"), target "others"

    ---> Event code is an identifier for each event, so that you can separate when you receive data from different events. You can use the numbers 1-200 and smth I think, but you don't need so many.

    "Data" is only optional, but it can be super helpful to reduce the amount of different event codes. I think all data is converted into string, but I am not sure. (so if you use a number variable, the receiver gets it as a string)

    "Target" are the people that receive the event. I am only using "others", since that will cause the least trouble in my opinion. If you set to "everyone", you will also receive your own event which you don't want in many cases.

    - Player 2 "On Event (Code=1)"

    Subtract (Photon.EventData) from health.

    (in this case 10, I am still not sure if you need to convert it to float/int first or not)

    What you did now, was sending the enemy the event number 1 (I would advice you to note your events somewhere on Google spreadsheets for example) which causes that the enemy looses health in this example.

    The event data was 10, so you told him to loose 10 health.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)