SetNet.Party 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SetNet.Party --version 1.1.0
                    
NuGet\Install-Package SetNet.Party -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SetNet.Party" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetNet.Party" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SetNet.Party" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetNet.Party --version 1.1.0
                    
#r "nuget: SetNet.Party, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SetNet.Party@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetNet.Party&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SetNet.Party&version=1.1.0
                    
Install as a Cake Tool

<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>

SetNet.Party

Party / group system for SetNet.

A party is a small persistent group of friends who stick together across lobbies and matches. Unlike a room (which is a game session), a party lives before and between games: you invite friends by code, see who's ready, and then enter matchmaking or a room as a group.

This package gives you:

  • create / join a party by a short code,
  • a leader (the creator; auto-promoted if they leave),
  • per-member ready state,
  • events for join / leave / leader-changed / ready-changed / disbanded.

Added by composition — no base class, works alongside your regular messages.

Install

dotnet add package SetNet
dotnet add package SetNet.Party

Setup

PartyRuntime.Enable();     // once at startup, both ends, before creating client/server

Server

server.UseParties();       // that's it — parties are node-local, no store needed

Client

var party = client.UseParty();

party.PlayerJoined  += id => Log($"{id} joined");
party.PlayerLeft    += id => Log($"{id} left");
party.LeaderChanged += id => Log($"{id} is now leader");
party.ReadyChanged  += (id, ready) => UpdateReadyIcon(id, ready);
party.Disbanded     += () => ReturnToMainMenu();

// create a party (you become the leader):
var info = await party.CreateAsync();
Share(info.Code);                       // e.g. "K7Q2MZ" — send to friends

// a friend joins:
var joined = await party.JoinAsync("K7Q2MZ");
foreach (var m in joined.Members)
    Log($"{m.PlayerId} ready={m.Ready}");

// ready up / leave:
await party.SetReadyAsync(true);
await party.LeaveAsync();

Entering matchmaking as a group

The leader waits until everyone is ready, then enqueues the whole party into SetNet.Matchmaking with a shared queue key so members land in the same match:

party.ReadyChanged += (_, _) =>
{
    var p = party; // snapshot
    if (IsLeader && p != null && AllReady(p))
        foreach (var member in p.Members)
            /* each client calls */ matchmaking.FindMatchAsync(new MatchRequest { Queue = "ranked" });
};

(Party keeps the group together; Matchmaking places them; Rooms is the resulting session. The three compose.)

API

Client — PartyClient (client.UseParty()):

Member Purpose
Task<PartyInfo> CreateAsync() create a party, become leader
Task<PartyInfo> JoinAsync(code) join by code (throws PartyException if missing)
Task LeaveAsync() leave the current party
Task<PartyInfo> SetReadyAsync(bool) set your ready flag
string? CurrentCode current party code, or null
events PlayerJoined(id), PlayerLeft(id), LeaderChanged(id), ReadyChanged(id, ready), Disbanded()

PartyInfo: Code, OwnPlayerId, LeaderId, IReadOnlyList<PartyMember> Members. PartyMember: PlayerId, Ready.

Server — server.UseParties() installs the handler + auto-removes members on disconnect.

Notes

  • Leader promotion: the leader is the first member; if they leave or disconnect, the next member becomes leader and everyone gets LeaderChanged. An empty party is dropped.
  • Codes are 6 chars from an unambiguous alphabet (no O/0/I/1), collision-checked.
  • Node-local (parties are live peers on one server node), like Rooms. A multi-node deployment would coordinate through a shared store.
  • Reserved wire types 65511 / 65512 / 65513. Serializer-agnostic (hand-framed protocol); the player-facing data is fully typed (PartyInfo/PartyMember).

Documentation & source

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 94 8/5/2026
1.1.0 118 7/2/2026