playMaker

Author Topic: Instantiating player - Example 'ClickMoveTo' FSM not working. [SOLVED]  (Read 6975 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
Hi,

I'm trying to learn about the Photon Networking stuff, and have been playing around with some of the PlayMaker samples as a starting point. I don't really understand this problem I've run into;

I've taken the PM sample 'TestLab>Input>ClickMoveTo', which is working correctly. I've then moved the player cylinder to a prefab (I can see it has retained it's fsm).
I've added the Photon objects 'Code_enabler', 'Code_game' and 'Code_menu', and adjusted the settings to be relevant to my scene.

Now, the scene runs, I can create a room, and join the room with the 2nd player. It instantiates both players - however they are both stuck in the idle state of the FSM.

I don't really understand why this is happening.

Why is this FSM working from an object in the scene, but if the object has been instantiated, then it doesn't?
« Last Edit: August 07, 2013, 11:32:27 AM by jess84 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #1 on: July 28, 2013, 12:29:19 PM »
Hi,

 can you double check that indeed the fsm in question is enabled? you are likely missing the dance of the enabling/disabling the right components when instantiating the player. when the player "is mine" this is the one you control with the user inputs, else it only should react to catch up with the owner ( that would be this very player running on a different machine, so it needs to reflect what the player does, instead of interacting with the user input).

so, take a look at how the  demo player prefab is setup, and how components are enabled, disabled to reflect this concept of who is in control.


bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #2 on: July 29, 2013, 09:27:05 AM »
Thanks for the reply.

The whole Photon stuff seems like a nightmare after a bit of playing around. I've been studying the example DemoWorker scene and FSM Photon Player prefab.

As a very basic test, I've tried to create my own player prefab to instantiate - using a basic cylinder. I've copied the FSMs attached to it, and noted which components were added - and added the same.

However when I run this, it instantiates 2 players, they load into the same room, they can be seen by each other (great!), however one player cannot see the other player moving around.

Urgh, this is driving me insane.

Would you be able to share a prefab with all of the correct FSMs and Components attached, and all it requires is the player object dropped on to it?

Seriously, I can't understand why this is so difficult to get running - I can see the DemoWork prefab and understand all the connections. Ideally what I'd like to do is take this, and somehow replace the worker model with a new model of my choosing.

 :(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #3 on: July 29, 2013, 09:44:17 AM »
Hi,

 Multi user in general is a advanced beast to tackle, so don't give up, Photon is actually very well designed, you just need to grasp the concepts and key features to make whyt you want with it. I would not say it's difficult, I would actually tend to say that it requires a bit more reading and learning to begin with. And it requires a lot more care when you start experimenting with this.

 The demo worker player prefab is in itself the lowest featured prefab for a MU player...

in your test, can you double check that you are synching variables properly. Having the right components in place is one thing, but you also need to implement the right logic behing it. typically:

 Do you grasp the following:

 -- When the network view "is mine", this is when your user controls the player, so you must allow the user to input and control the player.
-- When the network view "is not mine", this is that player running on other computer. Here is must remains totally self contained and not react to the user input since that user is another player in your game, instead it must read the synched variables, and adjust manually the player position to reflect that the user is doing.

so, to resume: UserA is the physical person, PlayerA is the representation of UserA in your game running in ComputerA ( UserA's computer)
-- UserA and PlayerA on ComputerA: 
           -- PlayerA "is mine" will be true. UserA controls PlayerA,
           -- PlayerA must write synched variables.
-- UserA and PlayerB on ComputerA: PlayerB "is mine" will be false.
           -- UserA DO NOT CONTROL PlayerB,
           -- PlayerB must read synched variable

does the above make sense to you? and can you see in the demo worker how this is implemented in the player prefab logic?

You are not far at all, keep at it, and you'll see at one point that all these concept will start making sense and you'll feel more comfortable with this. Just to double check, Are you reading the various docs on photon ( photon's pdf, mine, etc), this is critical that you read then over and over. That's how I learned...

bye,

 Jean



jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #4 on: July 29, 2013, 10:42:29 AM »
Yes, I grasp the 'Is Mine' and 'Isn't Mine' concepts - and how they are applied within the demo sample.

But when I think I have recreated all of those elements in my own prefab, it's still not working.

I give up.

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #5 on: July 29, 2013, 12:11:59 PM »
Is it possible to replace the model in the 'FSM Photon Player' prefab with my own cylinder? (and thereby keeping a working prefab with the associated components and FSMs)  And if so, how?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #6 on: July 30, 2013, 06:07:32 AM »
hi,

 of course, simply point the model inside the player "Bip001", and also edit the animation component ( on "Player") to reflect the proper animation on your model.

bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #7 on: July 30, 2013, 09:09:54 AM »
How to you mean 'point the model'?

If I expand the prefab, I can see the Bip001 -  but then what?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #8 on: July 31, 2013, 02:51:30 AM »
Hi,

 replace bip001 with your actual model. I meant "change" instead of "point", sorry, bad english :)

bye,

Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #9 on: August 02, 2013, 05:01:37 PM »
No worries  :)

Thanks for the clarification, shall persevere with it tomorrow.

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #10 on: August 06, 2013, 07:25:29 AM »
I'm still not getting this to work, despite all of the reading and copying what's been done on the FSM Photon Player prefab. And having read through the 'tutorial' on the wiki page.

Are there are any plans to do a step-by-step tutorial, so that people can follow exact instructions and get it working?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #11 on: August 06, 2013, 07:28:07 AM »
I'm guessing that this might be one of my problems too: (see screenshot)

How exactly do you get thte Photon View Component to observe the prefab's FSM? If you drag the prefab onto it, it observes the gameobject, not an FSM.

 ???
 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #12 on: August 06, 2013, 07:40:43 AM »
Hi,

 because you need to drag the "fsm" component, not the gameObject.

bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #13 on: August 06, 2013, 07:54:06 AM »
OK, I worked out what I'm supposed to be dragging.

But which one of the FSM Components is supposed to be referenced in the Photon View?
« Last Edit: August 06, 2013, 07:57:51 AM by jess84 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Instantiating player - Example 'ClickMoveTo' FSM not working.
« Reply #14 on: August 06, 2013, 09:41:49 AM »
Hi,

 You need to drag the one that has variables with "network synch" checked on. otherwise it's not necessary to target anything unless you want photon to synch the transform directly.

bye,

 Jean