Netcode for Entities 1.6.1 is now live! ![]()
Hey everyone! We’re back with another batch of updates for Netcode for Entities, and we’re excited to share what the team has been working on. Here’s a quick rundown of the latest features, improvements, and fixes.
First, we’ve made improvements in prediction control with the introduction of two new systems: BeginPredictedSimulationCommandBufferSystem and EndPredictedSimulationCommandBufferSystem. These provide better control over commands within the PredictedSimulationSystemGroup, making prediction workflows more reliable and robust.
Our experimental Host Migration feature has also seen some additional updates on top of the ones introduced in version 1.5.1. We’re continuing to refine this feature to make it better and easier to use for your projects.
Another update involves Ghost Relevancy and Importance Scaling. By combining these two features, we’ve introduced a new fast-path relevancy calculation that ensures efficient bandwidth usage. This should make managing complex multiplayer environments more efficient.
We’ve also added flexibility to Snapshot History Size. With new compiler defines, you can now define smaller GhostSystemConstants.SnapshotHistorySize values, which is perfect for memory-constrained servers. This flexibility is especially useful when scaling up your multiplayer games.
In terms of fixes and improvements, we’ve addressed several areas. Prediction stability has been enhanced, improving ghost spawning and rollback behavior. We’ve also added WebGL support, enabling self-hosting servers for browser-based multiplayer games. Additionally, we’ve resolved serialization issues with buffers and ghost fields, ensuring data integrity.
We’ve introduced analytics into our Tools to better understand which tools are most popular and how they’re being used.
This information will help us make informed decisions about prioritizing improvements and support for our Netcode tools.
We’re excited to bring you these updates and can’t wait to see how they help with your projects
. Let us know if you have any questions or feedback!
Happy Netcoding!
Fixed
- Behaviour Breaking Change: Incorrect state serialized inside the
SnapshotDataBufferfor predicted spawned ghost on the client when spawned inside the prediction loop. ThePredictedGhostSpawnSystemis now updated also as part of the prediction loop (inside thePredictedSpawningSystemGroup) to ensure that any predicted spawned ghosts on the client are correctly initialized at the tick they are spawned, and not with partial tick state. - Issue where predicted spawned ghosts re-simulated from the wrong tick when configured to rollback to their
spawnTickand are spawned inside the prediction loop. They are now restored using the corrected full tick state, rather than the erroneous partial tick state. - Enable creating and initializing server drivers when using WebGL to enable self-hosting cases using relay. Many methods were under conditional compilation flags and removed from the WebGL build and not usable outside the editor.
- All the unmanaged systems present in the FixedStepSimulationSystemGroup that have a direct or indirect update dependency to the PhysicsSystemGroup are now correctly moved to the PredictedFixedStepSimulationSystemGroup. This is a Behaviour Change in respect the previous versions, where all the unmanaged systems continued to stay inside the fixed update group, regardless of the dependency of update order.
- An issue with Mutiplayer PlayModeTool window, throwing exceptions when docked after a domain reload. The issue was due to because of an access to
EditorPrefsandApplication.productNamewhile restoring the window state. - Issue where, during host migration, ghosts could be migrated with a 0 id and type. Causing various issues when instantiated on the new host.
- Crash which could happen after host migrations when the server is deploying the host migration data.
- Issue with prespawn prefab entity list initialization after a host migration, the ordering of the prespawn ghosts could be shifted by one because of the internal
PrespawnSceneListentity prefab creation. This would result in invalid ghost type X (expected X+1) off by one style errors. - The prediction loop will no longer rollback too many times when one ghost is switched from predicted to interpolated, and later switched back to predicted, when that ghost is the only predicted ghost.
- If you update multiple packages, create a new section with a new header for the other package.
- The client packet dump was not being written to the
EnablePacketLogging.NetDebugPacketCachefield, thus were not usable by users and other netcode call-sites (like theNetworkStreamReceiveSystem). SnapshotHistorySizevalues below 32 uncovered an issue where a ghost chunk being written would write over its snapshot history entries for currently-in-flight snapshots, leading to a cycle of never being able to fetch a valid baseline, in perpetuity. The fix for this requires us to stall the send of this ghost chunk if the in-flight queue is full, until the in-flight snapshots are assumed to have either arrived or been lost/dropped.- Buffer serialization errors caused by incorrect pointer stepping when ghost fields are not present (i.e. surrounding
GhostComponentSerializer.State.HasGhostFields). - Buffer serialization errors caused by missing change mask invalidation when
SendToOwnerTypeorGhostSendTypeconditionally prevented sending of the buffer. - Readded
UsePreSerializationto theGhostAuthoringComponentinspector that was accidentally removed.
Changed
- Behaviour Breaking Change: Predicted spawned ghosts for partial ticks skip restoring the state from the backup (and instead continue prediction from their spawn state) when the last backup state tick is identical to the spawn tick, as no data has changed.
- Behaviour Breaking Change: Reduced the complexity (and performance overhead) of the
GhostCount.GhostCountOnServercalculations internally. Note that this value is (and always has been) an approximation. - IsReconnected split into NetworkStreamIsReconnected for reconnected connections and IsMigrated for re-spawned ghosts (Host Migration).
- Moved host migration related types into a
Unity.Netcode.HostMigrationnamespace, renamed theHostMigrationclass toHostMigrationUtilityso it works in the new namespace. - Prespawn ghost IDs will now be preserved between host migrations
- Client connection
NetworkIDsare now preserved between host migrations.
Added
- Two new entity command buffer systems that run at the beginning and end of the
PredictedSimulationSystemGrouprespectively:BeginPredictedSimulationCommandBufferSystemandEndPredictedSimulationCommandBufferSystem. - A new internal
PredictedSpawningSystemGroup, running after theEndPredictedSimulationCommandBufferSystem, created to guarantee that when a new snapshot is received from server, all new ghosts are spawned and ready to receive new data. - New documentation regarding the NetworkDriverStore architecture, setup and how to use it in conjunction with Unity.Relay.
- Experimental host migration feature added, enabled with the ENABLE_HOST_MIGRATION define but otherwise hidden.
- With ENABLE_HOST_MIGRATION defined, when a client reconnects to a server after disconnecting the connection entity on both sides will receive a
NetworkStreamIsReconnectedcomponent. An internal unique ID is added to connections to track this behaviour. - The ability to define a smaller
GhostSystemConstants.SnapshotHistorySizevalue via compiler defineNETCODE_SNAPSHOT_HISTORY_SIZE_6orNETCODE_SNAPSHOT_HISTORY_SIZE_16. These values are well suited for larger scale use-cases where server memory is constrained, and snapshot sends of individual ghosts are relatively infrequent. - Support for combining Ghost Relevancy with Ghost Importance Scaling via new
PrioChunks.isRelevantfield, enabling a fast-path for relevancy calculations. - Analytics to netcode tools to better understand their usage.
Obsolete
- Prefer
BatchScaleImportanceDelegatetoScaleImportanceFunctionas the latter significantly reduces the total number of function pointer calls.