Sign In Register

How can we help you today?

Start a new topic

How to List Turn-based challenges and categorise by "my turn" and "their turn"

Hi guys,


So the response of ListChallengeRequest is something like this:


{
 "@class": ".ListChallengeResponse",
 "challengeInstances": [
  {
   "accepted": [
    {
     "externalIds": {},
     "id": "5805443a4d6a8d056d1e1264",
     "name": "felipe"
    },
    {
     "externalIds": {},
     "id": "58054401b6a70d056d0957e5",
     "name": "gemma"
    }
   ],
   "challengeId": "58491f1497f5340569a00a25",
   "challengeName": "Turn-based Challenge",
   "challenged": [
    {
     "externalIds": {},
     "id": "58054401b6a70d056d0957e5",
     "name": "gemma"
    }
   ],
   "challenger": {
    "externalIds": {},
    "id": "5805443a4d6a8d056d1e1264",
    "name": "felipe"
   },
   "endDate": "2016-12-09T08:51Z",
   "nextPlayer": "5805443a4d6a8d056d1e1264",
   "scriptData": {},
   "shortCode": "CHALL",
   "startDate": "2016-12-08T08:51Z",
   "state": "RUNNING",
   "turnCount": {
    "5805443a4d6a8d056d1e1264": 0,
    "58054401b6a70d056d0957e5": 0
   }
  }
 ]
}


What I then need to know is who's turn is now who's turn is now. The "turnCount" data item doesn't get incremented with any additional information when player's take their turns (and one of the GameSparks guys has confirmed that this is yet to be developed).


So how can I know that information?


I have two lists in my game, one for "My Turn" and where the player can tap and play his turn and the other "their turn" to display purpose only.


1 person has this question

You can use nextPlayer to determine who's turn is now. 


Something like this:

myTurn = nextPlayer  == myPlayerId


1 person likes this

Additionally, I was wondered why the turnCount data does not get updated as it never changes for me as well

@Jaayden Halko I was informed by the GameSparks people that this is indeed a functionality that is not working presently .

The turnCount data does not get incremented as the turns are taken, which is quite sad as it would've made my development a bit easier.

They said that they were going to suggest for their dev team to have this organised.


I had to develop a workaround by setting a turn count field to the challenge data and increment it every time someone takes turns.


Cheers

Login to post a comment