SetNet.PathFinding 1.3.2

dotnet add package SetNet.PathFinding --version 1.3.2
                    
NuGet\Install-Package SetNet.PathFinding -Version 1.3.2
                    
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.PathFinding" Version="1.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetNet.PathFinding" Version="1.3.2" />
                    
Directory.Packages.props
<PackageReference Include="SetNet.PathFinding" />
                    
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.PathFinding --version 1.3.2
                    
#r "nuget: SetNet.PathFinding, 1.3.2"
                    
#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.PathFinding@1.3.2
                    
#: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.PathFinding&version=1.3.2
                    
Install as a Cake Addin
#tool nuget:?package=SetNet.PathFinding&version=1.3.2
                    
Install as a Cake Tool

SetNet.PathFinding

Pathfinding + path-following for SetNet, over SetNet.GeoData.

Find a route, then walk an entity along it — server-side and engine-agnostic. One interface, IPathfinder, with the right algorithm picked from the geometry kind:

  • grid → A* (8-connected, octile, no corner-cutting) + straight-line smoothing
  • multi-storey grid → A* over per-cell height layers (climbs stairs / crosses bridges between floors) + smoothing
  • nav-mesh → A* over triangles + portal path + straight-line smoothing
IGeoData geo = GeoDataFile.LoadFromFile("world.geo");
IPathfinder finder = Pathfinding.For(geo);            // grid or nav-mesh — automatic

Path path = finder.FindPath(mobPos, playerPos);
if (!path.IsEmpty)
{
    var follower = new PathFollower(path);
    // each server tick:
    mobPos = follower.Step(mobPos, speed * dtSeconds);   // moves toward the next waypoint
    if (follower.Arrived) { /* reached the goal */ }
}

Built for scale (path everyone, every tick)

In an MMO every character and mob may re-path several times a second, so the hot path is allocation-free after warm-up. A pathfinder instance is meant to be built once and reused (that's exactly how SetNet.Mobs holds it):

  • Per-query working memory (g/came/closed sets, the open heap) is pooled and reused across calls — nothing is allocated per FindPath once the pool is warm.
  • Visited nodes are generation-stamped instead of cleared, so a query costs O(nodes actually expanded), not O(map size) — a short path on a huge map stays cheap.
  • The pool is thread-safe, so one pathfinder can serve many agents from parallel AI ticks.
  • MaxExpansions (on GridPathfinder / LayeredGridPathfinder) caps the worst case: an unreachable goal returns Path.Empty instead of scanning the whole reachable area.
var finder = Pathfinding.For(geo);        // build ONCE, keep it
// ...thousands of times, from any thread:
var path = finder.FindPath(a, b);         // no per-call array allocation

The World example (dotnet run --project examples/World -- bench) reports throughput on a reused instance.

Notes

  • Server-side, no wire protocol. Movement is server-authoritative; clients see replicated positions.
  • PathFollower is what SetNet.Mobs uses to turn a MoveTo intent into authoritative motion — but Mobs treats the pathfinder as an optional seam (straight-line fallback when no IGeoData is provided).
  • Nav-mesh routing uses a portal-midpoint path with line-of-walk smoothing (a robust stand-in for a full funnel).

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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SetNet.PathFinding:

Package Downloads
SetNet.Locomotion

A unified server-side movement simulator for SetNet: one system advances the position of everything that moves (players, mobs, NPCs, projectiles) along pathfound routes at a fixed rate — with automatic subscription (create a Mover and it's already ticking). It replicates NOTHING: you read positions and replicate them your own way, and a Started hook fires when a mover gets a new destination so you can send just the point to clients (L2-style, client re-paths locally). Depends on SetNet + SetNet.GeoData + SetNet.PathFinding.

SetNet.Mobs

Server-authoritative hostile AI entities for SetNet. One IMobBrain per mob type (aggressive, passive-retaliate, ranged/kiting, caster) — or compose one from behaviour components — behind a uniform tick loop that handles perception, threat, movement (via SetNet.PathFinding, straight-line fallback), ability cooldowns/casts/telegraphs, damage, death and respawn. Replication is a seam (IMobReplication, no-op default; poll MobServer.Mobs or handle MobMoved) — a StateSync adapter ships separately as SetNet.Mobs.StateSync. server.UseMobs() + client.UseMobs(). Rides the unified SetNet.Protocol on the Channels.Mobs channel. Depends on SetNet + SetNet.GeoData + SetNet.PathFinding (NOT StateSync).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.2 135 8/15/2026
1.2.0 219 8/5/2026