question

Cedric Neukirchen avatar image
Cedric Neukirchen asked

Place Players into two large groups/clans (server-only).

Hey everyone,

I've read through a few forum posts and documentation pages and can't find the proper way to handle the following feature:

Our game has "seasons", which last couple weeks and allow leveling a season pass and performing ranked games. In addition to this, we want to allow the player to join one of two "clans" when they purchase our season pass. Joining a clan will provide them with an item (that is already in place).

Further all player stats acquired during the season (right now just experience) will count for the clan too. At the end of a season, one of the two clans will have a higher amount of experience and sort of win, rewarding the players that are part of the clan with a few items.
Further at each given time, every player should be able to see the top 10 players as well as what place they are within their own clan, because at the end of the season, the top 3 players will receive additional rewards.

Now I can't really find a way to define and manage the clans with the giving PlayFab systems.

- Groups don't work as they are client handled and clients should actually never interact with the 2 groups despite viewing read only data. The clan data would only be updated server-side (cloudscript) after a match is over.
- SharedGroupData doesn't allow so many players to be in one group.
- Segments can't be created and handled via code.

I thought about creating a TitleData entry per clan and when a player joins a clan, I enter their id into an array in there. But that would also create a huge list of ids if a lot of players play the game.

Storing the list is probably not the issue, but since you can't really selectively query the title data entry, we would end up getting a huge clan data result on the client, containing all playerId (50% of the player if not more).

Isn't there a more database like system you peeps have? Ultimately I would love to have the ability to:

- Get the local players score/place.
- Retrieve the top 10 players of an ordered list (ordered by how many points they provided to the clan.


Cheers,
Cedric

game manager
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.

Cedric Neukirchen avatar image Cedric Neukirchen commented ·

So I went ahead and thought about how to achieve this with PlayFab.

The two big groups (which are new each season) could be segments created by hand.
I went ahead and did that and also utilized the "Entered" event to give the initial joinReward.
That segment listens to a unique tag that each season clan will have (e.g. tag_clan_firstclan).

So we have two segments now with two unique names, listening to two unique tags, rewarding the join reward. These will be created for each unique clan every season.
This way we can also keep track of previous seasons.

For the Top10 list I could utilize a StatisticValue (stat_clan_firstclan) per clan.
If a player joins a clan, I increase this value every time a match is done. This way I can keep track of the personal value of the player and utilize the leaderboard system to get a list.
Not sure if I can query the player's overall position like this though. I need to know if they are place 50.000 or how many players we might have.

The reward for the top 3 could be done by grabbing the top 3 leaderboard of the "stat_clan_..." statistic and then just granting the resulting 3 players the rewards.

End of Season reward for a winning clan is still tricky...

0 Likes 0 ·
Cedric Neukirchen avatar image Cedric Neukirchen Cedric Neukirchen commented ·

... for this I would need to have a way to give all players in the clan a reward.
I think I could add the unique segmentId to the overall clan data and at the end of the season, get the users in that segment and reward them all with an item. Not sure how nice it is to get 50.000 players like this or if there is a better solution.

Problems that remain are a way to have an overall value for the clan to compare to. What I could do is to utilize TitleData and have a key/value pair per clan. (so with more seasons this would grow). That way I can grab the clan data on the user via getTitleData.
I would then need to update the clan data every time a match ends together with the statistic the player gets increased. I hope that won't cause any race conditions or so when multiple matches end at the same time, modifying the same clan value.

If I could get the statistic value of all players in a clan(segment), I could also just loop over them an sum up the value, but that would then be a lot of loop iterations if there are a lot of players. So I guess increasing when the players gets updated is better.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Cedric Neukirchen commented ·

To maintain data that can be updated frequently by multiple players, I believe you need external database, for example, Redis, to handle this.

However, I have a work around solution but not sure if it can work when there are large amounts of players. You may create 2 players to represent 2 clans, who will own 2 separate statistics. When players finish the game, they will upload scores to Cloud Script function, and server API can be called to update statistics after the data verification is done (you may configure the aggregation method of corresponding leaderboard as Sum). It means this leaderboard will only contain 2 players' data which is very easy to check the winner.

0 Likes 0 ·
Cedric Neukirchen avatar image Cedric Neukirchen commented ·

Ran into another issue with segmentations. We need to grant all players of a segment an item and we don't want to do this by hand. We are currently trying to grant an item to them when we cycle to a new season in cloudscript. However there seems to be no way to grant an item to a segment. The only thing I found is having a scheduled task, but we basically already have one scheduled for the cycling of the season and we don't know which clan was the better one before actually checking via code.

How can we grant all members of a segment an item through cloudscript?

A full day of not understanding why this has to be so complicated with PlayFab.
I would wish for a normal database approach, but I guess that PlayFab is just not build for that.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Cedric Neukirchen commented ·

>>How can we grant all members of a segment an item through cloudscript?

For this requirement, I believe it cannot be done on Cloud Script since Admin APIs are not supported there.

Scheduled tasks are able to handle this. If you have a secure server or local tool, Admin API -- GetTasks, RunTask etc. can manage scheduled tasks. UpdateTask is able to change the target segmentation.

0 Likes 0 ·

0 Answers

·

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.