playMaker

Author Topic: PUN chat room demo gone?  (Read 2527 times)

mrminico

  • Full Member
  • ***
  • Posts: 113
PUN chat room demo gone?
« on: May 12, 2021, 02:45:35 AM »
Hi Everyone,

Anyone know where i can get the demo for the chat room example for Photon?

I recently was looking for a better grasp on broadcasting events through RPC. I can't get events to send to one user, it always sends to everyone on the network.

I ended up finding some old threads on the topic and Jean mentioned looking at the chatroom demo for PUN. unfortunately, I get nothing when trying to download the demos from ECO.

I'm currently using PUN2 by the way.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: PUN chat room demo gone?
« Reply #1 on: May 12, 2021, 05:51:23 AM »
Hi,

 do you have the link to the thread where I mention this? can't find that sample anywhere.

there is a dedicated action PhotonViewRpcBroadcastFsmEventToPlayer for this.

 have you tried that?

Bye,

 Jean

mrminico

  • Full Member
  • ***
  • Posts: 113
Re: PUN chat room demo gone?
« Reply #2 on: May 12, 2021, 02:27:04 PM »
Hi,

 do you have the link to the thread where I mention this? can't find that sample anywhere.

there is a dedicated action PhotonViewRpcBroadcastFsmEventToPlayer for this.

 have you tried that?

Bye,

 Jean

Hi Jean,

I am using PhotonViewRpcBroadcastFsmEventToPlayer but it doesn't send to the specific player, it broadcasts to all including the player sending the event.
 
Here is what I'm doing:

I use a trigger to collide with an object and get the root object where the photon view component and FSMs are. After I use photon network get player properties, set the reference to owned by object, and specify root gameobject to get (nickname, actor id, etc..)

The event is then sent to the player but it also gets sent to all other players.

What I'm trying to achieve:

A hitbox attack from one player to the other that sends the global event PLAYER HIT when players collide with the hitbox trigger.

The event is sent from the player attacking, and when the trigger comes in contact with the network player's collider it saves and references the game object and does all of what I mentioned above. 

Heres the thread:

https://hutonggames.com/playmakerforum/index.php?topic=1621.0

to be quite honest it's a VERY old thread. Just thought that whatever practical uses of RPC's in playmaker would still apply today.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: PUN chat room demo gone?
« Reply #3 on: May 14, 2021, 01:39:58 AM »
Hi,

 The standard pun demo has a chat system, that's maybe what you mean. in there you can choose to whom you are going to chat, have you tried that?

Bye,

 Jean

mrminico

  • Full Member
  • ***
  • Posts: 113
Re: PUN chat room demo gone?
« Reply #4 on: May 14, 2021, 02:45:12 AM »
Hi Jean,

I can't find the demo. And when ever I try to download the demos that are on ECOsystem the only example that gets imported into my project is the simple connections demo. All other demos do not import from ECOsystem for me.


mrminico

  • Full Member
  • ***
  • Posts: 113
Re: PUN chat room demo gone?
« Reply #5 on: May 14, 2021, 03:05:33 AM »
Hi,

 The standard pun demo has a chat system, that's maybe what you mean. in there you can choose to whom you are going to chat, have you tried that?

Bye,

 Jean

Also I'm still a bit confused on how to send events using PhotonViewRpcBroadcastFsmEventToPlayer how do you properly use this action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: PUN chat room demo gone?
« Reply #6 on: May 17, 2021, 01:53:06 AM »
Hi,

if you look at the fsm in charge of sending the chat, you will see how it's use.

 first, I get a list of players in the room, when the user has choose to which player to send something, you can then use PhotonViewRpcBroadcastFsmEventToPlayer.

you send a global playmaker event, and this action make sure thatt amongst all players in the room, only the targeted one will get that global event called.

Have you looked the demo fsm?

Bye,

 Jean

mrminico

  • Full Member
  • ***
  • Posts: 113
Re: PUN chat room demo gone?
« Reply #7 on: May 18, 2021, 04:28:29 PM »
Hi Jean,

Im sorry for confusing you with all these questions.

I found out the chat demo does NOT work for PUN2 only Pun Classic. I made a new project with PUN Classic since the ECO system P U N DemoWorker is not importing the demo. I had to go on the REPO and download it manually.

As for my problem using PhotonViewRpcBroadcastFsmEventToPlayer I'm doing the same exact thing the demo does. I'm sending the event to a user after getting player properties. The client player sends the global event to every object in the scene instead of only sending it to himself. I'm using PUN2, not Pun Classic
I've attached screen shots of PUN classic and PUN 2.





 






jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: PUN chat room demo gone?
« Reply #8 on: July 26, 2021, 02:29:13 AM »
Hi,

 I believe this  has been fixed right?

Bye,

 Jean