Search Unity

Question Load / Compare players Stats via CloudSave (& Economy)

Discussion in 'Cloud Save' started by LewLHere, Nov 28, 2022.

  1. LewLHere

    LewLHere

    Joined:
    Nov 27, 2020
    Posts:
    2
    Hello,

    so I'm just getting started with all Cloud Save, Economy etc...
    my question is, let's assume I can get a Highscore, collect different Items etc. in my game - and store those via Cloud Save or Economy - is there ANY way to compare my progress to other players progression / score that is all in the same Cloud Save of my project?

    One step further would be is there a way to set up Player-To-Player-Ingame-Purchases / Trades? Currently the way Economy is set up we exchange Currency for Items, vice versa or in between the same thing - all on the same player profile.

    Now is there any any way I can access a player ID with any tool or UGS and figure out the score, variables, whatnot from them, e.g. to compete against them, play against an AI using their Deck of Cards that I can load, attack their village that's stored in Cloud Save etc etc... would be an amazing feature, and who knows if it might exists and I'm just not goode nough at understanding Docs.

    TLDR: Have a CloudSaveService.Data.LoadAsync(**playerID**) or something similar - and/or if that exists in some way or form, how to I do that properly?

    Cheers.
     
  2. wakawa2003

    wakawa2003

    Joined:
    Nov 29, 2018
    Posts:
    2
    same here... and watting for admin's answer...
     
  3. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    63
    Hi There,

    For things like getting users high scores or checking player progression, we have a new service currently in a closed beta called leaderboards. This will allow you to batch players together into buckets and give them their own leaderboards to compete in. Your use case in the first example is precisely what leaderboards are intended for. keep an eye out for this landing soon.

    The second example would be a bit more tricky. Currently, the only way to get another playersID is to use lobby where you can create your own custom lobby and code, give the code to another user to join the same lobby as you, and pull their ID from that. You could then use cross-player interaction combining Cloud Code and Economy ( you can find more information on cross-player interaction here.) to handle the offer, acceptance, and processing of economy items.

    If you wanted to load a deck of deck of cards you could use the same process as above but instead of using Economy for the trades you could use Cloud Save. This will allow you to pull particular save data such as a key with a json block determining what cards are being used by that user.

    I will write up some code to help understand this once I have a working example for you.
     
  4. LewLHere

    LewLHere

    Joined:
    Nov 27, 2020
    Posts:
    2
    Thank you, Andy.

    Yes, acessing another PlayerIDs Cloud Save / Economy is exactly what I was after.

    Now looking at the linked cross-player interaction that seems to be the one that we were looking for, being able to store 'otherPlayerID' during e.g. onNetWorkSpawn (? or does that happen after Lobby-Matchmaking and thus not really work ?) and then having the CloudSaveAPI combined with otherPlayerID to get their Scores / Economies / Cards / execute purchases even (?) seems solid for e.g. two players joining a lobby and loading each others Stats saved on their respective Player-Cloud-Save-File.