FAQs - Challenges
Can I save custom data on my Challenge?
Yes. You can use scriptData or privateData:
Spark.getChallenge(challengeInstanceId).setScriptData(name, value);
Spark.getChallenge(challengeInstanceId).setPrivateData(name, value);
Can I use Challenges as game lobbies?
Yes. Challenges can also be used as game lobbies, which players join publicly or privately.
Can the game master or challenger or host start a Challenge manually?
Yes. Do not specify a start time for the Challenge and create a log event that the host would invoke and which includes the following Cloud Code:
Spark.getChallenge(challengeInstanceId).startChallenge();
Can players in a Challenge send data to one another?
Yes. Players can use the playerIds referenced in the accepted array to send scriptMessages separately or use the ChatOnChallengeRequest to send a message to all players involved in the Challenge.
Can I remove a player from a Challenge?
Yes. You can use the following Cloud Code:
Spark.getChallenge(challengeInstanceId).removePlayer(playerId);
I understand that there are three types of Challenge. What are these different types?
Yes. There are three types of Challenge, which affects whether or not the Challenge can be listed to other players or joined by them:
- Public. A Public Challenge is listable and can be joined by any player.
- Private. A Private Challenge is joinable by invite only.
- Friends. A Friends Challenge is listable and joinable to a player's friends only.
What is the difference between the start time, the end time, and the expiry time of a Challenge?
- Start Time. The start time defines when a Challenge will be transitioned from a WAITING to a RUNNING state. After this time, players can take turns for the Challenge.
- End Time. The end time defines when a Challenge will be transitioned to a COMPLETED state. After this time, no more turns can be taken for the Challenge.
- Expiry Time. The expiry time defines when a Challenge ceases to be joinable or valid. After this time, the Challenge will no longer be joinable.
For more details, please see the Understanding and Testing Challenges tutorial.
More Information? You can find tutorials for working with and setting up Challenges in the Multiplayer section.