playMaker

Author Topic: Photon - Play with friends[SOLVED]  (Read 24369 times)

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends
« Reply #15 on: June 08, 2016, 11:00:07 AM »
Hi Jean,

Any progress on this? Sorry to bug you, I could use this soon or I'll have to get started on a workaround (manually entering a room name)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #16 on: June 10, 2016, 03:28:54 AM »
Hi,

 I'll likely get on it soon, but havent' started sorry... But thanks for the bump it helps!

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #17 on: June 22, 2016, 09:57:32 AM »
Hi,

 Ok, support for FriendList is now available ( get the latest on Ecosystem or wiki if ecosystem is capricious).

use PhotonNetworkFindFriends to make the request ( ONLY WORKS IN LOBBY)

 you'll have a new "PHOTON / FRIEND LIST UPDATED" which is only when you receive this that you should query it using

PhotonNetworkGetFriendsOnlineStatus
PhotonNetworkGetFriendsinRoomStatus
PhotonNetworkGetFriendsRoomStatus

 It's now mandatory to have PlayMaker 1.8, because I started using FsmArray with friendList.

Let me know how it goes.

 Bye,

 Jean

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends
« Reply #18 on: June 22, 2016, 09:26:59 PM »
Awesome!

Thanks Jean, I will implement these this week and let you know if I hit any issues.

ermak

  • Junior Playmaker
  • **
  • Posts: 60
    • AL Games
Re: Photon - Play with friends
« Reply #19 on: June 23, 2016, 07:20:46 AM »
This is great! New "Friends" actions.
I'll be happy for any simple demo of this feature too (unity package or video).

By the way... any chance in the future for "Photon change owner" action?
https://doc.photonengine.com/en/pun/current/tutorials/ownership-transfer

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #20 on: June 23, 2016, 09:11:49 AM »
Hi,

 It's tricky to do a demo, because you need to come up with a social system to have a friend list being created. Else it means that for testing, you'll have to instantiate several instance of the demo, name each player of them instance properly, and then test on the Unity editor... this is I feel too much for a demo...

basically, you name each your player with a unique name, which is usually a facebook id or some social id.

then, your social network gives you  the list of your friends id, you store them id in an FsmArray, and you feed that inside the FindFriend Action, and you wait for "PHOTON / FRIEND LIST UPDATED", which then allows you to use all the get Friendxxx actions for who's online, what room they are in, etc etc.

 So that in itself is really simple.

I'll work on the change owner action yes. Should have that by tomorrow.

Bye,

 Jean

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Photon - Play with friends
« Reply #21 on: June 23, 2016, 05:30:08 PM »
FindFriend Action!!!
OMG I can't wait! Thanks a TON Jean!

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends
« Reply #22 on: June 25, 2016, 04:38:14 AM »
Hi Jean,

The "PHOTON / FRIEND LIST UPDATED" event never seems to trigger after using the Find Friends action, and the other actions are unable to receive friend status information.

Also, "PHOTON / FRIEND LIST UPDATED" does not appear to have an existing global event, such as the older Photon events. Am I missing something? The "failure event" does not happen after calling the find friend action, so I assume it is using the action successfully.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #23 on: June 27, 2016, 08:17:47 AM »
Hi,

 My test works fine.

 Get the PlayMaker worker demo, and play it, when in the lobby, locate the "menu" GameObject, and the fsm "Friends Test", trigger "FIND FRIENDS" from the PlayMaker inspector.

 You should then be receiving "PHOTON / FRIEND LIST UPDATED"

 Let me know how it goes. Remember, it only works if you are in the lobby.

Bye,

 Jean

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends
« Reply #24 on: June 29, 2016, 04:31:33 PM »
OK, I got the  "PHOTON / FRIEND LIST UPDATED" to work, but only ONCE.

It appears that using the Find Friends action causes a Photon disconnect immediately afterwards.

The connection state is returning as "not connected", and if I use another connect action, it will work again ONCE, and disconnect again.

edit: For now at least I can force a refresh of the list by constantly reconnecting
« Last Edit: June 29, 2016, 04:34:47 PM by MABManZ »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #25 on: June 30, 2016, 07:29:17 AM »
Hi,

 ok. very odd... I am witnessing any disconnection after I request and receive "PHOTON / FRIEND LIST UPDATED".

 Are you using the demo worker or your own scene and logic?

You only get friend list update when you request it first of all. You won't get an automatic callback when a friend connects you have to query it. do that every minute maybe.

Bye,

 Jean

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends
« Reply #26 on: July 03, 2016, 03:51:41 AM »
I am using my own logic to populate the friends list array, but followed very closely with the example. I've got everything working correctly now!

Things to watch out for:

- The process can hang or disconnect if you attempt to use Find Friends on an array with null values in it
- Resizing your array to the size of the friends list will avoid this issue


Thanks for the help Jean!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Photon - Play with friends
« Reply #27 on: July 04, 2016, 09:16:59 AM »
Hi,

 uhm, interesting comment on null friends references. It of course doesn't make sense to feed an array with null value in this case, so let's keep it as is ok? or do you think I should implement a clean up or event being fired if friend list contains null values?

 Bye,

 Jean

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Photon - Play with friends[SOLVED]
« Reply #28 on: July 04, 2016, 01:30:01 PM »
For users who may not understand a lot of coding (like me) it may be helpful, it took me several hours to figure out why this was happening so it may help save them some time!

But also it was a good lesson for me with working with arrays :)

Sid

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Photon - Play with friends
« Reply #29 on: August 15, 2016, 04:48:33 PM »
I'll work on the change owner action yes. Should have that by tomorrow.

Hey, @jeanfabre.  Any luck on getting the Photon Takeover action (this.photonView.RequestOwnership()) going? 

We could really use it, as we transition to scene objects.

Thanks so much!
« Last Edit: August 15, 2016, 04:52:15 PM by Sid »