playMaker

Author Topic: [Solved] Photon: Sending RPC to a group of players  (Read 2108 times)

charming_fox

  • Junior Playmaker
  • **
  • Posts: 62
[Solved] Photon: Sending RPC to a group of players
« on: September 16, 2015, 07:11:33 AM »
Hi all,

I would like to be able to assign players to a group and send a broadcast to all FSMs but only to that group of players... currently I have a system by which players are assigned an ID and the RPC call goes to all players but is only 'let through' if the ID matches however this is inefficient and seems risky.

Is there any way I can build a string of player IDs and broadcast to that string?

Many thanks!
« Last Edit: September 17, 2015, 09:11:22 AM by charming_fox »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon: Sending RPC to a group of players
« Reply #1 on: September 17, 2015, 01:31:13 AM »
Hi,

 Photon has a "group" feature, but I never worked with it, your solution would be what I would go to myself:

-- each player has an Fsm where you have a variable "Group Id"
-- send an RPC to all, but only the one of that group will respond.

I have another technic however, that could be good too.

If your groups are known during editing, like enemies, allies, or team A, team B, you could have hardcoded events like "TEAM A / DO THIS", "TEAM B / DO THIS", and each player when instanciated would either have fsm enable disabled based on their group so that they only respond to their events, or you could attach to the player as a child a gameobject with the right set of fsms for that particular team.

If you want to explore the photon group feature, let me know, I am willing to investigate this further and provide proper access within the PlayMaker custom actions.

Bye,

 Jean

charming_fox

  • Junior Playmaker
  • **
  • Posts: 62
[Solved] Re: Photon: Sending RPC to a group of players
« Reply #2 on: September 17, 2015, 09:11:04 AM »
Excellent, thanks for the response, I've gone with group IDs and it is working nicely.

Cheers again, always great support from you!