Nakama Runtime Server

Hello,

I am currently working on an online multiplayer game using Nakama server.
I was able to code the Authentication part, and it shows that it was able to authenticate as a debug user.
Currently I am working on matchmaker and I was able to implement a code to look for a match, and the code seems to be working as it shows a debug message “Attempting to find a match”.
The issue is that the game does not seem to be able to find a match. I have implemented a code to show a debug message when the match was found and it does not show any message.
The code was able to compile with no error but it still does not show any message.

As I was doing some research, I found a page about Nakama Server Runtime.
I have a docker server set up and the game gets authenticated, so I thought I did not have to configure anything on the server side, but do I have to create a custom logic on the server side?

Here is a part of the code in my Gameinstance.cpp related to matchmaking.

void UGameInstance_C::StartMatchmaking()
{
// Add a message indicating the matchmaking attempt.
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT(“Attempting to find a match…”));
}

int32_t minCount = 2;
int32_t maxCount = 2;
FString query = TEXT("*");
TMap<FString, FString> stringProperties;  // Empty map for this example
TMap<FString, int32> numericProperties;   // Empty map for this example
int32_t countMultiple = 2;  // Adjust this if needed
bool ignoreCountMultiple = true;  // Adjust this if needed

if (NakamaRealtimeClient)
{
	UNakamaRealtimeClientAddMatchmaker::AddMatchmaker(NakamaRealtimeClient, minCount, maxCount, query, stringProperties, numericProperties, countMultiple, ignoreCountMultiple);
}
else
{
	// If NakamaRealtimeClient is null, display an error message.
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, TEXT("NakamaRealtimeClient is null!"));
}

}

void UGameInstance_C::OnMatchmakerMatched(const FNakamaMatchmakerMatched& Match)
{
if (GEngine)
{
// Assuming Match.Token is already an FString. If it’s not, you’ll need to convert it.
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, TEXT("Match Found! Match Token: ") + Match.Token);
}

UE_LOG(LogTemp, Warning, TEXT("Matched! Match Token: %s"), *Match.Token);
// If you need to do additional things when a match is found, add them here.

}

Hello @Brurixo,

Since your game is able to authenticate and initiate matchmaking requests, you should not need to create custom server-side logic for matchmaking. The Nakama server should handle the matchmaking process based on the parameters you provide.

Do you have more than 2 tickets added to the matchmaker? If your min_count is set to 2, it will not find a match for a single client.

To help you debug this further, you can add handlers on AddMatchmaker, example from the documentation link:

void ASagiShiActor::OnAddMatchmakerSuccess(FString Ticket)
{
	UE_LOG(LogTemp, Log, TEXT("Successfully joined matchmaker: %s"), *Ticket);
}

void ASagiShiActor::OnAddMatchmakerError(const FNakamaRtError& Error)
{
	UE_LOG(LogTemp, Error, TEXT("Error adding matchmaker: %s"), *Error.Message);
}

Thank you for your reply.
After trying to customizing the code you sent me, it worked.

Thank you very much for your help.