Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.3.2] - 2024-09-06

### Changed
 * Updated entities packages dependencies

### Added

* Significantly reduced bandwidth consumption of command packets (i.e. input packets), by a) converting the first command payload in each packet to use delta-compression against zero, b) by making the number of commands sent (per-packet) tied to the `TargetCommandSlack`, c) by delta-compressing the NetworkTicks using the assumed previous tick (which is a correct assumption in the common case), and d) by using a single `changeBit` if the previous command is exactly the same.
* `ClientTickRate.NumAdditionalCommandsToSend` is a new field allowing you to configure how many additional commands to send to the server in each command (i.e. input) packet.
* Support for dumping input commands into the `NetDebugPacket` dump, helping users visualize and diagnose bandwidth consumption. Implement the optional, burst-compatible method `ToFixedString` on your input components to see field data in your packet dumps, too.
* A `NetworkSnapshotAck.CommandArrivalStatistics` struct, documenting (on the server, for each client) how many commands arrive, and how many commands arrive too late. These statistics can be used to inform and tweak `TargetCommandSlack` and `NumAdditionalCommandsToSend`.
* Significantly expanded our automated test coverage for Lag Compensation. We now detect off-by-one-tick errors between the client and server's lag compensation resolutions.
* `LagCompensationConfig.DeepCopyDynamicColliders` (defaulting to true) and `LagCompensationConfig.DeepCopyStaticColliders` (defaulting to false) configuration values, enabling you to control whether or not colliders are deep copied during world cloning, preventing runtime exceptions when querying historic worlds during Lag Compensation. Also see the specialized `PhysicsWorldHistorySingleton.DeepCopyRigidBodyCollidersWhitelist` collection.

### Changed

* `PhysicsWorldHistory` now clones collision worlds *after* the `BuildPhysicsWorld` step for the given `ServerTick`. This fixes an issue where the `CollisionWorld` returned by `GetCollisionWorldFromTick` is off-by-one on the server. It is now easier to reason about, as the data stored for `ServerTick` T now actually corresponds to the `BuildPhysicsWorld` operation that occurred on tick T (rather than T-1, which was the previous behaviour). We strongly recommend having automated testing for lag compensation accuracy, as this may introduce a regression, and is therefore a minor breaking change.
* `PhysicsWorldHistory` now deep copies dynamic colliders by default (see fix entry). Performance impact should be negligible.

### Fixed

* Corrected `seealso` usage in XML package documentation.
* Documentation improvements and clarifications on the following pages: command stream, ghost snapshots, spawning ghosts, logging, network connection, networked cube, prediction, and RPCs.
* Lag Compensation issue in the case where an Entity - hit by a query against a historic lag compensation `CollisionWorld` fetched via `GetCollisionWorldFromTick` - has since been deleted. The colliders of dynamic ghosts are now deep cloned by default, preventing the blob asset assertions which would have otherwise been encountered here. You can also opt-into copying static colliders via the `LagCompensationConfig` or `NetCodePhysicsConfig` authoring (although the recommendation is to instead query twice; once against static geometry exclusively, using the latest collision world, then again using the hit position of the static query, against lag compensated dynamic entities).
* Issue where non-power-of-2 History Buffer sizes would return incorrect entries when `ServerTick` wraps around.
* an issue with iOS and WebGL AOT, causing the player throwing exceptions while trying to initialize the Netcode generated ghost serializer function pointers. The issue is present when using Burst 1.8 and Unity 6.0+
* an issue with GhostGroup serialization, incorrectly accessing the wrong ghost prefab type in the GhostCollectionPrefab array.
* an issue with buffer serialization when using GhostGroup, causing memory stomping at runtime (and exception thrown in the editor), due to the fact the required size for storing the buffer in the snapshot was calculated incorrectly. The root cause was the incorrect index used to access the GhostCollectionPrefab collection.
  • Loading branch information
Unity Technologies committed Sep 6, 2024
1 parent ea77e1e commit 55e467f
Show file tree
Hide file tree
Showing 138 changed files with 4,404 additions and 2,366 deletions.
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ uid: changelog

# Changelog


## [1.3.2] - 2024-09-06

### Changed
* Updated entities packages dependencies

### Added

* Significantly reduced bandwidth consumption of command packets (i.e. input packets), by a) converting the first command payload in each packet to use delta-compression against zero, b) by making the number of commands sent (per-packet) tied to the `TargetCommandSlack`, c) by delta-compressing the NetworkTicks using the assumed previous tick (which is a correct assumption in the common case), and d) by using a single `changeBit` if the previous command is exactly the same.
* `ClientTickRate.NumAdditionalCommandsToSend` is a new field allowing you to configure how many additional commands to send to the server in each command (i.e. input) packet.
* Support for dumping input commands into the `NetDebugPacket` dump, helping users visualize and diagnose bandwidth consumption. Implement the optional, burst-compatible method `ToFixedString` on your input components to see field data in your packet dumps, too.
* A `NetworkSnapshotAck.CommandArrivalStatistics` struct, documenting (on the server, for each client) how many commands arrive, and how many commands arrive too late. These statistics can be used to inform and tweak `TargetCommandSlack` and `NumAdditionalCommandsToSend`.
* Significantly expanded our automated test coverage for Lag Compensation. We now detect off-by-one-tick errors between the client and server's lag compensation resolutions.
* `LagCompensationConfig.DeepCopyDynamicColliders` (defaulting to true) and `LagCompensationConfig.DeepCopyStaticColliders` (defaulting to false) configuration values, enabling you to control whether or not colliders are deep copied during world cloning, preventing runtime exceptions when querying historic worlds during Lag Compensation. Also see the specialized `PhysicsWorldHistorySingleton.DeepCopyRigidBodyCollidersWhitelist` collection.

### Changed

* `PhysicsWorldHistory` now clones collision worlds *after* the `BuildPhysicsWorld` step for the given `ServerTick`. This fixes an issue where the `CollisionWorld` returned by `GetCollisionWorldFromTick` is off-by-one on the server. It is now easier to reason about, as the data stored for `ServerTick` T now actually corresponds to the `BuildPhysicsWorld` operation that occurred on tick T (rather than T-1, which was the previous behaviour). We strongly recommend having automated testing for lag compensation accuracy, as this may introduce a regression, and is therefore a minor breaking change.
* `PhysicsWorldHistory` now deep copies dynamic colliders by default (see fix entry). Performance impact should be negligible.

### Fixed

* Corrected `seealso` usage in XML package documentation.
* Documentation improvements and clarifications on the following pages: command stream, ghost snapshots, spawning ghosts, logging, network connection, networked cube, prediction, and RPCs.
* Lag Compensation issue in the case where an Entity - hit by a query against a historic lag compensation `CollisionWorld` fetched via `GetCollisionWorldFromTick` - has since been deleted. The colliders of dynamic ghosts are now deep cloned by default, preventing the blob asset assertions which would have otherwise been encountered here. You can also opt-into copying static colliders via the `LagCompensationConfig` or `NetCodePhysicsConfig` authoring (although the recommendation is to instead query twice; once against static geometry exclusively, using the latest collision world, then again using the hit position of the static query, against lag compensated dynamic entities).
* Issue where non-power-of-2 History Buffer sizes would return incorrect entries when `ServerTick` wraps around.
* an issue with iOS and WebGL AOT, causing the player throwing exceptions while trying to initialize the Netcode generated ghost serializer function pointers. The issue is present when using Burst 1.8 and Unity 6.0+
* an issue with GhostGroup serialization, incorrectly accessing the wrong ghost prefab type in the GhostCollectionPrefab array.
* an issue with buffer serialization when using GhostGroup, causing memory stomping at runtime (and exception thrown in the editor), due to the fact the required size for storing the buffer in the snapshot was calculated incorrectly. The root cause was the incorrect index used to access the GhostCollectionPrefab collection.


## [1.3.0-pre.4] - 2024-07-17

### Added
Expand Down Expand Up @@ -41,6 +72,7 @@ uid: changelog
* Exposed `NetworkStreamDriver.DriverStore` and `LastEndPoint`.
* Copy-free accessors for `NetworkStreamDriver` instances (via `GetDriverInstanceRW` and `GetDriverInstanceRO`) and underlying drivers (via `GetDriverRW` and `GetDriverRO`), which are also now used internally. The struct copy originals have been weakly deprecated.
* Support for serializing non-byte-aligned RPCs. I.e. You can now delta-compress RPC fields using the `IRpcCommandSerializer` by delta-compressing against hardcoded baseline values.
* Added a way to detect if a server world will execute a tick or not through NetcodeServerRateManager.WillUpdate. This can be used to execute expensive operations when in BusyWait mode in off frames. See the Optimizations doc page https://docs.unity3d.com/Packages/com.unity.netcode@latest/index.html?subfolder=/manual/optimizations.html

### Changed

Expand Down Expand Up @@ -104,6 +136,12 @@ uid: changelog
* Removed the hardcoded 'Protocol Version' RPC logic, simplifying RPC sending and receiving. Netcode's handshake RPCs now use the existing `IApprovalRpcCommand` flows.


## [1.2.4] - 2024-08-14

### Changed
* Updated entities packages dependencies


## [1.2.3] - 2024-05-30

### Changed
Expand Down Expand Up @@ -139,6 +177,7 @@ uid: changelog

* StreamCompressionDataModel is passed as in parameter to avoid many copy every time a WriteXXX or ReadXXX was called.
* Updated Burst dependency to version 1.8.12
* The `EntityCommandBuffer` used by netcode in the destruction of disconnected 'NetworkConnection' entities has been changed from the `BeginSimulationEntityCommandBufferSystem` to the `NetworkGroupCommandBufferSystem`, allowing connections to be disposed on the same frame that `Disconnect` is invoked (in the common case of `Disconnect` being called before the `NetworkGroupCommandBufferSystem` executes), rather than being delayed by one frame. However, this will therefore lead to runtime exceptions if user-code depends upon this single frame delay, and is therefore a minor breaking change.

### Fixed

Expand Down Expand Up @@ -458,7 +497,6 @@ MetricsMonitorComponent: MetricsMonitor,
* Fix a mistake where the relay sample will create a client driver rather than a server driver
* Fix logic for relay set up on the client. Making sure when calling DefaultDriverConstructor.RegisterClientDriver with relay settings that we skip this unless, requested playtype is client or clientandserver (if no server is found), the simulator is enabled, or on a client only build.
* Fixed `ArgumentException: ArchetypeChunk.GetDynamicComponentDataArrayReinterpret<System.Byte> cannot be called on zero-sized IComponentData` in `GhostPredictionHistorySystem.PredictionBackupJob`. Added comprehensive test coverage for the `GhostPredictionHistorySystem` (via adding a predicted ghost version of the `GhostSerializationTestsForEnableableBits` tests).
* Fixed serialization of components on child entities in the case where `SentForChildEntities = true`. This fix may introduce a small performance regression in baking and netcode world initialization. Contact us with all performance related issues.
* `GhostUpdateSystem` now supports Change Filtering, so components on the client will now only be marked as changed _when they actually are changed_. We strongly recommend implementing change filtering when reading components containing `[GhostField]`s and `[GhostEnabledBit]`s on the client.
* Fixed input component codegen issue when the type is nested in a parent class

Expand Down
55 changes: 30 additions & 25 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
* [Netcode for Entities package](index.md)
* [Get started](getting-started.md)
* [Installation](installation.md)
* [Networked Cube](networked-cube.md)
* [Netcode Project Settings reference](project-settings.md)
* [Basics](basics.md)
* [Networking Model](client-server-worlds.md)
* [Connection](network-connection.md)
* [Communication (RPCs)](rpcs.md)
* [Synchronization (State and Inputs)](synchronization.md)
* [Ghost Synchronization](ghost-snapshots.md)
* [Ghost Spawning](ghost-spawning.md)
* [Installing](installation.md)
* [Setting up client and server worlds](set-up-client-server-worlds.md)
* [Client and server worlds networking model](client-server-worlds.md)
* [Network protocol checks](network-protocol-checks.md)
* [Creating multiplayer gameplay](creating-multiplayer-gameplay.md)
* [Connecting server and clients](network-connection.md)
* [Communicating with RPCs](rpcs.md)
* [Synchronizing states and inputs](synchronization.md)
* [Ghost synchronization](ghost-snapshots.md)
* [Ghost spawning](ghost-spawning.md)
* [Commands](command-stream.md)
* [Interpolation](Interpolation.md)
* [Managing latency with client prediction](prediction.md)
* [Client prediction high-level explanation](prediction-high-level-explanation.md)
* [Prediction edge cases and known issues](prediction-details.md)
* [Time synchronization](time-synchronization.md)
* [Netcode specific Components and Types](entities-list.md)
* [Advanced](advanced.md)
* [Ghost Type Templates](ghost-types-templates.md)
* [Interpolation](interpolation.md)
* [Prediction](prediction.md)
* [Introduction to prediction](intro-to-prediction.md)
* [Prediction in Netcode for Entities](prediction-n4e.md)
* [Prediction smoothing](prediction-smoothing.md)
* [Prediction switching](prediction-switching.md)
* [Prediction edge cases and known issues](prediction-details.md)
* [Physics](physics.md)
* [Optimizations](optimizations.md)
* [Data compression](compression.md)
* [Source Generators](sourcegenerators.md)
* [Debugging and Tools](debugging.md)
* [PlayMode Tool](playmode-tool.md)
* [Ghost type templates](ghost-types-templates.md)
* [Testing and debugging your game](debugging.md)
* [Logging](logging.md)
* [Metrics](metrics.md)
* [Generator Debugging](sourcegenerators.md#how-to-debug-generator-problems)
* [Using the PlayMode Tool](playmode-tool.md)
* [Gathering metrics with MetricsMonitorComponent](metrics.md)
* [Using source generators](source-generators.md)
* [Optimizing performance](optimizing.md)
* [Optimizing your game](optimizations.md)
* [Data compression](compression.md)
* [Samples](samples.md)
* [Networked cube](networked-cube.md)
* [Reference](reference.md)
* [Netcode-specific components and types](entities-list.md)
* [Netcode Project Settings reference](project-settings.md)
8 changes: 0 additions & 8 deletions Documentation~/advanced.md

This file was deleted.

16 changes: 0 additions & 16 deletions Documentation~/basics.md

This file was deleted.

2 changes: 1 addition & 1 deletion Documentation~/client-server-worlds.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client and server worlds
# Client and server worlds networking model

The Netcode for Entities package has a separation between client and server logic, and splits logic into multiple worlds (the "client world", and the "server world").
It does this using concepts laid out in the [hierarchical update system](https://docs.unity3d.com/Packages/[email protected]/manual/systems-update-order.html) of Unity’s Entity Component System (ECS).
Expand Down
Loading

0 comments on commit 55e467f

Please sign in to comment.