How to properly utilize findFriends, FriendInfo, etc.?
Options
I want to setup friend list elements, like seeing if your friend is online, setting up a match with them if so, etc. So here's a lil disclaimer before I go into more detail:
I am using Photon Realtime C++ API with Photon Cloud and Unreal Engine 4, with the client platforms being Android C++ and IOS C++. Everything is working great so far! I am brand new to coding (I use Blueprints in UE4), but have already managed to utilize Photon for simple things like setting up matches and sending/receiving custom events/data. I really love this product!
Alright, so...
What I'm having trouble with is returning whether or not a friend is online. In the game, when you create your account name, it generates a unique ID and uses that as the actual Photon account name that is passed around. So that's taken care of.
I've searched and searched for a specific answer, but I'm afraid what I really need here is some babying.
Say I pass an array, friendIDs, into a function. I then want Photon to tell me who is online.
So what exactly do I use to send the data, and how exactly do I receive it?
I know about the existence of the FriendInfo class, findFriends, getFriendList, etc., but I am really not sure how to properly use them.
I am using Photon Realtime C++ API with Photon Cloud and Unreal Engine 4, with the client platforms being Android C++ and IOS C++. Everything is working great so far! I am brand new to coding (I use Blueprints in UE4), but have already managed to utilize Photon for simple things like setting up matches and sending/receiving custom events/data. I really love this product!
Alright, so...
What I'm having trouble with is returning whether or not a friend is online. In the game, when you create your account name, it generates a unique ID and uses that as the actual Photon account name that is passed around. So that's taken care of.
I've searched and searched for a specific answer, but I'm afraid what I really need here is some babying.
Say I pass an array, friendIDs, into a function. I then want Photon to tell me who is online.
So what exactly do I use to send the data, and how exactly do I receive it?
I know about the existence of the FriendInfo class, findFriends, getFriendList, etc., but I am really not sure how to properly use them.
0
Comments
-
Hi DG Gage.I am using Photon Realtime C++ API with Photon Cloud and Unreal Engine 4, with the client platforms being Android C++ and IOS C++. Everything is working great so far! I am brand new to coding (I use Blueprints in UE4), but have already managed to utilize Photon for simple things like setting up matches and sending/receiving custom events/data. I really love this product!
Thank you for the kind words.What I'm having trouble with is returning whether or not a friend is online. In the game, when you create your account name, it generates a unique ID and uses that as the actual Photon account name that is passed around. So that's taken care of.
I've searched and searched for a specific answer, but I'm afraid what I really need here is some babying.
Say I pass an array, friendIDs, into a function. I then want Photon to tell me who is online.
So what exactly do I use to send the data, and how exactly do I receive it?
I know about the existence of the FriendInfo class, findFriends, getFriendList, etc., but I am really not sure how to properly use them.
- pass your array to Client::opFindFriends()
- implement the callback Listener::onFindFriendsResponse() (unlike many other callbacks like connectReturn(), createRoomReturn() or customEventAction(), onFiendFriendsResponse is an optional callback - the game codes implemention of the Listener interface only needs to implement it, when it wants to use the findFriends feature, so you won't find a dummy implementation for this callback in the demo) and access the received friend list
An example implementation for onFindFriendsResponse() could look like this:
[code2=cpp]void NetworkLogic::onFindFriendsResponse(void)
{
EGLOG(ExitGames::Common::DebugLevel::INFO, mLoadBalancingClient.getFriendList().toString());
for(unsigned int i=0; i<mLoadBalancingClient.getFriendList().getSize(); ++i)
{
ExitGames::Common::JString name = mLoadBalancingClient.getFriendList()[0].getName();
bool isOnline = mLoadBalancingClient.getFriendList()[0].getIsOnline();
bool isInRoom = mLoadBalancingClient.getFriendList()[0].getIsInRoom();
}
}[/code2]0 -
Excellent! Just what I needed and it works beautifully. Thanks!0