Everything but the 997.000m is pretty self explanatory, but what does the 997.000m mean?
,
Everything except the 997.000m is pretty self explanatory, but what does the 997.000m mean?
Everything but the 997.000m is pretty self explanatory, but what does the 997.000m mean?
,
Everything except the 997.000m is pretty self explanatory, but what does the 997.000m mean?
@kwinegardner, I double checked with a few folks today and it turns out I gave you a bad answer. I confused the chart you posted with the execution time chart. On this one, the 997 is actually thousandths of an execution. I know that is confusing and I've got a bug filed on the team to make it more clear. The reason it's not just one has to do with how numbers get averaged over time for that chart.
You'll want to look at the chart to the left of that one to figure out the average run time of the function.
<deleted because I was wrong>
That's what I was afraid of... is there a more efficient way to update stats other than using the public API to GetPlayerStatistics (all)? I'm highly concerned that such a simple script took almost a second to execute. Any ideas how else I can bring this down to something reasonable? One second execution time for this is far far from a scalable option.
Potentially, though it depends on what you're actually doing. The main way to update stats from cloud script is via UpdatePlayerStatistics. That can update as many statistics as you'd like in a single call. If you'd like some help optimizing, can you share your cloud script code?
Sure. I have pasted my code below. It is a function triggered by the occurrence of an analytic event. When I mentioned the use of GetPlayerStatistics, I was referring to the need to get them all when I just need one stat's current value in order to increment (update) it. A bit about this code, it's just a POC at this point. What we are aiming to do is increment several different values for a player upon completion of some criteria. You could think of it as maintaining all of a player's experience or grade in a particular subject.
// Function that is called from action rule for the PlayStream custom event player_completed_lesson. // Updates the player's statistic for number of lessons completed -- LessonsCompleted handlers.handlePlayerCompletedLesson = function (args, context) { // The event that triggered the action var psEvent = context.playStreamEvent; var playerStats = server.GetPlayerStatistics({ PlayFabId: currentPlayerId }).Statistics; var lessonsCompleted = 0; for (var i = 0; i < playerStats.length; i++) { if (playerStats[i].StatisticName === "LessonsCompleted") { lessonsCompleted = playerStats[i].Value; break; } } lessonsCompleted += 1; var request = { PlayFabId: currentPlayerId, Statistics: [{ StatisticName: "LessonsCompleted", Value: lessonsCompleted }] }; server.UpdatePlayerStatistics(request); log.debug("Updated LessonsCompleted stat for player " + currentPlayerId + " to " + lessonsCompleted); };
2 People are following this question.