Hello. We have a number of challenges each with a max number of player limited to 4. We would like to find one random challenge that has no more than 2 existing players (so as to leave one spot open after joining). What is the best way to do that?
Best Answer
C
Customer Support
said
over 7 years ago
Hi Hamlet,
As the first user issuing a CreateChallengeRequest to create the challenge itself, the second player to join will be using a JoinChallengeRequest. When the challenge receives its first join request, you could check in cloud code for JoinChallengeRequest to see if its the first one, if it is it the challenge will now have have two users, at this point you could move this challenge into a randomPublicChallenge collection which you could use pick from randomly in your game.
Thanks,
Liam
1 Comment
Customer Support
said
over 7 years ago
Answer
Hi Hamlet,
As the first user issuing a CreateChallengeRequest to create the challenge itself, the second player to join will be using a JoinChallengeRequest. When the challenge receives its first join request, you could check in cloud code for JoinChallengeRequest to see if its the first one, if it is it the challenge will now have have two users, at this point you could move this challenge into a randomPublicChallenge collection which you could use pick from randomly in your game.
Hamlet Archer
Hello. We have a number of challenges each with a max number of player limited to 4. We would like to find one random challenge that has no more than 2 existing players (so as to leave one spot open after joining). What is the best way to do that?
Hi Hamlet,
As the first user issuing a CreateChallengeRequest to create the challenge itself, the second player to join will be using a JoinChallengeRequest. When the challenge receives its first join request, you could check in cloud code for JoinChallengeRequest to see if its the first one, if it is it the challenge will now have have two users, at this point you could move this challenge into a randomPublicChallenge collection which you could use pick from randomly in your game.
Thanks,
Liam
Customer Support
Hi Hamlet,
As the first user issuing a CreateChallengeRequest to create the challenge itself, the second player to join will be using a JoinChallengeRequest. When the challenge receives its first join request, you could check in cloud code for JoinChallengeRequest to see if its the first one, if it is it the challenge will now have have two users, at this point you could move this challenge into a randomPublicChallenge collection which you could use pick from randomly in your game.
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