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?
Answer by Brendan · Apr 25, 2018 at 01:16 AM
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).
Yes, I mean photon real-time. Is there a tutorial out there for this sort of functionality?
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!
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.
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?
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.
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.