playMaker

Author Topic: Playmaker and Photon - Syncing a boolean  (Read 2854 times)

MarkD

  • Full Member
  • ***
  • Posts: 113
Playmaker and Photon - Syncing a boolean
« 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

Ateam

  • Full Member
  • ***
  • Posts: 116
Re: Playmaker and Photon - Syncing a boolean
« Reply #1 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.

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Playmaker and Photon - Syncing a boolean
« Reply #2 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)
« Last Edit: September 25, 2017, 09:59:00 AM by shinodan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker and Photon - Syncing a boolean
« Reply #3 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

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Playmaker and Photon - Syncing a boolean
« Reply #4 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:

  • There are two buttons, we'll call them A and B.
    Pressing Button A does a Set FSM Bool A to True
    Pressing Button B does a Set FSM Bool B to True
    A and B are booleans on another game object called "Game Manager"with the following components/settings:
    They have network sync checked
    They each have a Photon view component (set to Fixed, unreliable on change, observing the FSM from the Game Manager Object.)
    They each have a Play Maker Photon Game Object Proxy

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? 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker and Photon - Syncing a boolean
« Reply #5 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