playMaker

Author Topic: Photon Playmaker question  (Read 1545 times)

Terry213

  • Playmaker Newbie
  • *
  • Posts: 43
Photon Playmaker question
« on: July 26, 2018, 03:05:36 PM »
I'm a beginner at using Photon and I was wondering if you instantiated two players in one room would there be two different sets of global variables or will there be just one and the two players affect each variable? For example if I create an action on a button that when someone presses it to join a room, the enemies spawn. I'm afraid that the client who created the room will see the player but the enemies won't spawn because I wont have the same action on the button that creates a room. I hope I'm making sense.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Playmaker question
« Reply #1 on: July 27, 2018, 09:33:08 AM »
Hi,
 
no, global variables are not per player, they are per project.

 you need dedicated fsm where you host variables for a given player, or you use Photon Player custom properties if you need to have these values across the network.

the question is how you spawn your ennemies.

 within Photon the best way is to do that when you are the masterClient.

only the masterClient should be responsible for running the logic to spawn ennemies. then when players gets instantiated, your fsm on the player checks if it's the masterClient ( only one amongst ALL players on all running apps will be the masterClient), then it spawns ennemies which must also be networked so that it gets spawned on all connected apps.

Does that make sense?

 Bye,

 Jean

sk8er1024

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Photon Playmaker question
« Reply #2 on: October 12, 2018, 01:16:26 PM »
Is there an example anywhere of spawning enemies in a photon environment? I could really use one if possible.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Playmaker question
« Reply #3 on: October 15, 2018, 02:40:38 AM »
Hi,

 where is your struggle on spawning ennemies? you "simply" instantiate a scene object ( belongs to masterClient) using PhotonNetworkInstantiateSceneObject action.


 Bye,

 Jean