playMaker

Author Topic: Photon, Authoritative Server using Master Client Syncing Issues  (Read 2806 times)

Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Photon, Authoritative Server using Master Client Syncing Issues
« on: October 22, 2017, 10:29:41 AM »
Hi, I’m having a little trouble setting up an authoritative server using Photon/playmaker. Basically, I’ve followed the Playmaker Photon documentation, and it all works fine, but as my game’s heavily physics dependent (each player is a Rigidbody that need to interact with each other), I’ve opted for a server authoritative setup. I believe this should be possible by essentially swapping out the ‘getismine’ checks where I set/update the position/rotation in each player, and replace them with ‘is master client’ checks. So far so good...

But the issue I’m having is, only the master client’s player is shown to be updating/moving on all clients. From the master client’s perspective all works perfect (all client players moving fine etc.). But on each of the clients, their players are snapping to 0,0,0 as that’s the ‘position/rotation’ value they’re supposedly receiving from the master client for their players. But checking in the editor, the master client is definitely setting their position/rotation variables correctly, so the issue just seems to be that these variables aren't syncing correctly. I have the pos/rot variables in a separate Fsm and set to NetworkSync, with a PhotonView watching this Fsm, so I believe it’s all setup correctly and should be working. But obviously it isn’t... feels like there must be something really obvious I’m missing, but can’t figure out what it is. It’s just the fact that the master client’s player is shown working across all clients that’s really confusing me, as it means the syncing is definitely working to an extent... and if I swap my 'is master client' checks with 'is get mine' instead, then all clients are syncing their own players and all works absolutely fine (but obviously no good for my authoritative server setup!)

Anybody have any ideas where I might be going wrong? Thanks so much for any help!
« Last Edit: October 22, 2017, 07:16:06 PM by Kathar »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon, Authoritative Server using Master Client Syncing Issues
« Reply #1 on: October 23, 2017, 03:07:20 AM »
Hi,

 The masterClient can only control Scene Objects, if your Player instantiates the object, then it's that player that has authority and the masterClient won't be able to control it.

 So, you need your players to instantiate a networked object that ONLY synchronyze inputs, then your masterClient instantiate a scene object for each player, and use the value of the player's object as input to control the related scene object.

 Make sense?

 Also, Photon is NOT the best solution for authoritative physics, have you tried TrueSynch? it's another solution from Exitgames with a dedicated predictable physics engine working specifically for networked game, it's basic but you will achieve proper networked based physics interactions with this.

 else, you will need to go with a proper headless Unity running on a server and acting as a authoritative source, but that costs an eye to run... it can be done with Photon, or uNet, you'll have the choice of any solutions basically, but likely it will not be cost effective nor realistic if you don't have a proper budget and game revenues.

Bye,

 Jean

Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Re: Photon, Authoritative Server using Master Client Syncing Issues
« Reply #2 on: October 23, 2017, 05:55:24 AM »
Hi,

The masterClient can only control Scene Objects, if your Player instantiates the object, then it's that player that has authority and the masterClient won't be able to control it.

So, you need your players to instantiate a networked object that ONLY synchronyze inputs, then your masterClient instantiate a scene object for each player, and use the value of the player's object as input to control the related scene object.

 Make sense?

 Also, Photon is NOT the best solution for authoritative physics, have you tried TrueSynch? it's another solution from Exitgames with a dedicated predictable physics engine working specifically for networked game, it's basic but you will achieve proper networked based physics interactions with this.

 else, you will need to go with a proper headless Unity running on a server and acting as a authoritative source, but that costs an eye to run... it can be done with Photon, or uNet, you'll have the choice of any solutions basically, but likely it will not be cost effective nor realistic if you don't have a proper budget and game revenues.

Bye,

 Jean

Riiight! That makes a lot of sense, thanks so much for that, really cleared things up for me! Would have spent ages trying to figure that out.

I have briefly heard of TrueSync, I did wonder if that might be best for me, but is it currently supported by Playmaker? Playmaker has been a bit of a life-saver for me (thank you!), so would hate to not be able to use it!

My game is basically just a multiplayer classic minigolf game, but all players take their turns at the same time and can collide with each other, so with a few players potentially all colliding in a collision, just trying to weigh up the best way to achieve it.

Thanks a lot for your help!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon, Authoritative Server using Master Client Syncing Issues
« Reply #3 on: October 25, 2017, 04:31:55 AM »
Hi,

 TrueSynch doesn't work with PlayMaker and will never unfortunatly, as you need to use special variables, all made specifically for this networked physics engine...

Bye,

 Jean