Sign In Register

How can we help you today?

Start a new topic
Answered

Setting up Initial Game State

In many games new players copy down a new game state on startup e.g. the initial base in Clash of Clans. It's possible to do this in GameSparks using GetDownloadableRequest() and the game state can then be written back to the server by the client for the individual player.


Is there a way to do this in Cloud Code? i.e. to copy the initial map state directly to the player's game state to avoid the download and then re-upload of the same data?


Best Answer

Hi Rajan,


Yes you could achieve this by having your players check if new data is available on login. In cloud code under “AuthenticationResponse” you could do a quick check the to see if a new piece of dlc has been uploaded and if the player doesn’t have it, run a GetDownloadableRequest to retrieve it. Alternatively if your map is not a file and just attributes that are stored in a document in a collection, you could check this against the current players collection and slot it in on login if needed.


Thanks,

Liam 

1 Comment

Answer

Hi Rajan,


Yes you could achieve this by having your players check if new data is available on login. In cloud code under “AuthenticationResponse” you could do a quick check the to see if a new piece of dlc has been uploaded and if the player doesn’t have it, run a GetDownloadableRequest to retrieve it. Alternatively if your map is not a file and just attributes that are stored in a document in a collection, you could check this against the current players collection and slot it in on login if needed.


Thanks,

Liam 

Login to post a comment