How could we could implement server authoritative matchmaking with bots?

Hi dear Nakama team.
For our game(s) we are looking for a way to enable players to play an authoritative game even when there are no other players in a matchmaker (with a bot).

How would I implement this as a fallback during matchmaking?

Hey @matthiasbruns :wave:

For our game(s) we are looking for a way to enable players to play an authoritative game even when there are no other players in a matchmaker (with a bot).

The authoritative game you want to build; does it use the authoritative multiplayer engine in Nakama for your game logic? If so I would suggest you create the bot logic as part of the match loop.

How would I implement this as a fallback during matchmaking?

It depends on how you matchmake at the moment. Is it with match listings to find a match to join or the matchmaker to find a set of opponents to play against?

Yes, that was the plan :slight_smile:

Currently we only implemented socket matchmaking as explained here Matchmaker - Heroic Labs Documentation

@matthiasbruns Sorry for the late reply. I think for your use case you can just wait until matchmaking fails (because you’ve created a timeout within which it must complete) and then use an RPC function to create a match handler which has bots enabled. This way the player joins the match handler like they would as a regular player against other opponents it’s just the opponents are AI controlled and send messages back to the player.

For an example of using an RPC function to create a match handler and pass arguments into it as part of its MatchInit phase. Have a look at this code example:

nakama-project-template/match_rpc.ts at master · heroiclabs/nakama-project-template · GitHub

Hope this helps.