im trying to do a turn based game and i want the player who sends the challenge to play first. however sometimes the player who sends the challenge plays first and sometimes the player who gets challenged plays first. Is it my fault or is it random who gets to plays first?
Best Answer
C
Customer Support
said
almost 7 years ago
Hey Nikos,
The challenges are asynchronous, so whichever player submits first starts off the challenge. What you probably want to do is make sure that when the challenger calls the CreateChallengeRequest (like, if you have a popup dialogue where you choose the challenger or something like that), you immediately after the request has come back, submit the challengers score. Therefore, the challenger will always be the first person to play.
The challenges are asynchronous, so whichever player submits first starts off the challenge. What you probably want to do is make sure that when the challenger calls the CreateChallengeRequest (like, if you have a popup dialogue where you choose the challenger or something like that), you immediately after the request has come back, submit the challengers score. Therefore, the challenger will always be the first person to play.
Hope that helps,
-Sean
S
Selcan Guner
said
almost 6 years ago
Is this still the case that which player starts first is selected randomly?
1 person likes this
J
Jaayden Halko
said
over 5 years ago
I have been using the following code in the ChallengeStartedMessage to see which players turn it is
var nextPlayer = Spark.getData().challenge.nextPlayer;
and it definitely seems like it is still random as this has resulted in different players
I am looking for a way to set the player who takes the first turn in a challenge
J
Jaayden Halko
said
over 5 years ago
Any Ideas how to set which player makes the first move instead of it being random?
Customer Support
said
over 5 years ago
Hi Jaayden,
You'll have to use SparkChallenges consumeTurn call in Cloud Code if the nextPlayer is not the one you want.
Nikos Papachristou
im trying to do a turn based game and i want the player who sends the challenge to play first. however sometimes the player who sends the challenge plays first and sometimes the player who gets challenged plays first. Is it my fault or is it random who gets to plays first?
Hey Nikos,
The challenges are asynchronous, so whichever player submits first starts off the challenge. What you probably want to do is make sure that when the challenger calls the CreateChallengeRequest (like, if you have a popup dialogue where you choose the challenger or something like that), you immediately after the request has come back, submit the challengers score. Therefore, the challenger will always be the first person to play.
Hope that helps,
-Sean
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hey Nikos,
The challenges are asynchronous, so whichever player submits first starts off the challenge. What you probably want to do is make sure that when the challenger calls the CreateChallengeRequest (like, if you have a popup dialogue where you choose the challenger or something like that), you immediately after the request has come back, submit the challengers score. Therefore, the challenger will always be the first person to play.
Hope that helps,
-Sean
Selcan Guner
Is this still the case that which player starts first is selected randomly?
1 person likes this
Jaayden Halko
I have been using the following code in the ChallengeStartedMessage to see which players turn it is
var nextPlayer = Spark.getData().challenge.nextPlayer;
and it definitely seems like it is still random as this has resulted in different players
I am looking for a way to set the player who takes the first turn in a challenge
Jaayden Halko
Any Ideas how to set which player makes the first move instead of it being random?
Customer Support
Hi Jaayden,
You'll have to use SparkChallenges consumeTurn call in Cloud Code if the nextPlayer is not the one you want.
Thanks,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics