List of the Cloud APIs
The coherence Cloud API allows us to access online services like game accounts, key-value store, matchmaking, and others. It also allows you to get the addresses (IP and port number) of the servers the players can connect to.
The Cloud API requires you to use tokens connected to your coherence project.
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 Runtime Key that can be obtained from the settings.
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 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.
The token you get when creating a project on the developer portal.
You paste it in the Project Settings.
Once you have pasted the portal token successfully, you need to fetch the runtime key as well.
You can fetch the Runtime Key by clicking on the down-arrow button on the right side of the input field.