Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: MarkD on September 22, 2017, 12:00:20 AM

Title: Playmaker and Photon - Syncing a boolean
Post by: MarkD on September 22, 2017, 12:00:20 AM
Hey guys -

Learning Photon has really been a challenge for me and I feel like I'm probably making a really simple mistake with all of this.

My current challenge is trying to get sync a boolean value across the network.  Rather than post a long description with pictures, I just made a quick video showing what I'm doing in the editor.

Any ideas?

Here's the video:

https://youtu.be/qJnYUGfYXU0 (https://youtu.be/qJnYUGfYXU0)
Title: Re: Playmaker and Photon - Syncing a boolean
Post by: Ateam on September 22, 2017, 01:45:10 AM
You can use PhotonViewRpcBroadcastFsmEvent, that send a string to one global event inside the players, you can make a simple manager for that with a array and when somebody select one option it send a string (for example player1/argent) to all players arrays. then you can check that array with get next array.
Title: Re: Playmaker and Photon - Syncing a boolean
Post by: shinodan on September 25, 2017, 09:56:38 AM
Didn't watch the video but if you wanted to sync a Boolean all I would do is add a photon view to your gameobject, drag your FSM that stores the Bool into the "Observed" Box of the photon view. Then make sure you have marked the bool as "Network Sync" Ignoring the error it might give you about it. (I think it expects the unity networking, but we are using photon)

Then Provided that the game object is created on all clients, the Bool should be the same for every player.

(I think you might also need to add a "Photon Game object Proxy" script to your object)
Title: Re: Playmaker and Photon - Syncing a boolean
Post by: jeanfabre on September 26, 2017, 04:28:15 AM
Hi,

 Have you checked the demo worker scene and tutorial? it will show you how to sync playmaker variables,

https://hutonggames.fogbugz.com/default.asp?W927
https://hutonggames.fogbugz.com/default.asp?W874

Bye,

 Jean
Title: Re: Playmaker and Photon - Syncing a boolean
Post by: MarkD on September 26, 2017, 10:28:55 PM
Thanks guys.

Jean - those tutorial pages are definitely helpful, but I don't seem to be getting anywhere with them.

Here's my really basic setup and assumptions:


From what I've read, I would assume that since they're Network sync'd values and being observed, when I click on button A from my 2nd instance, I SHOULD see that value turn True on my instance running in the editor.  But I don't.

What am I missing? 
Title: Re: Playmaker and Photon - Syncing a boolean
Post by: jeanfabre on September 29, 2017, 03:30:03 AM
Hi,

so both buttons are controlled by the owner of the GameObject right? Are you positive on this, that you use the IsMine action to make sure you only allow the owner of the networked gameobject to write data to the network while the counter parts instances ( where ismine is false) will read the data ( read the fsmBool values)

 bye,

 Jean