Hello everyone,
I’m making a game using the Authoritative Multiplayer engine to make my game and the time has come to playtest the game.
We don’t always finish the game because we tested what we wanted to test, so the match doesn’t always close.
I want to do an RPC to close every active (or just one) match(es) but i cant figure out how to do it. It seems like the only way to close a match is from inside the match itself.
Isn’t there any way to close a match from an RPC ? I’d like to close a match without having to join it, and enter an opcode to specify to close the match.
(Edit: i use the Go runtime btw)
Matches in Nakama are supposed to be self-contained, and have all the logic to complete their own lifecycle. This sounds to me that you have a match leak - you need to account for scenarios where people would leave the match without calling “LeaveMatch” or other APIs (such as a sudden disconnect).
Your match handler logic should kill the match either immediately or after some period of time (if there are no presences in the match).
One way to solve this is to set timestamp in future as timeout variable in match init and update it on player activity. After every tick update check it and end match if there has been no activity in last 5 minutes for example.
Thank you for your answers,
Some sort of timeout sounds like the best solution.
Topic closed.