Recommendation to Read db While Matchmaking a Player

Hi,

So I am making a game and using the lovely matchmaker using one parameter to match the player, CupsCount
players in the same range of CupsCount will be matched. I could make the player submit the query and parameters but I want to avoid cheating (submitting lower CupsCount to match with low experience players)

So I used RegisterBeforeRt hook with Id “MatchmakerAdd” to create the query and assigned the CupsCount

CupsCount is stored in the account metadata so I have to retrieve the user account.
Next the played added to the pool and get matched,

when the player join the match i will retrieve his account to use some data in metadata in the game logic

To avoid reading the player account twice (before adding the pool and when joined the match), Do you recommend me to pass user metadata fetched before adding player the pool to match like below

envelope.GetMatchmakerAdd().StringProperties["user_metadata"] = accountMetadata
matchID, err := nk.MatchCreate(ctx, modulename, entries) // entries contains StringProperties["user_metadata"]

If you’ve already read the user account metadata before placing the user in the matchmaker, and you need that data when the matchmaking process completes, then it’s fine to put it in the user’s matchmaking properties.

As you’ve observed the properties are available in the matchmaking matched hook where you might then create an authoritative match, and it’s perfectly fine to have properties not actively used in matchmaking filters. :+1:

1 Like