Authoritative matches: getting the match id

We use the authoritative match framework to create matches using an RPC call, basically like this:

    modulename := "pingpong"
    if matchId, err := nk.MatchCreate(ctx, modulename, params); err != nil {
        return "", err
    } else {
        return matchId, nil
    }

This works fine and the matchId is sent to the player which can then join the match just fine. Other players can also connect as the RPC call checks for existing matches with suitable parameters that are not full and returns a found match id.

But, once we’re in MatchLoop() there is a case where I need the match id of the match in progress. Basically I need to send it to bots so that they can join a match that is not getting enough human players. I can’t seem to find it in any way. There is MatchGet(), but it requires me to know the match id. The match id is not given to MatchInit(), so I can not store it in our match state that gets passed everywhere.

This looks like there is something simple that I’m not seeing? Where do I get the id of the match currently in progress?

The Match ID is available in the context - see: Basics - Heroic Labs Documentation

RUNTIME_CTX_MATCH_ID

That would be it. Thank you!

Works perfectly.