question

Terry Papamarkou avatar image
Terry Papamarkou asked

storing win count for different factions

I've found some similar questions and answers but I'm having trouble figuring out how to implement what we need in playfab.

We have a game with 3 factions - red, green, blue. Players are randomly put into a fact at the start of each month. When a red player beats a blue player, we store a win for that player but we also want to increase the wins for entire red faction and for all players to be able to see the new scores with minimal lag. I've looked into entity groups but these seem to require an Admin player which doesn't really make sense in our scenario. Is there a way to entity groups controlled by some sort of master account, that all players could read data from and write data to the group that they are a member of?

Any tips would be appreciated.

Thanks

entitiesfeedback
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

·
JayZuo avatar image
JayZuo answered

Entity group is also one type of entities. So you can use objects with the group so that all players within the group can read and write the object with GetObjects and SetObjects methods. While using these two methods with group objects, you will need to set the GroupId as the Id of EntityKey and set the Type to "group".

However, as there may be a lot of players in the group, there will be consistency issue with this approach. For example, it's possible that two players win their game at the same time, then the object only add 1 win as they get the object at the same time.

If you need a system that allow for lots of players to read and write, then we'd recommend using an external data store like Redis for example.

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

Terry Papamarkou avatar image Terry Papamarkou commented ·

thank you for the reply. Would using a cloudscript function to handle the increasing win counts alleviate the issue of multiple players trying to update at the same time? Cloudscript calls would be queued in some way wouldn’t they? And what about the requirement for entity groups to have an admin player - any suggestions for how to work around that?

Thanks again

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ Terry Papamarkou commented ·

Cloudscript won't help here as Cloudscript calls are not queued. If the number of your players is large, we will have multiple Cloud Script engine running in different servers to handle the requests.

And for the entity group, anyone who create the group will be the admin of the group. You can use anyone to create the group.

0 Likes 0 ·
Terry Papamarkou avatar image Terry Papamarkou JayZuo ♦ commented ·

ok thanks again

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.