Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Efficient Way To Save Scores On Cloud

Discussion in 'General Discussion' started by xjjon, May 10, 2021.

  1. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    591
    I want to store player high scores for each level and then use that data to give feedback on how they compare to other players.

    For example, you finish a level and get 100 points. It can tell you that you scored higher than 90% of all players. (Doesn't have to be real time, so can be precomputed)

    What's the most efficient way to do this? (cost)

    The percentiles can be precomputed a couple times per week and stored in storage.

    What about the storage? Simple way would be to store each of the players scores in a table [playerId, highScore] and then the offline job can calculate the precomputed values. The only time a 'write' operation would be needed is when a player breaks their previous highscore. No reads should be needed (store their own score locally).

    Are there better approaches? Maybe a cloud service that provides this already built?

    I already store all player progress data (json) on playfab. but that is not easily or query-able for a low cost.

    Thanks for any suggestions
     
  2. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,797
    Check out PlayFab.
     
  3. BenniKo

    BenniKo

    Joined:
    Mar 24, 2015
    Posts:
    100
    If you know php and mysql you can easily build your own solution.
    I am pretty sure that will be the most cost-efficient way.
     
  4. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    591
    Yeah we are using playfab already. Currently store them in the player data objects but those are not queryable. It seems the solution with playfab would be to capture playfab events emitted for a highscore. That stores all the raw events but still need to be exported to some external source before it can be de-duped and processed.

    It seems this is much more expensive than just writing data into your own managed table on aws/azure and then make a lambda to process it. It would be nice if you could just create this all in playfab and have them manage it, the price premium would be worth it but I don't think it is 100% possible on their platform.

    Yeah it seems to be the case. This is the route we have experimented with so far but just seeing if there are any alternatives so we can avoid adding 2 more external dependencies (cloud db + cloud compute)

    Thanks