Persistent key-value storage per user and global
I think that there should be a way for game to store any data on a per-user or global basis. Currently we can only store leaderboards. This is nice, but is not enough. For example in my case I would like to store a personal settings of a user, which are very specific for a game.
Such as a spellbook for a RPG-like game, where user can configure which spells he wants to use and how. These configurations should be preserved between his logins in the game, otherwise it would be very inconvenient to reconfigure that each time. Note that those "spells" are implementation specific, I don't believe that it's possible (and meaningful) to have a specific API for each kind of data we'd like to store, like it was done for leaderboards.
I see this API as the following:
1. global method GetStorage, which returns Storage, which we then use like that:
GetStorage():Set("key", { somedata = "whatever" , anothervalue = "thevalue" } )
and also Get:
GetStorage():Get("key")
2. per-user method GetStorage, also returns Storage , but specific for a user:
local user = ...
user:GetStorage():Set("key", { somedata = "whatever" , anothervalue = "thevalue" } )
and also Get:
user:GetStorage():Get("key")
As you see - key here is a string and value is a Lua table.
Please sign in to leave a comment.
Comments
0 comments