question

joehot200 avatar image
joehot200 asked

How can I get Photon clients to see if another player is premium?

Hi,

So basically, I would like to create a paid cosmetics system. A player pays real money for a skin, and when they enter the game, I would like all other players to know and display that the player has got the skin.

My game uses Photon, so I would need to make this functionality secure, so that a player couldn't just fake their skin.

How would this be achieveable?

Player DataIn-Game Economyphoton
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

If you mean Photon Realtime, that service does not enable server authoritative logic. What you can do is use Cloud Script to query for the truth about a player (have the Skin be an inventory item that you sell to the player).

6 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.

joehot200 avatar image joehot200 commented ·

Yes, I mean photon real-time. Is there a tutorial out there for this sort of functionality?

0 Likes 0 ·
joehot200 avatar image joehot200 commented ·

The tutorial at https://api.playfab.com/docs/tutorials/landing-tournaments/photon-unity is pretty useless at actually telling me how to make a client call a Photon web-hook to do what I'm looking for. It doesn't even actually inform me of how to do web hooks!

0 Likes 0 ·
brendan avatar image brendan joehot200 commented ·

That's because the client doesn't make webhook calls. Webhook calls are made automatically when a player joins or leaves a room, changes a value on the room, etc. And the client doesn't get info back from that call - Photon only passes back data on error conditions. That's why I'm saying you would need to make a call from the client to Cloud Script, to confirm the info about the other player.

0 Likes 0 ·
joehot200 avatar image joehot200 commented ·

Ah, that makes sense. So how can I make a client ask a question about another player? How does the client know which player to ask PlayFab about? Is there any code examples that do something similar, in a Photon Realtime game?

0 Likes 0 ·
brendan avatar image brendan joehot200 commented ·

Via Cloud Script: https://api.playfab.com/docs/tutorials/landing-automation/writing-custom-cloud-script.
In terms of knowing how to ask about another player, you could have the clients send their PlayFab IDs to each other via Photon, but I believe the Lobby/Room already hosts that information - @Hamza Lazaar can confirm.

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar brendan commented ·

if you use the PlayFab integration as we recommend the Photon UserId will match the PlayFabId.
The Photon UserId of other players can be gathered via Photon only inside rooms (created with PublishUserId set to true).
In the Lobby you need other ways to know who's connected or their UserIDs etc.
Outside of rooms, Photon can offer a way to know if someone is connected or not and to which room he/she's joined to if any via FindFriends.

0 Likes 0 ·

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.