I am working on a game, where a match can last up to 2 days and the player does not have to be online all the time. It is turn-based of course. How do I get a list of all running matches for a specific user, when logging in to the game, as it is possible to have more games running at a time. And is there a way to get those running matches visible in the developer console?
@Jules Matches are tracked on the server and those which are authoritative do not need to have players active within them to be kept around. You have full control on how the lifecycle of the match is managed though you should be careful that you clean up matches because otherwise any bad logic you might have could leave them as zombie processes.
How do I get a list of all running matches for a specific user, when logging in to the game, as it is possible to have more games running at a time.
Players don’t belong to matches unless they’re in them. You can manage this state yourself with a storage object for the user which contains the match IDs they were last active in and how long ago since they’ve left it. It would be quite easy to do.
Alternatively you could have the matches themselves keep track of this information and expose it through their match label so it can be searched.
To list authoritative matches have a look at the docs here:
And is there a way to get those running matches visible in the developer console?
This has been asked a few times but right now there’s no way to peek inside the internals of a match handler because the state they store can be any struct that’s specific to your game structure. You can see a count of authoritative matches that are active on the status view of the dashboard.
I guess we could add a new function to the match handler interface that would require you to implement a string representation of the data. I’d need to think more on the implications of this to the current design.
thank you…is it possible for a player to be part of more than one match at the same time?
@Jules Yes. A player can play as many matches as you want. From a single socket or from multiple sockets on different game devices. You can restrict the presence counts for a player too if needed to prevent concurrent play sessions. There’s a lot of flexibility to fit whatever game design you want.