I need to implement a very basic challenge that runs as follows:
1. Player A issues a challenge to Player B
2. If Player B responds to the challenge within 30 seconds he immediately wins the challenge.
3. If Player B fails to respond within 30 seconds Player A wins the challenge.
Step 1 is obviously straight forward. My idea for step 2 is to bind cloud code to the AcceptChallengeRequest and immediately call winChallenge with Player B.
I'm unsure what the best way to go about implementing step 3 is. I am aware that I can set an expiry time when logging a CreateChallengeRequest, but I can't see a way of running cloud code when the challenge expires in order to call winChallenge with Player A. I could probably use the scheduler to log an event after 30 seconds but would rather use a built in challenge mechanic if there is one that fits my needs.
Any suggestions?
Thanks in advance!
Best Answer
C
Customer Support
said
almost 6 years ago
Hi Rob,
The Scheduler is probably the best way to do this alright. You could use the ChallengestartedMessage and ChallengeTurnTakenMessages to create the schedulers and then use the LogChallengeEventRequest for the challenge to cancel it before the timer runs out. If it runs out on a certain players turn you can set the other player as the winner. Does that sound like it would work for you ?
Regards,
Liam
1 Comment
Customer Support
said
almost 6 years ago
Answer
Hi Rob,
The Scheduler is probably the best way to do this alright. You could use the ChallengestartedMessage and ChallengeTurnTakenMessages to create the schedulers and then use the LogChallengeEventRequest for the challenge to cancel it before the timer runs out. If it runs out on a certain players turn you can set the other player as the winner. Does that sound like it would work for you ?
Rob Chandler
I need to implement a very basic challenge that runs as follows:
1. Player A issues a challenge to Player B
2. If Player B responds to the challenge within 30 seconds he immediately wins the challenge.
3. If Player B fails to respond within 30 seconds Player A wins the challenge.
Step 1 is obviously straight forward. My idea for step 2 is to bind cloud code to the AcceptChallengeRequest and immediately call winChallenge with Player B.
I'm unsure what the best way to go about implementing step 3 is. I am aware that I can set an expiry time when logging a CreateChallengeRequest, but I can't see a way of running cloud code when the challenge expires in order to call winChallenge with Player A. I could probably use the scheduler to log an event after 30 seconds but would rather use a built in challenge mechanic if there is one that fits my needs.
Any suggestions?
Thanks in advance!
Hi Rob,
The Scheduler is probably the best way to do this alright. You could use the ChallengestartedMessage and ChallengeTurnTakenMessages to create the schedulers and then use the LogChallengeEventRequest for the challenge to cancel it before the timer runs out. If it runs out on a certain players turn you can set the other player as the winner. Does that sound like it would work for you ?
Regards,
Liam
Customer Support
Hi Rob,
The Scheduler is probably the best way to do this alright. You could use the ChallengestartedMessage and ChallengeTurnTakenMessages to create the schedulers and then use the LogChallengeEventRequest for the challenge to cancel it before the timer runs out. If it runs out on a certain players turn you can set the other player as the winner. Does that sound like it would work for you ?
Regards,
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