question

Jordi G. avatar image
Jordi G. asked

Best way to challenge a friend using Photon

Hello,

I'm currently working on a friend system which allows you to challenge a friend from the Friend List. Create and join the room is not a problem, because Photon lets you to open a room for a specific player.

I need a way to notify that a friend is challenging me. PlayFab works using http requests, then I suppose I have to poll between a undefined time if a friend sent me a challenge. The question is, which is the best way to get it?

First, I thought that Matchmake with both players id in Tags parameter could be a good solution. But it forces you to write an IP address and port, and this makes me uncertain. Other options I'm managing are writing directly in challenged player Players Data, but sounds odd. Shared Data is another option. Maybe a Push Notification among both players?

Thank you,

Jordi.

Player DataShared Group DataFriends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

I'd recommend two things:

First, yes, if your game is on mobile devices, Push Notification would be ideal, since it would let the player know his friend wants to play even if he's not currently in the game.

Second, I would use OpFindFriends () in Photon to find friends who are playing currently (https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby).

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jordi G. avatar image Jordi G. commented ·

Thank you for the answer.

We already have a Push Notification service using OneSignal. I think we have to check first if PlayFabs push notification have any limitations compared with OneSignal's.

If finally we have to choose any other method, is Shared Group Data with polling a decent option?

Thank you,

Jordi.

0 Likes 0 ·
brendan avatar image brendan Jordi G. commented ·

First, if you're comfortable with the polling rate being once every minute or so, then sure, that would work.

When it comes to Push Notifications, the client has authority. If a user disables Push Notifications, no notification is sent to any backend service, and we would not longer have the ability to send a Push to that client.

0 Likes 0 ·
Jordi G. avatar image Jordi G. brendan commented ·

Thank you again.


Just in case, what happens if we want to try the Matchmaking system?

We can use the game to call the Matchmake function with the FriendID in Tags filter. Then, our friend could poll every 10 secons in example, calling GetCurrentGames with his own ID in the Tags filter. This would get the matches where his ID is present in Tags, and we can offer those friend matches to the user.

The problem is we are not using any external server nor PlayFab server, we are using Photon, then IP and Port fields are not needed (we can fake them).

What do you think?

Thank you,

0 Likes 0 ·
Show more comments
Jordi G. avatar image Jordi G. Jordi G. commented ·

What would happen if an user disables notifications? It's possible to still getting notifications ingame?

-1 Like -1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.