coherence provides an API and a database for storing key-value pairs from within game sessions.
The key-value store provides a simple way to store and retrieve data for the currently logged in player. For example, you could store the player's score, email address, or any other data.
This feature requires a game account.
The keys must be alphanumerical strings, underscore or dash. Currently, only strings are accepted as values. If you need to store numbers or complex types like arrays, you have to convert them to strings.
The total amount of stored data (keys + values) cannot exceed 256 KB per player (TBD).
There is no limit how often the data is stored or retrieved.
Please refer to the Cloud API: Key-value store.
Besides the core Replicator and Simulator, coherence offers additional services to enhance your game's experience and we are constantly working on more.
Currently available services are:
In the Project sidebar, you can find links to each service. Each service has an enabled checkbox which you can tick to enable and disable those features:
Disabling a service will immediately remove that functionality from your game. Please disable with caution.
coherence provides an API for creating player game accounts that uniquely identify players across multiple devices. An account is required in order to use the rest of the online services, like the key-value store and matchmaking.
There are two types of accounts that are currently supported - guest accounts and user accounts.
Guest accounts provide an easy way to start using the coherence online services without providing any user interface for user names or password. Everything is controlled with the API, and is completely transparent to the player.
The session data for the account is stored locally on the device so it is important to know that uninstalling the game will also wipe out all the data and the account will be no longer accessible even if the player installs the game again.
User accounts require explicit authorization by the player. Currently, only user name and password are supported as means for authentication. The user interface for entering the credentials must be provided by the game. Check the API how to use this feature.
In the future, there will be support for many more authentication mechanisms like Steam, Google Play Games, Sign in with Apple, etc.
Please refer to the Cloud API: Game Accounts.
The key-value store provides a simple persistence layer for the players.
The player needs need to be logged in to use the key-value store.
This class provides the methods to set, get and unset key-value pairs. This is executed within the context of the currently logged in player.
Size: there are no limits to the number of stored key/values as long as the total size is less than 256 kB.
Requests: Set/Get/Unset can be called unlimited amount of times but the execution may be throttled.
Creating a player account is the first step towards using the coherence Cloud API. It is required in order to use the rest of the services.
To initialize the Cloud API you need to provide a that can be obtained from the .
The easiest way to get started is by using a guest account. The only thing that is needed is to call LoginAsGuest
. This will create a random username / password combination and will authenticate the player with the coherence Cloud.
Once logged in, the credentials are securely persisted so that if the game is restarted the player will be able to log in automatically.
If the game is uninstalled then the account credentials will be lost and a new guest account will be created next time the game is installed.
Another alternative is to login with a username and a password. You have to provide the user interface.
This example initializes the Cloud API, checks for an existing session and, if no session was found or if it expired, logs in the player as guest.