Synchronize only on request

Options
roimatola
edited March 2013 in DotNet
Hi, i'm using the cloud photon sdk with a unity oroject (it just rocks, congratulations), and i was wondering if its possible to disable synching on all my views and just sync on request. I basically have a turn based game with lots of physics reacting that don´t need syncing as they already have similar enough reactions on all clients, i just needed to sync them up on the end of each round to keep the initial state consistent on all clients.

Thanks for the help.

Comments

  • Tobias
    Options
    Hmm, good question (and thanks for the congrats). I think you have 2 options:

    a) You could use RPCs to send your turn and the final state. Receiving clients simulate physics and in the end, correct any position that's wrong due to physics.
    This would be quite a re-write but it would implement the idea of making a turn and then send it. You could send individual steps in this turn, without problems to give waiting players some progress.

    b) You observe a script and make that implement OnPhotonSerializeView(). In that, you check if it's the end of the turn. If so, you send the final data/positions and set a flag "sent turn". You only send everything once but on next turn, you re-set the flag variable (to be able to send the next turn).
    This is a bit hack-ish. OnPhotonSerializeView is called often and not turn by turn by your logic. But it should work, too.