Ion avatar image
Ion asked

Achievement system + Photon webhooks


I am starting to build an achievement system. I have been reading other posts about achievements, and finally I decided to post my thoughts.

I have read a good approach would be storing meta-data in the title data and storing player progress in its own read-only data.

So I can use cloud script to make achievements progress checking both data.

I am not using my own game server, but I am trying to avoid client api calls for user data etc.

Also, the matches are up to 8 players. It's a realtime gameplay.

Since my game uses photon for multiplayer, I was thinking to take some more room properties through photon webhooks. I am using shared group data for potential data of the room (game state, the result place - depending on the member amount left in the group...).

I call raise events to remove a member from the shared group, if he has been eliminated, for example...(and updating others result place) and I am also taking the game state from webhooks.

But I think I could jump to the next level taking some more data from room properties, like some statistics for each player, so I can store in the data of the player in the shared group, and update its achievements when the game finishes.

Have I explained correctly?

Is this a crazy idea? Should I manage achievement statistics more locally and send to the server when the game finishes?

I know it is potentially hackeable, even though I could check that the received data have sense.

I think saving data through room properties and update in the cloud script, could be more secure, what do you think?

Any suggestion is very welcome.

Thanks for reading!

CloudScriptTitle DataphotonShared Group Datawebhooks
10 |1200

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

brendan avatar image
brendan answered

One immediate issue is that Shared Group Data is not intended for realtime gameplay. All it really is, is player data that has no single owning player. So it works quite well for strictly turn-based asynchronous games (which is what we added it to support), but if you have multiple players trying to update it at the same time, you're going to have contention issues, as well as players overwriting each others' updates. One way to solve that could be to move to Entity Objects or Files.

However, the other issue is twofold: First, if you're updating shared data for a realtime game, you're going to be updating that data at a high rate. Second, you're also going to be reading it at a high rate, since scripts run stateless - so, each script has to read the data to know the state that you're updating. All these reads and writes are going to hit the relevant meters (

So between the cost of the high level of reads and writes, plus the fact that you're correct that since the state of the game is really being updated by the clients, you're more vulnerable to cheating, you'd likely be much better off using hosted game servers. The servers would protect you against cheating far more, since the only thing you'd be taking from the clients are inputs, and all the state information for the session would be in memory on the server, so no reads or writes would be required at all during the session - you'd just update the PlayFab store of data at the end (or periodically during the sessions, if they run long).

1 comment
10 |1200

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

Ion avatar image Ion commented ·

Sorry I answered to the post. Could you check it please?

It is very appreciated.


0 Likes 0 ·
Ion avatar image
Ion answered

thanks Brendan.

But the way I am using shared groups its very simple. i just create a group when the match starts. The master client raises an event to create it.

After that, the SGD is only updated when a player kills another. and it is done by a raise event using webhook.

Each player has his KVP in the group, but others can edit it when they die, to update the result place. So if the game finishes by time or by being the only player alive, the players can call a function in the cloud script and get the result and the reward.

I could send Achievements statistics only at the end of the match then.

In one hand, I am not worried about cheaters, almost in our first version.

In the other hand, I don’t have experience with own game server and I find it much slower development.

So, what do you think about using SGD in that way? I create the group in raise event webhook. The group is only updated through them and only up to 12 times in about 5 min of gameplay, then the SGD is deleted when all the players left the room. The idea is to store the final results in a more secure way.


10 |1200

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

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.