Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Cloud/Data storage?

Hiya

Im wanting to store game/app specific player data for when the player come back and plays again. In particular stuff like preferences and stats. So Im mainly storing numbers and strings.

Is this what cloud storage is for? If so are there any tutorials examples of doing so using Unity and Platform?

Thanks!

-P
Drift VFX Visual, Virtual , Vertical

Want 970GTX on Macbook for good FPS?
https://forums.oculus.com/viewtopic.php?f=26&t=17349

Comments

  • charles.beyercharles.beyer Posts: 33 Oculus Staff
    Cloud storage was designed to holder larger chunks of data, like a game save.  Nothing prevents you from storing smaller things, but then you have to worry about performance and consistency issues.  Consistency meaning, you have to be careful that all values are synchronized between all devices before using them.  So if you can serialize your stats to one structure to save, that would be better.  There is not a good Unity sample yet beyond demonstrating the API calls in Samples/UnitySample/PlatformSample.  There is a native sample that demonstrates all the complexity of cloud storage and conflict resolution in Samples/CloudStorageExample.  Hopefully we can add a more complete Unity sample when Android support is finished.
  • pjennesspjenness Posts: 692
    Neo
    Cloud storage was designed to holder larger chunks of data, like a game save.  Nothing prevents you from storing smaller things, but then you have to worry about performance and consistency issues.  Consistency meaning, you have to be careful that all values are synchronized between all devices before using them.  So if you can serialize your stats to one structure to save, that would be better.  There is not a good Unity sample yet beyond demonstrating the API calls in Samples/UnitySample/PlatformSample.  There is a native sample that demonstrates all the complexity of cloud storage and conflict resolution in Samples/CloudStorageExample.  Hopefully we can add a more complete Unity sample when Android support is finished.

    Hiya

    Where those unity examples for cloud?   IN the Oculus Platform package I only have scripts. AM I missing some demo sample scenes?

    Are there good examples of how Cloud works. I dont need to store a huge amount. Just configuration information for the player, so settings get remembered on next visit (or level change if needed)

    Thanks!!

    -P


    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • pjennesspjenness Posts: 692
    Neo
    edited December 2016
    I just tried updating to 1.10 but still cant find any examples.

    Samples/UnitySample/PlatformSample is very raw and errors i the editor for me...it also doesn't seem to have cloud (unless I'm looking int he wrong place)

    Does cloud save data to the personal user (is userID keyed storage) so that I do not have to specify the user whose data is getting stored?

    So for example if I wanted to save my character info lets say

    For player "pjenness"  ie me, I want to store

    avatarName (string)
    level (int)
    items ["item1",item2","item3"]
    timeSpentPLaying (float)

    How do I store that data with this command

    Oculus.Platform.CloudStorage.Save(bucket_name, key, data_pointer, data_size, counter, extra_data)

    bucket name and key I understand, but not how to use the other parameters


    Oculus.Platform.CloudStorage.Save ("PlayerInfo", "avatarName" , ??  , ??, ??);
    Oculus.Platform.CloudStorage.Save ("PlayerInfo", "level" , ??  , ??, ??);
    Oculus.Platform.CloudStorage.Save ("PlayerInfo", "items" , ??  , ??, ??);
    Oculus.Platform.CloudStorage.Save ("PlayerInfo", "timeSpentPLaying" , ??  , ??, ??);


    Help and examples would be appreciated.

    And also the correct way to read and deal with the requested return values from load

    Cheers

    -P
















    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • pjennesspjenness Posts: 692
    Neo
    OK trying to get a bit further...help would be appreciated:

    I grabe the user and ID
    PlayerID  = m_OVRuser.OculusID;
        }
      }
      private void GetLoggedInUserCallback (Message msg)


    Then later I want to save info
    avatarNameBytes   =     CloudStorage.Load ("PlayerInfo", (PlayerID + "_AvatarName"));
          m_localPlayerAvatarName = System.Text.Encoding.ASCII.GetString (avatarNameBytes);

        }
      }
      void doSaveLocalPlayerInfo ()




    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • dvirdvir Posts: 3
    NerveGear
    @pjenness: Similar to all other asynchronous methods in the SDK, `CloudStorage.Save` and `CloudStorage.Load` are of type `Request<>`. They both have a method called "OnComplete", which takes a delegate (or a callback) to be executed once the request has finished.

    In your example:
    CloudStorage.Load ("PlayerInfo", (PlayerID + "_AvatarName")).OnComplete(delegate(Message<CloudStorageData> message) {
          if (message.IsError) {
            Debug.Error("CloudStorage.Load error: " + message.GetError().Message);
            return;
          }
          m_localPlayerAvatarName = System.Text.Encoding.ASCII.GetString (message.GetCloudStorageData().Data);
      });  
    Note though: the CloudStorage API doesn't work through Unity's Play Mode. You'll have to build and run it as a standalone build (File -> Build and Run).
  • pjennesspjenness Posts: 692
    Neo
    Thank you very much @dvir

    Will give this a go!!

    -P
    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • pjennesspjenness Posts: 692
    Neo
    @dvir

    MANY MANY Thanks..... finally got cloud storage working for Unity!!
    The Docs are very unclear (for those not so familiar with setting it up for first time).

    Really appreciate the help!

    -P





    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • charles.beyercharles.beyer Posts: 33 Oculus Staff
    pjenness, feedback noted.  Sorry, the Unity samples do not yet include a good Cloud Storage example.  Also, the issue with CloudStorage not working with the stand-alone client (Unity Play mode) is unfortunate and something we're hoping to fix as we add Gear VR support.  Thanks @dvir for helping!
  • james_luejames_lue Posts: 20
    Brain Burst
    Hi, I tried v1.25 these days. It seems that CloudStorage in Unity Play mode still doesn't work. Is there any other way to test CloudStorage without actually building the app?
  • motorsepmotorsep Posts: 1,488 Oculus Start Member
    @charles.beyer @imperativity

    I am wondering if there are any news about Cloud Storage support for Gear VR / Go and support being exposed to UE4 Blueprints.
Sign In or Register to comment.