playMaker

Author Topic: spawning a (photon) multiplayer character  (Read 3212 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
spawning a (photon) multiplayer character
« on: September 30, 2012, 05:38:35 PM »
HereĀ“s a tricky one...

My new game is multiplayer, based on the very excellent Photon Socket server. I know nothing about it, but have managed to set-up and use their "out of the box" demo, to build this awesome game!!

But now I have come to the KILLING:.. The characters when they die  (After losing all their points, and a cool bloody fade-out cut scene) should Spawn, back into the scene.

Of course they are never really leaving the scene, Im just running a cut scene and moving the characters position to a start point, while they are watching the cut-scene.

EXCEPT I CANT!!!!!!

The problem Im having with the playMaker position action is that it needs the name of the Game Object to move. BUT with photon, every instance of the player is instantiated with a random name extension.

For example, If your player prefab is called Player, when it is spawned into the game its named Player(clone)1000, The next player to join will be called Player(clone)2000 and so on...
So I cant KNOW what my character is gonna be called, so I cant name him in the GameObject field...

What can I do?

cheers

Mark



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: spawning a (photon) multiplayer character
« Reply #1 on: October 01, 2012, 01:13:04 AM »
Hi,

 First, if you look at the  Photon demo made in playmaker, you'll see that I play around with the name of the gameObjects, so you can override the gameObject named.

 but that would not help your case. I think that you are missing an important concept.

 the owner of the player is the one responsible for moving the player. So you don't even need to know the gameObject name, you own it. The Fsm that will move the player to a given "rebirth" position should be attached to the player itself.

 Does that make sense?

bye,

 Jean


markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: spawning a (photon) multiplayer character
« Reply #2 on: October 01, 2012, 02:01:13 AM »
Thanks Jean!
That's totally obvious! I was backwards in my thinking. I will try to attach the FSM to the player instead! It could be that being able to change the name is gonna be useful too, so Ill check the demo proj. I don't think I've seen it actually!

Mark