SetNet.Locomotion
1.6.0
dotnet add package SetNet.Locomotion --version 1.6.0
NuGet\Install-Package SetNet.Locomotion -Version 1.6.0
<PackageReference Include="SetNet.Locomotion" Version="1.6.0" />
<PackageVersion Include="SetNet.Locomotion" Version="1.6.0" />
<PackageReference Include="SetNet.Locomotion" />
paket add SetNet.Locomotion --version 1.6.0
#r "nuget: SetNet.Locomotion, 1.6.0"
#:package SetNet.Locomotion@1.6.0
#addin nuget:?package=SetNet.Locomotion&version=1.6.0
#tool nuget:?package=SetNet.Locomotion&version=1.6.0
<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>
SetNet.Locomotion
One unified server-side tick that moves active routes — players, mobs, NPCs, projectiles — and replicates nothing.
Create a Mover and it's automatically part of the tick; the system advances its position along a pathfound route
N times per second. It sends nothing over the network — you read positions and replicate them your own way. When a
mover gets a new destination it fires Started, so you can send just the destination point to clients (L2-style;
the client re-paths locally — see SetNet.Locomotion.Unity).
Server
IGeoData geo = GeoDataFile.LoadFromFile("world.geo");
var loco = server.UseLocomotion(geo, new LocomotionOptions { Hz = 10 }); // one unified system
// send just the destination to nearby clients when something starts moving (client re-paths from the point):
loco.Started += m => SendMoveTo(m.Owner, m.Destination!.Value);
// …or send the route the mover is actually walking, so clients don't re-run the same search. Worth it in a crowd:
// every client otherwise pays one pathfinding run per moving entity, and the orders arrive together.
loco.Started += m => SendRoute(m.Owner, m.Waypoints); // m.WaypointIndex = how much is already behind
// anything that moves creates a Mover — that's the whole subscription:
var mover = loco.CreateMover(spawnPos, speed: stats.Get("move_speed"), owner: character);
// on a client move command / mob AI decision:
mover.GoTo(destination); // paths there, starts following (false if unreachable)
// the system advances mover.Position every tick — read it for range/AoI or to write into your replicated state:
mover.DestinationReached += m => { /* arrived */ };
mover.Dispose(); // auto-unsubscribe when the entity leaves
What it is (and isn't)
- It simulates, it doesn't replicate. No packets, no StateSync writes — just positions advancing. You decide how the position reaches clients (a NetworkVariable field, an L2 "move to point" event on
Started, whatever). - Automatic subscription.
CreateMoverregisters it;Dispose()removes it. No manualRegister. - Idle movers are free in the hot loop. Registered movers without a live route remain available for the next
GoTo, butUpdatesteps onlyActiveCountmovers.Stop,Warp, arrival, an unreachable order, andDisposeremove a mover from the active set. - Unified. Players, NPCs, projectiles — anything holding a
Movershares the one tick. (Mobs has its own tick; point its movement here too if you want a single system.) - One reused pathfinder (
Pathfinding.For(geo), pooled) for every mover.
API
server.UseLocomotion(geo, options?) (or new LocomotionSystem(geo, options?)) → LocomotionSystem:
CreateMover(start, speed, owner?)→Mover(auto-subscribed),Movers,Count.Update(dtMs)whenUseInternalTimer = false(drive it from your own loop).Startedevent — a mover got a new destination (send the point to clients here).
Mover: Position, Speed, Owner, Destination, IsMoving, GoTo(point), Stop(), Warp(point), DestinationReached, Dispose().
Notes
- Server-authoritative —
GoTopaths on the server; an unreachable point does nothing. - L2-style pairing: replicate only the destination on
Started; the client runs its ownFindPathand walks the model with the UnityNavAgent. Between destinations the server sends nothing. - Uses
SetNet.GeoData.Vec3.
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.3.0)
- SetNet.GeoData (>= 1.2.0)
- SetNet.PathFinding (>= 1.3.2)
- SetNet.Ticks (>= 1.2.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SetNet.Locomotion:
| Package | Downloads |
|---|---|
|
SetNet.Mobs.Locomotion
The opt-in bridge that makes SetNet.Mobs advance mob positions through the unified SetNet.Locomotion tick instead of their own path-follower: loco.AsMobMover() → MobOptions.Mover. Mob AI/perception/threat/combat/replication are unchanged; only the movement stepping moves into the one shared system, so players and mobs share it (and its Started hook, for L2-style "send the point" replication). Depends on SetNet.Mobs + SetNet.Locomotion. |
GitHub repositories
This package is not used by any popular GitHub repositories.