playMaker

Author Topic: Network ViewID owner switching  (Read 1547 times)

tezer86

  • Playmaker Newbie
  • *
  • Posts: 23
Network ViewID owner switching
« on: May 29, 2014, 07:15:34 PM »

Hey Guys,

Been trying to get my client moving a cube that the server has network instantiated but with no luck. I have tried RPCs but sending a network even but that doesnt seem to be being registered by the server FSMs at all.

So I went back to just Network View. My question is, is there an action in Playmaker that allows us to change the owner of an object that was instantiated by another client or the server?

An example is the post here: http://answers.unity3d.com/questions/429877/synchronisation-from-client-to-server.html

Many thanks

Terry

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Network ViewID owner switching
« Reply #1 on: May 30, 2014, 08:03:41 AM »
Hi,

 Like it says on this link, it's not really recommanded to do so, and I would strongly advice not to.

instead, I would ( and do so for my project R.mote actually create proxies.

each player instantiate a networked prefab, let's call it "Player Proxy"

this "Player proxy" forwards input from the owner to the clients

in your game logic, the gameobject your players should control ( let's call it "target") is not controlled via a component on itself, but by one of these proxy. so you can then assign a proxy to now be in charge and control that gameobject "target"

Fire an event "CONTROL TARGET START" to "Player proxy" passing the reference to the target. Accept this event only if you are the owner of "player proxy", and then you inject the user input to this target, fire an event "CONTROL TARGET STOP" again for this proxy to stop controlling.

 Does that make sense?

bye,

 Jean