How to connect Dedicated Server instance with Nakama Match Instance

I am building a multiplayer game using unreal engine.

  • The game has a client where players sign in to the game with nakama.
  • Than they join matchmaking using nakama.
  • When the nakama match is created the nakama match communicates with Agones to allocate a game server.
  • Once the game server is ready the nakama match than broadcasts the ip and port of the game server to the presences in the match.

In the scenario above the communication between the game client and the nakama match instance is handled by the nakama sdk.
But my understanding is (correct me if I am wrong) such functionality does not exist for the game server and the game server can not use the nakama sdk to comunicate with nakama (server to server).

I want the game server to be able to communicate with the nakama match instance for the following:

1- The game server should be able to call rpc functions on the match it is associated with to relay important information and events such as who won and lost so the match can than grant winners prizes
2- The game server should be able to validate that the players connecting to it are part of the nakama match associated with it.

I should be able to pass the match id as command line variable to the game server (but I would appreciate suggestions)

But I don’t know what to do after as I don’t know how to call rpc functions on a specific match without using nakama sdks. How can this be achieved?

EDIT: I read that the nakama match should be removed once the players are connected to the dedicated server and that is ok by me. But it is important that I can somehow validate that the players connecting to the game server are the presences in the match so at the end of the game when using server to server rpc call I grant the correct users the rewards etc.

Hello @alireza,

This seems like a good candidate for a new feature that was recently introduced in Nakama: fleet manager support.

You can see an example of its implementation here (for Amazon GameLift): GitHub - heroiclabs/nakama-gamelift: Nakama Fleet Manager and AWS GameLift adapter. .

It would be great if the OSS community would like to contribute to the implementation of the interface for Agones too.

Otherwise, you can communicate with a match using the Signal API: Function Reference - Heroic Labs Documentation .

This runtime function can be exposed as a S2S call and will allow you for a match to respond to arbitrary inputs. You must implement the input handling logic in the dedicated MatchSignal match handler.

Hope this helps.