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
over 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.
You'll have to use SparkChallenges consumeTurn call in Cloud Code if the nextPlayer is not the one you want.
Thanks,
Liam
J
Jaayden Halko
said
about 6 years ago
Any Ideas how to set which player makes the first move instead of it being random?
J
Jaayden Halko
said
about 6 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
S
Selcan Guner
said
over 6 years ago
Is this still the case that which player starts first is selected randomly?
1 person likes this
Customer Support
said
over 7 years ago
Answer
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.
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 Newest FirstCustomer 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
Jaayden Halko
Any Ideas how to set which player makes the first move instead of it being random?
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
Selcan Guner
Is this still the case that which player starts first is selected randomly?
1 person likes this
Customer 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
-
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