I'm currently creating a game where you can challenge your steam friends.
1) I check which friends are ingame
2) I challenge my friend for a match
3) He accepts the challenge - the match starts
It seems to me that GS Challenges are the right way to do this. However I'm struggeling a bit to understand how I can deal with an exceptional case:
What happens, if the player leaves unexpectedly, without withdrawing his challenge, e.g. by timeout. Will his challenge be removed?
I can of course set a specific expiry date but still the challenge will be listed for the other player. What happens if he joins the challenge then?
If a player fails to partake in a challenge either by disconnecting from the game or failing to take a turn, you can utilize the SparkChallenge Api along with a scheduled process or mechanism to end that challenge. You can find the api documented here.
You will require a mechanism which will execute your spark challenge api requests. This would likely be in the form of a spark scheduler. Which you can find documented here.
At a high level, one implementation could take the form of defining a sensible offset within which turns must be taken ().when taken the scheduler is cancelled. Outside of which the scheduler will kick in and draw, or win the challenge .
Best Regards, Patrick.