Wondering how to connect more than two clients at a time

What I am trying to achieve is, say I log into one client and they are waiting for a match on the server. If another client does the same, they connect. Ok cool. But what if they are almost ready to join the game, and a third client tries to find the match? Currently I cannot find the match that hasnt started yet after 2 clients and my min is 2 and my max is 4 (defaults). Hope that make sense :stuck_out_tongue:

This is for a Godot Nakama connection with Godot 3.5.3 and Nakama is running 3.20+. I know its likely related to developer coding but Im curious how Nakama is handling the connections on their end if my scripts are actively still searching for the match on a third client. Does Nakama stop allowing matchmaking after two are already connected?

I would LOVE to learn how to change this to match listing instead for gdscript:

func start_matchmaking(_nakama_socket: NakamaSocket, data: Dictionary = {}) -> void:
	leave()
	_set_nakama_socket(_nakama_socket)
	match_mode = MatchMode.MATCHMAKER
	
	if data.has('min_count'):
		data['min_count'] = max(min_players, data['min_count'])
	else:
		data['min_count'] = min_players
	
	if data.has('max_count'):
		data['max_count'] = min(max_players, data['max_count'])
	else:
		data['max_count'] = max_players
	
	if client_version != '':
		if not data.has('string_properties'):
			data['string_properties'] = {}
		data['string_properties']['client_version'] = client_version
		
		var query = '+properties.client_version:' + client_version
		if data.has('query'):
			data['query'] += ' ' + query
		else:
			data['query'] = query
	
	match_state = MatchState.MATCHING
	var result = yield(nakama_socket.add_matchmaker_async(data.get('query', '*'), data['min_count'], data['max_count'], data.get('string_properties', {}), data.get('numeric_properties', {})), 'completed')
	if result.is_exception():
		leave()
		emit_signal("error", "Unable to join match making pool")
	else:
		matchmaker_ticket = result.ticket

This is matchmaking but d rather do a lobby like setup like match listing. Trying to decifer the process lol

Thank you guys!

1 Like

Moving to a lobby system:

While Nakama’s matchmaking is efficient, a lobby system offers more control over player interaction before entering a match. Here’s how to set up a lobby system in Godot using Nakama:

Create a lobby match:

Use Nakama’s create_match_async function to create a dedicated lobby match with a single slot (which can be adjusted to suit your needs).
This lobby match will contain players who are actively looking for others.
Set appropriate properties such as ‘game_type’ or ‘difficulty’ to filter lobbies for similar preferences.

Join the lobby match:

Use join_match_async for clients to join the lobby.
Nakama will either place the client in the existing lobby or create a new one if none exists.

Browse lobbies:

Implement a UI to display available lobbies with details such as player count, game type, etc.
Consider filtering lobbies based on relevant properties.
Use Nakama’s list_matches_async to retrieve a list of active matches with properties set at creation.

Start the match:

Implement a mechanism within the lobby for players to start the game (e.g. a “Start Match” button).
The lobby host or server can call join_match_async with the lobby match ID to transition players into the actual game match.

:handshake: