Sign In Register

How can we help you today?

Start a new topic
Answered

Please help witch scripts.

How to execute "cloud code" scripts from ios client. 

I'm totally stuck at this. Or i'm missing something?

For example, i have two player match, i need to send the data from one player to another.

Say, tic-tac-toe game, when one player made a move, i need to update the second one with this move. Really, can't understand how. I'm new to this platform, please help.



Best Answer

Hi Old Scheme,


Sorry for the late reply. This really depends on the platform your intent on building to. We've a list of our supported SDKs here: https://docs.gamesparks.com/sdk-center/

Would you be able to elaborate on your client building platform and hopefully I can point you more in the right direction.


Hope this helps,

 - Steve 


Answer

Hi Old Scheme,


Sorry for the late reply. This really depends on the platform your intent on building to. We've a list of our supported SDKs here: https://docs.gamesparks.com/sdk-center/

Would you be able to elaborate on your client building platform and hopefully I can point you more in the right direction.


Hope this helps,

 - Steve 

Ok, I got it. Can you help me with this please:

I'm sending the logEvent request from iOS app (iOS SDK) to the platform once user taps on "READY" button. 

From cloud code side, I need to catch these two events (2-player game), then do some simple logic, and send a message to the both players. 

Example:

Player-1 sends logEvent with short code "ready".

Player-2 sends logEvent with short code "ready".

----

Cloud code: for event "ready":

if (p1.isReady && p2.isReady ) {

  var msg = Spark.message(100);

   ...

   msg.send();


}


The problem, that this script will be executed two times, per each player.  So, there is no way to check if other player has sent "ready" state for sure. When this script executes for player 1, there is no data from player 2 yet. And vice versa, when script executes for player 2, there may be no data from player 1. So logic fails to execute.

So, here I need some advice from your side.



Ok, i guess i'll not get any support here. 

I'll move to another platform. 

Sorry. 

Hi Old Scheme, 


Apologies, your response seems to have slipped through the net somehow. We'll be happy to get this answered for you. Can you let me know the name of your game and the event in question and I'll take a look at this for you now.


Thanks,

Liam

Hi Old Scheme,


Would it be possible to store the ready state in a runtime collection, this way you can refer to the document in the collection to find the individual player states.


Hope this helps,

 - Steve

Login to post a comment