Created party with max size 5 but 6 players can join

Hello everyone,

is the integer we provide in the create party call owner inclusive or exclusive?
Because I create a party like that, var createPartyResult = await iSocket.CreatePartyAsync(true, 5); but 6 players total can join the party.
If player number 7 wants to join, we get a “party full” error.
But in the docs at Nakama: Unity/.Net | Heroic Labs Documentation is a party created with max player 4 for a 4 player party.

What could have gone wrong that it ends up with this behavior? I made sure OnSocketReceivedParty does really respond with 6 presences, what it does, why is he still allowed to join in a party of max 5?

Thanks in advance,
Baerikus

@Baerikus The max size is expected to include the party creator/leader. It would be great if you can share a small script that reproduces the issue, ideally packaged as a new nakama-dotnet SDK test case to help us debug.

(Also please share details like the Nakama server and Nakama Unity SDK versions you’re using. It’s hard to debug otherwise as you may be running into issues that have already been fixed.)

@zyro Thank you for taking time.
I’m not sure about the nakama-dotnet SDK test case, but I quickly assembled a single script that only need some serialize fields assigned for buttons and input field / display text, and it should be good to go and working by itself alone in a scene.
Running this produces the same error, a party is created with a max size of 2 but only the 4. connecting player gets a “party full” exception.

Unity Version 2022.1.23f1
Nakama Version 3.14.0
Nakama Unity SDK Version 3.5.0

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Nakama;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class NakamaPartyTest : MonoBehaviour
{
	[SerializeField] private TMP_InputField partyIDToJoinInputField;
	[SerializeField] private Button connectToPartyButton;
	[SerializeField] private Button createPartyButton;
	[SerializeField] private TextMeshProUGUI displayText;
	
	private IClient _iClient;
	private ISocket _iSocket;
	private ISession _iSession;
	
	private void Start()
	{
		displayText.text = "";

		createPartyButton.onClick.AddListener(() => _ = CreateParty());
		connectToPartyButton.onClick.AddListener(() => _ = ConnectToParty());

		_ = ConnectToNakama();
	}

	private async Task ConnectToNakama()
	{
		_iClient = new Client("http", "localhost", 7350, "defaultkey");
		
		var retryConfiguration = new RetryConfiguration(0, 0);
		
		var additionalAuthenticationData = new Dictionary<string, string>{};
		
		_iSession = await _iClient.AuthenticateCustomAsync(Guid.NewGuid().ToString(), null, true,
			additionalAuthenticationData, retryConfiguration);
		
		_iSocket = _iClient.NewSocket(true);
		
		_iSocket.ReceivedParty += ISocketOnReceivedParty;
		_iSocket.ReceivedError += exception =>
		{
			Debug.Log(exception.Message);
			displayText.text = exception.Message;
		};
		
		await _iSocket.ConnectAsync(_iSession, true, 30, "");
	}

	private void ISocketOnReceivedParty(IParty party)
	{
		displayText.text = $"Joined Party {party.Id} with {party.Presences.Count()} member.";
	}

	private async Task CreateParty()
	{
		var createPartyResult = await _iSocket.CreatePartyAsync(true, 2);

		ISocketOnReceivedParty(createPartyResult);

		partyIDToJoinInputField.text = createPartyResult.Id;

		connectToPartyButton.interactable = false;
		createPartyButton.interactable = false;
	}
	
	private async Task ConnectToParty()
	{
		if (partyIDToJoinInputField.text != "")
		{
			connectToPartyButton.interactable = false;
			createPartyButton.interactable = false;

			try
			{
				await _iSocket.JoinPartyAsync(partyIDToJoinInputField.text);
			}
			catch (Exception e)
			{
				displayText.text = e.Message;
			}
		}
		
		partyIDToJoinInputField.text = "";
	}
}

Let me know if this works for you, but I think it’s pretty basic, I tried to make it minimal.

  1. The first client clicks “Create Party”
  2. Copy the party ID from his input field
  3. Enter party ID into input field of the other clients
  4. Press “Connect to Party” one after another and watch the display text output on each client.

For me, even the party is opened with max size 2, it’s connecting a total of 3 players (1 creator and 2 joiners) and the 4. Player gets a “party full” exception.

Thanks for the test, this was indeed a bug where the size wasn’t always observed correctly. A fix is on master and will be part of the next release. You should expect the party max size to behave as expected once you update to the upcoming Nakama 3.15.0 release. :+1:

1 Like