Sign In Register

How can we help you today?

Start a new topic

Invite friend to play with challenges


I am implementing a 'play with friends' system, in which a player can invite others through a challenge and they can accept or refuse.

flow is as follows:

1) a player can invite up to 3 friends (the game is for 4 players -  2vs2)

--  player starts a private challenge with the IDs of the others

2) each of the invited player may accept or refuse the invite, with an X-seconds timeout

-- they accept or decline the challenge. the timeout is managed by the clients

3) when everyone responds, I will start matchmaking with the players who accepted to find other players (we need 4 people (or bots) to start) (if timeout, who didn't respond automatically decline)

4) I want each player to be able to cancel at an point (even after they accept)


1) can the challenger can withdraw the challenge after some but not all the other players have accepted?

2) can the other players leave the challenge after they accept (but before it starts)?

3) can the timeout also be specified in the challenge? start/end/expiry times are specified with a 1-minute resolution in the tutorials, but I need the seconds

4) in general, what is the lifecycle of a private challenge with more than 2 players? (i.e. multiple challenged)

1 person has this question

Hi Mauro

Thank you for the detailed flow.

We have assigned an agent to look into this and find the best solution for you as well as answer your questions




any update on this?


Hi Mauro

1) As long as the challenge is in the ISSUED state it can be withdrawn. It will remain in this state until the starting conditions have been satisfied.

2) No, there is no request to remove them at this point. They could however be removed with a custom logEvent using the removePlayer call from SparkChallenge.

3) You can only set this to the minute I'm afraid.

4) Can you clarify what you mean by the life cycle here ? 




1) what are exactly the starting conditions? when I manually call startChallenge() from cloud code? when all of the challenged players accept (or refuse)? when any one of them accepts? the start time (which I don't set)?

-- what I am doing now is, in the cloud code for both accept and decline challenge, I check if all have responded and call startChallenge(). then in the ChallengeStartedMessage cloud code, I create a pending match with all involved players and my custom data&query

2) ok so I will create a custom event that removes the player from the challenge (if it has not started) and cancels matchmaking (if the challenge started).

3) ok, I am already writing client code to handle the timeout, sending a WithdrawChallengeRequest. if I set the expiry/end time for the challenge to e.g. "now + 15 seconds", will they get rounded correctly? or I have to account for that and manually round them up to the minute?

4) life cycle = all possible states and transitions, and relative messages that may happen.

-- for now I am handling Challenge{Issued|Withdrawn|Accepted|Declined|Started|Expired}Message. did I miss anything?

thanks in advance,



update on my questions:

1) and 3) I did set a high endTime and in my create challenge event I use the scheduler to withdraw the challenge after 15 seconds if still open. challenge starts manually if >= 2 players accepted

2) i call a custom event that removes the player, cancel matchmaking and send a custom message to the other players

4) I am still waiting for an official confirmation that I handled all possible messages. with my tests I only received the ones listed but I can't know for sure I missed something

Login to post a comment