Sign In Register

How can we help you today?

Start a new topic
Answered

Ending a match

I've got a game that uses a similar structure to the Hearthstone tutorial example - though it also uses a real time script.


My problem at the moment is that when the challenge is "won" the match & pending match instances still exist so when the player goes back to the lobby then starts matchmaking again the matchmaker gives that player the same match they were just participating in. I've found the player has to logout then back in to be able to search for a new game again.


When the challenge is finished, how do I also "finish" the match instance?


Also, just in case I have something wrong with my matchmaking code - after successfully matchmaking, should I have a pending match AND a match instance or should the pending match disappear as soon as the match is made?


Best Answer

Hi Andy,


Apologies for the delayed response. Once all the players drop out of the match the match will end. As long as one player is still in it the match will exist. If it's drop in/drop out then sending a MatchMakingRequest with the action set to "cancel" the player should be fully removed from it. Example below.


 

//to join
{
  "@class": ".MatchmakingRequest",
  "matchGroup": "myMatchGroup",
  "matchShortCode": "myMatch",
  "skill": 5
}

//to leave

{
  "@class": ".MatchmakingRequest",
  "action": "cancel",
  "matchGroup": "myMatchGroup",
  "matchShortCode": "myMatch",
  "skill": 5
}

 

Try that and let us know if you have any further questions.


Regards,

Liam


Anyone able to help me here? I'm currently trying to get around this by logging the user out then back in to purge the match but that doesn't seem ideal.


Is there no easy way to say to GameSparks "this match is over, please remove it so the player can look for a new one"?

Bump

Hmm I may have found the issue - I'd assumed "drop in/out" meant that players could rejoin if they disconnect but I think I've realised it means that if player 1 and player 2 are matched, then player 2 disconnects, player 3 can join in to the match... So in that case it'd make sense for the match to stick around after one player leaves. I think turning drop in/out off will solve the problem, will try now :)

Answer

Hi Andy,


Apologies for the delayed response. Once all the players drop out of the match the match will end. As long as one player is still in it the match will exist. If it's drop in/drop out then sending a MatchMakingRequest with the action set to "cancel" the player should be fully removed from it. Example below.


 

//to join
{
  "@class": ".MatchmakingRequest",
  "matchGroup": "myMatchGroup",
  "matchShortCode": "myMatch",
  "skill": 5
}

//to leave

{
  "@class": ".MatchmakingRequest",
  "action": "cancel",
  "matchGroup": "myMatchGroup",
  "matchShortCode": "myMatch",
  "skill": 5
}

 

Try that and let us know if you have any further questions.


Regards,

Liam

Hi Liam. Thanks for your answer. I did eventually figure out that drop in/out was the cause of the issue in my case, I've switched that off and it's working as expected now.


But that's good to know about the "cancel" action for matchmaking. I wasn't aware of that request, so I'll keep that in mind also :)

Is there a comand  in cloud code to cancel the certain match?

Is there  a way to get current match id in MatchmakingRequest cloud code?

Login to post a comment