What’s the best way to add re-match logic?
My thinking is something like:
- Match players with matchmaking.
- Start match.
- Once the match ends, server allows clients to request a rematch.
- When a client requests a rematch, the request is sent to all other players to display a “player a wants to play again” message.
- If all clients request a rematch, the server creates a match and sends the match IDs to all clients.
- Clients join match, goto 2.
The thing I’m unsure about is how to send data to players outside a match context. Maybe the players can join a stream or group, and the server sends the message to the members?
Do you need to end the match and create a new one? Maybe it would be better to let the match open, give players the rematch option, and only then create another or terminate if no one is interested.
I think you could even do some clean up and reuse the match.
I was considering this, but laziness got the better of me.
I allow player that dropped out to rejoin a match if it’s still active, so I’d have to refactor that part to allow for matches to have an active, but finished, state, which makes things a bit muddy. Might be the best option though, thinking about it.
Thanks for the suggestion, it helped me rethink to find a better solution!