question

Greg Quinn avatar image
Greg Quinn asked

I have a statistic that is updating in a very erratic manner

I have one specific statistic in my game that is having this issue.

The only code that updates it is an Azure Function, that increments the value by 1.

int playerCareerRacesWon = playerStatisticsResult.Result.Statistics.First(s => s.StatisticName == "CareerRacesWon").Value;

playerCareerRacesWon++;

statisticUpdates.Add(new StatisticUpdate {StatisticName = "CareerRacesWon", Value = playerCareerRacesWon});

In this specific instance, I was logging the value of playerCareerRacesWon, and the value of playerCareerRacesWon++ after that. The logging was correct, showing the following values...

see attached (ggru5.png)

I then call a new UpdateStatisticsRequest using the Server API from the Azure Function.

The value is still 16384, and then this code is called to update them,..

var updatePlayerStatisticsRequest = new UpdatePlayerStatisticsRequest
{
    PlayFabId = playFabId,
    Statistics = statisticUpdates
}; 


But in PlayStream, the following value was logged...


see attached (bpnot.png)

Why on earth is this statistic updating erratically like this? It seems to increment by 1 for a few races, then suddenly it starts doubling in size?

I don't seem to have this issue with any of my other statistics.

My TitleID : 67909

ggru5.png (12.1 KiB)
bpnot.png (32.0 KiB)
10 |1200

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

Gosen Gao avatar image
Gosen Gao answered

Could you please navigate to [Game Manager]->[Leaderboards]->[CareerRacesWon]->[Edit Leaderboard] and check if the Aggregation method is set to Sum? In your case, it can be set to Last.


image0.png (14.4 KiB)
10 |1200

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

Greg Quinn avatar image
Greg Quinn answered

@Gosen Gao Thank you, it was set on SUM, I must have tinkered around with this a long time ago because I completely forgot about it.

Thanks!


leaderboard.jpg (54.0 KiB)
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.