Hi! We are developing a turn-based mechanics in which player can create a challenge, then server code finds him an opponent and add opponent to created challenge.
How GameSparks decides which player make first turn?
Our game needs this gameflow:
1. First player creates a challenge
1.1 GS finds him an opponent and joins op to challenge
1.2 First player makes his first turn - this step is important
2. Second player get a notification about challenge and his turn
etc
Thanks in advance!
Best Answer
T
Tech Support
said
almost 8 years ago
Hi Aleksey
When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid.
For turn based challenges, the first player cannot make their turn unless the other player has accepted. To get around this you can store some data against the challenge that you can use for posting the player turn, but it's not very elegant.
anu update about this? I can't make challenger start first =.=
J
Jaayden Halko
said
about 6 years ago
2 years ago there was this comment,
"When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid."
Is this still the case after even 2 years? What I am trying to do is have the challenger make a challenge and make the first move, then the chalengee autoaccepts the challenge. If they dont actually want to play in the challenge they cant resign from it or ignore it.
1 person likes this
s
some 001
said
over 6 years ago
How can I prevent a player from requesting "LogChallengeEvent" when it's not his turn.
Normally I'd implement :
if (Spark.getPlayer().getPlayerId() === Spark.getChallenge(Spark.getData().challengeInstanceId).nextPlayer) {
// do sth...
} else {
// warn for playing outside of his turn, or just do nothing..
}
but unfortunately the Challenge object does not have a "nextPlayer" field here, how do I access the current player of a challenge in a LogChallengeEventRequest ?
do I even need to do this kind of check?
V
Vince Jewlal
said
over 6 years ago
+1
R
Rich Joslin
said
about 7 years ago
Is it still the case that when a turn-based challenge is created and accepted, that the player who goes first is randomly selected? That's what I want, but it looks like it might not be that way anymore. Please let me know, and I can write my own coin toss if needed. I would rather use the built-in coin toss if possible, so that I don't have to skip either players' turns (I would like the turn count to be accurate). Thanks!
A
Aleksey Antonov
said
almost 8 years ago
Thanks Gabriel, we just make a "silent" turn if
challenge.nextPlayer
is not a creator for now.
Tech Support
said
almost 8 years ago
Answer
Hi Aleksey
When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid.
For turn based challenges, the first player cannot make their turn unless the other player has accepted. To get around this you can store some data against the challenge that you can use for posting the player turn, but it's not very elegant.
Gabriel
A
Aleksey Antonov
said
almost 8 years ago
Current challenge setup - https://dl.dropboxusercontent.com/spa/8f9wwsl2k101mgg/k9zt8hdq.png
Aleksey Antonov
Hi! We are developing a turn-based mechanics in which player can create a challenge, then server code finds him an opponent and add opponent to created challenge.
How GameSparks decides which player make first turn?
Our game needs this gameflow:
1. First player creates a challenge
1.1 GS finds him an opponent and joins op to challenge
1.2 First player makes his first turn - this step is important
2. Second player get a notification about challenge and his turn
etc
Thanks in advance!
Hi Aleksey
When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid.
For turn based challenges, the first player cannot make their turn unless the other player has accepted. To get around this you can store some data against the challenge that you can use for posting the player turn, but it's not very elegant.
Gabriel
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstTien Hung
anu update about this? I can't make challenger start first =.=
Jaayden Halko
2 years ago there was this comment,
"When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid."
Is this still the case after even 2 years? What I am trying to do is have the challenger make a challenge and make the first move, then the chalengee autoaccepts the challenge. If they dont actually want to play in the challenge they cant resign from it or ignore it.
1 person likes this
some 001
How can I prevent a player from requesting "LogChallengeEvent" when it's not his turn.
Normally I'd implement :
but unfortunately the Challenge object does not have a "nextPlayer" field here, how do I access the current player of a challenge in a LogChallengeEventRequest ?
do I even need to do this kind of check?
Vince Jewlal
+1
Rich Joslin
Is it still the case that when a turn-based challenge is created and accepted, that the player who goes first is randomly selected? That's what I want, but it looks like it might not be that way anymore. Please let me know, and I can write my own coin toss if needed. I would rather use the built-in coin toss if possible, so that I don't have to skip either players' turns (I would like the turn count to be accurate). Thanks!
Aleksey Antonov
Thanks Gabriel, we just make a "silent" turn if
is not a creator for now.
Tech Support
Hi Aleksey
When the challenge starts we select a random first player. There is currently no way to override this behaviour I'm afraid.
For turn based challenges, the first player cannot make their turn unless the other player has accepted. To get around this you can store some data against the challenge that you can use for posting the player turn, but it's not very elegant.
Gabriel
Aleksey Antonov
Current challenge setup - https://dl.dropboxusercontent.com/spa/8f9wwsl2k101mgg/k9zt8hdq.png
Challenge event settings - https://dl.dropboxusercontent.com/spa/8f9wwsl2k101mgg/5matl2hi.png
-
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