Interest Management
When creating large worlds, we don’t want to synchronize the full world to every single player connection. Instead, we only send nearby state to each player connection.
Each NetworkIdentity
has observers, which are the player connections that it is synced to. Observers are a DynamicBuffer<NetworkServer>
.
The InterestManagementSystem
rebuilds the observers every few seconds.
InterestManagementSystem
is abstract, so that different games can have different interest management algorithms. For example:
Brute Force
Spatial Hashing
Sphere Cast Checks
Line Sweeps
Instance based
etc.
By default, DOTSNET comes with a DistanceInterestManagementSystem
which runs vector3 distance checks to every player connection for each NetworkIdentity
in the world.
Later on, DOTSNET will also implement a Spatial Hashing system which will scale even better.
InterestManagementSystem API
Function:
Description:
RebuildAll
Inherit to rebuild all observers for all NetworkIdentities.
SendSpawnMessage
Call this from RebuildAll after adding an observer to an Entity to spawn the Entity on the observer connection.
SendUnspawnMessage
Call this from RebuildAll after removing an observer from an Entity to unspawn the Entity on the observer connection.
Last updated