Add ability to abandon a match


#1

Hi,

I’m not sure if there is a way to do this or not but so far I haven’t been able to find one.

I want to be able to abandon a match. As in a match has been created but it has not yet been started. I want to be able to delete that match. Is there a way to do this?

There are two use cases for this:

  1. A player starts a new game and is waiting for an opponent to join, decides they no longer want to play and wants to delete their game in the waiting list. (I can understand why this may be an issue and is of less importance than the next use case).

  2. A game is created and has two players in it and is ‘READY’ to play. But one player doesn’t want to play so they want to abandon the match, effectively completing it but without a result.

The reason I want to be able to do case 2) is if player1 challenges player2 to a rematch. A match is created with both players in it and it’s set to ‘READY’ but then player2 decides to decline the rematch.

Do you recommend a better way to accomplish this?

Also an extra note: UpdateMatch could be used for this but currently does not let you complete a match when in the ready state so I can’t use that. But in practice UpdateMatch doesn’t actually work at all because you cannot set the Completed flag as it’s a privately set property which is a bug i think. Edit: this is only a problem on the client, in cloud script it works as expected.


#2

I’ve implemented an abandon match cloud script that pushes the match from state to state until it’s in the ‘COMPLETED’ state.

This works but I might run into issues later on when I want to listen for completed games and award something for the winning player.

Maybe a better solution is to have some local list of matchIds that have been abandoned and simply not show them to the player, leaving them to timeout on the server. Then if a match goes from READY -> TIMEOUT I can just assume the challenge was declined by the second player. The down side is the first player will have that match in their list until it times out. but that could be used to stop them from making another challenge to the same player over and over, which might be a good thing.


#3

Hi Antony

Thanks for your feedback using the AsyncMultiplayer API. The intention behind the way it is currently was that a player may and probably would have multiple matches underway or waiting at any one time, therefore abandoning matches would not be too much of an issue.

Some ideas for your use cases;

  1. A value could be added to the Match StateData that the display in the waiting list could use to decide whether or not to display the match. The StateData can be updated by the UpdateMatch call.
  2. I think your script is a good idea. If the StateData had an abandoned flag it could use this to detect also whether or not to issue rewards upon completion.

I have added your feedback to our product backlog for discussion with the team and will take it from there.

As regards the UpdateMatch bug you encountered, are you using the SDK, and which version? Looking at what I have in front of me in the current Unity SDK, UpdatedMatchData Completed property is public.

Richard


#4

I installed the ChilliConnectSDK_Unity_v2.12.0.unitypackage

----Edit----

Oh I see where I went wrong. It’s working as expected. I needed to create a new UpdatedMatchData object from an UpdatedMatchDataDesc object.

And just to give you a little more information on why I want to be able to abandon a match. I’ve implemented challenges by creating a match with both players already added. The match is in the ‘READY’ state. I detect this case and assume it’s a challenge. The second player can then accept or decline the challenge which results in a started match or an abandoned match. This allows we to implement challenges without needing to implement a message system to send match requests between users, saving me API calls.

It’s not a big saving on API calls I’m aware. But it also saves me from calling GetMessages and GetMessage to read those challenge requests. At the moment I have no other use for the message system so I’m not keep on implementing it yet. When I have another case to use it I may restructure my challenges to use messages instead.


#5

I had a thought, It might be sufficient to let us force a timeout. Abandoning a match is almost the same behaviour as timeout.

If match has started and it gets abandoned then that’s the same as a player not taking a turn and essentially forfeiting the match.

If a match has not started yet and gets abandoned then this is the same as a match timing out before it starts. No winner should he set as the match never started.


#6

Thanks again Antony, I’ve added these extra bits for our discussion.