playMaker

Author Topic: [SOLVED] Problems with setting up photon/PM multiplayer  (Read 8691 times)

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
[SOLVED] Problems with setting up photon/PM multiplayer
« on: March 19, 2013, 09:16:33 AM »
Hi guys,

I've been having a go at setting up a photon/PM scene, using the default demoworker example as a base. 

Basically I opened the demoworker scene, and added in a cube which I then attempted to set up as the playable character.  Unfortunately it errors appear, which I have documented alongside some notes I've been making for myself based on the fogbugz documents:

https://docs.google.com/document/d/11oNG-ZbGwhTQtN2JMIXXcs8wmG3mbbWSAL3PDfsi2gA/edit?usp=sharing

EDIT: I have also attached a scene to this thread

Any hints would be great! Apologies in advance for some of these nooby questions:)
« Last Edit: May 04, 2013, 07:47:18 PM by eyehawk »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problems with setting up photon/PM multiplayer
« Reply #1 on: March 20, 2013, 03:06:37 AM »
Hi,

 the link to the scene is not valid, it points to the doc itself.

 if you read the error, it gives you that hint. it says you need to add a photon view.

 for this, the wizard will help you to overcome these set up issues.

open the photon wizard, and select that player prefab. You will notice that the wizard gives you two option: "Add network-ready FSM to "xxx" and "Add Photon View to 'xxx'

basically, for variables synching to work, you need to have a photonView that observe that playmaker fsm where synched variable are defined.  If you study the demo player prefab, you will notice that setup in the inspector.

 that's likely what you are missing here. so in your steps to produce a photon player from scratch, create that gameObject, and then use the wizard to add a network ready fsm to that gameObject, and done, you will then within the fsm created add variables that you can check for synch.

 as alway, I recommand that ONLY ONE FSM per prefab gets synched variable, don't have multiple fsm have each some variable synched, that will be messy and likely not as efficient in terms of bandwith, prefer one fsm meant to synch variable and other fsm simply getting and setting them synched variable,. You will notice that I use a very strict variable naming convention to make sure I always know visually that this variable is synching.

does that help?

bye,

 Jean


eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #2 on: March 20, 2013, 05:34:51 AM »
Hi Jean,

Apologies,  I just realized that the links are the same which was silly of me  :-[

I've uploaded the scene instead to the post.

Thanks for the tips, I did indeed add Network Ready FSM and Add Photon View, which are documented in your instructions.  I was quite confused by the error as the prefab did contain photon views.

I did notice that on 'adding network ready FSM', it already adds a photon view (observing playmaker FSM).  Hitting Add Photon View added another view in addition to this, which had nothing observed.

I decided to start from scratch (using a cylinder prefab this time), with an even simpler controller (a and s keys to move) and added all the critical FSMs on to it.

I did notice here that my CylinderPlayer prefab had an additional FSM 'Photon Network Synch FSM' which the default 'Fsm photon player' (demoworker) prefab did not have.

I then played the scene, and got the previous error regarding not having a photon view. 

I did a bit of trial and error, and what I found was that when I removed the [variable synch repository], the error went away.

However the game wouldn't synch anymore with 2 clients connected, as the variable synch repo as stated in the documentation stores the values for the position, rotation, animation, etc so it's a central FSM.

I think I must be getting close now, I just need a tiny nudge :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problems with setting up photon/PM multiplayer
« Reply #3 on: March 20, 2013, 05:53:10 AM »
Hi,

 do you manually set the "observe" property of the photon view? if so, make sure you drag the playmaker fsm, not the gameObject, else it won't work. for this you will need two inspector, then you drag the playmaker component itself onto the observe field. That's one of the reason why I made the wizard convenient option when you select an object.

 if you did use that, what error do you get when you indeed have a variable synched?

bye,

 Jean

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #4 on: March 20, 2013, 08:41:58 AM »
Hi Jean,

I normally use the wizard to add the photon view, which will have the FSM of the gameobject observed:


In this case I followed your instruction and added the FSM manually. 

When I hit play I still get the same error:


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problems with setting up photon/PM multiplayer
« Reply #5 on: March 21, 2013, 01:09:04 AM »
Hi,

 why do you have two photon view component on that object? that may be the problem

bye,

 Jean

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #6 on: March 21, 2013, 04:29:11 AM »
Hi Jean,

I did notice that on 'adding network ready FSM', it already adds a photon view (observing the playmaker FSM).  Hitting Add Photon View added another view in addition to this, which had nothing observed.

I tried removing the second one which had nothing observed, but sadly the error remained.
Thanks
E

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problems with setting up photon/PM multiplayer
« Reply #7 on: March 26, 2013, 01:49:32 AM »
Hi,

Wanted to get to the bottom of your issue, but you can't really share just the .unity file, you need to package it using the unity export menu.

Can you send me the package itself?

bye,

 Jean

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #8 on: April 01, 2013, 04:29:38 PM »
Hi Jean,
Apologies for the delayed response - sure I will arrange to get you the exported file as soon as possible.
Thanks
E

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #9 on: April 02, 2013, 08:55:41 AM »
Hi Jean, I've sent you a link to the exported package (the scene is called "3 CapsuleTest")- thanks very much for your valuable help .
« Last Edit: April 02, 2013, 09:00:13 AM by eyehawk »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problems with setting up photon/PM multiplayer
« Reply #10 on: April 09, 2013, 02:59:01 AM »
Hi,

 ok, the problem is the following, your photonView does not observe the right Fsm,

 if you look at the log, you will see:


Quote
Fsm component 'CapsuleTest(Clone)' on gameObject 'CapsuleTest(Clone)' has variable checked for network synching, but no PhotonView component is observing this fsm

So, if you don't want to have to dance with two inspectors. simply delete the photon View ( both of them actually, you need only ONE)

open the photon wizard, and select that prefab. Click on "Add Photon View to "capsule Test" in the component section. And then drag the "variable synch repository" fsm in the observe field of the photon view.

 WARNING: really drag that component, not the whole gameObject or loosely, click ont he component header and drag from there, else Unity will pick the first component attached to the gameObject and then it will fail.

 TO AVOID PROBLEMS: I created a special function in the photon wizard to create a fsm that is already set up with its photoView to observe it, so when you will create a new player, use that function to avoid confusion.

bye,

 Jean

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Problems with setting up photon/PM multiplayer
« Reply #11 on: May 04, 2013, 07:47:00 PM »
Thank you very much Jean!  That seems to have been the final tweak that I needed it works fine now  ;D

p.s. Apologies for the very late reply, I've not been able to turn on email notifications for the forum for some reason.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] Problems with setting up photon/PM multiplayer
« Reply #12 on: May 07, 2013, 02:15:16 AM »
Hi,

 no worries!

bye,

 Jean