Position Sync Problem(Solved)

Hello everyone I am developing a 2d soccer game for maximum 6 players.( for android and pc).
ı dont have any problem with syncronizing player controlled objects like "soccer players" but ı am having some syncronization issues with "ball" in the game. Everthing working almost perfect with my player objects (soccer players) but ı dont know how to implement a multi-player controlled object syncronization in my game.
Because of this problem ı am using photon transform view and photon rigidbody2d view for syncronizing my ball object. but they didnt solve my problem.

Now ı have 2 questions?
I am using free-trial pun (max 20 ccu) for development stage, is it possible that ı am having sync problem because of free-trial pun servers?

Second question, if there is no differences between free 20 ccu and paid service then how can ı solve this problem?


Thanks for your answers.

Comments

  • Hi @BoltGames,

    I am using free-trial pun (max 20 ccu) for development stage, is it possible that ı am having sync problem because of free-trial pun servers?


    I don't think so. The servers should be the same for free and paid usage (except Enterprise Cloud).

    Second question, if there is no differences between free 20 ccu and paid service then how can ı solve this problem?


    These are problems due to lag / delay. Do you transfer ownership of the ball, if a certain player hits it or is the ball permanently controlled by the MasterClient?

    One solution might be, to transfer the ownership of the ball to the player who hit the ball for the last time, so that this player can also apply the new force and direction to it which should make the entire simulation more stable. However I don't know, if this would be enough.

    The better solution will be, to apply some kind of lag compensation, so that the simulation is most likely the same on each client. To see how this works I would like to recommend you taking a look at the Asteroids demo from the new PUN 2 Beta package. Having the package imported in a fresh project, you can look for the Spaceship and the Asteroid scripts. Both have a custom OnPhotonSerializeView solution which applies lag compensation. The Spaceship script additionally uses the FixedUpdate function therefore. For first tests you can basically copy and paste the OnPhotonSerializeView function of the Asteroid script.

    Please let me know if you have further questions about this approach or to lag compensation in general.
  • BoltGamesBoltGames
    edited January 11
    @Christian_Simon I am very thankful for your fast answer :)

    I already tried to transfering ownership of ball object with "request ownership" method but it gave me an error and today ı tried to transfering ownership with "TransferOwnership" method after your answer and it mostly solved my problem :)
    i am using "PhotonTransformView2D" script and ı set "Lerp" equal 10.

    so my "ball object" almost moving perfect now.

    Also ı will take a look PUN 2 Beta example.

    Thank you for your help and have a good day. :blush:


    EDIT: I implemented my own synchronization script and it is working perfect now. :)
Sign In or Register to comment.