SetNet.Zones
1.2.0
dotnet add package SetNet.Zones --version 1.2.0
NuGet\Install-Package SetNet.Zones -Version 1.2.0
<PackageReference Include="SetNet.Zones" Version="1.2.0" />
<PackageVersion Include="SetNet.Zones" Version="1.2.0" />
<PackageReference Include="SetNet.Zones" />
paket add SetNet.Zones --version 1.2.0
#r "nuget: SetNet.Zones, 1.2.0"
#:package SetNet.Zones@1.2.0
#addin nuget:?package=SetNet.Zones&version=1.2.0
#tool nuget:?package=SetNet.Zones&version=1.2.0
<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>
SetNet.Zones
Seamless player handoff between world nodes for SetNet.
A big world runs across many nodes, one per zone/region. When a player crosses a boundary, SetNet.Zones moves them without a re-login: the origin node stashes the player's carried state under a one-time token and pushes the client a migrate here instruction; the client reconnects to the destination node and claims the token to get its state back. The state travels through a pluggable IHandoffStore (share a Redis/DB store across nodes so the destination process can read what the origin wrote). Added by composition — no base class.
Install
dotnet add package SetNet
dotnet add package SetNet.Zones
Usage
Call ZonesRuntime.Enable() once at startup on both ends. Every node shares one handoff store.
Server node — hand a player off when they cross into another zone:
ZonesRuntime.Enable();
var zones = server.UseZones(sharedHandoffStore); // same store instance/backend on every node
// game logic: player walked into the "desert" zone owned by another node
byte[] carried = SerializePlayer(player); // position, buffs, current action…
await zones.TransferAsync(peer, new ZoneTarget("desert", "desert.game.example", 5000), carried);
Client — follow the handoff:
ZonesRuntime.Enable();
var zones = client.UseZones();
zones.TransferRequested += async transfer =>
{
var next = new GameClient(new Configuration { Host = transfer.Target.Host, Port = transfer.Target.Port /* ... */ });
var nextZones = next.UseZones();
await next.ConnectAsync();
byte[] carried = await nextZones.ClaimAsync(transfer.Token); // state from the origin node
RestorePlayer(carried); // spawn seamlessly in the new zone
oldClient.Disconnect();
};
API
Server: server.UseZones(IHandoffStore?, ZoneOptions?) → ZonesServer
| Member | Purpose |
|---|---|
Task<string> TransferAsync(peer, ZoneTarget, byte[] carryState) |
stash state + push a migrate instruction; returns the token |
KeyOf(peer) |
the peer's stable player key |
Client: var zones = client.UseZones() → ZonesClient
| Member | Purpose |
|---|---|
event Action<ZoneTransfer> TransferRequested |
server asked this client to migrate (target + token) |
Task<byte[]> ClaimAsync(token) |
on the destination node, retrieve the carried state |
Store: IHandoffStore (MemoryHandoffStore default) — PutAsync(token, handoff, ttl) / TakeAsync(token) (one-time).
Options: ZoneOptions.PlayerKey, HandoffTtl (60 s).
ZonesRuntime.Enable() — one-time bootstrap.
Notes
- Rides the unified SetNet.Protocol messaging layer on the
Channels.Zoneschannel (all modules share one envelope wire type,65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framedbyte[], your payloads use yourSetNetSerializer. - The store must be shared for real cross-node handoff. The default
MemoryHandoffStoreonly works when origin and destination are the same process (co-located nodes / tests). For separate processes, backIHandoffStorewith Redis/DB so the destination can read the stashed state. - Where's the destination node?
SetNet.Zonescarries state; it doesn't decide which node owns a zone. Pair it withSetNet.Sharding(ring.GetNode(zoneId)) or your own zone→node map to fill inZoneTarget.Host/Port. - One-time, expiring tokens. A token is consumed on the first successful claim and swept after
HandoffTtl. Carry only what the destination needs to reconstruct the player; keep durable data (inventory, progression) in shared stores likeSetNet.Inventory. - Trust. The carried state is opaque and, if the store is shared, written by a trusted peer node — validate it on the destination and gate player connections with
SetNet.Auth. Re-authenticate on the destination node like any new connection.
Documentation & source
- 🐙 https://github.com/Povstalez/SetNet — full module catalog in docs/MODULES.md
License
MIT
| Product | Versions 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. |
-
.NETStandard 2.1
- SetNet (>= 1.2.0)
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 | 127 | 8/5/2026 |