Releases: needle-mirror/com.unity.netcode
Releases 路 needle-mirror/com.unity.netcode
1.3.0-exp.1
[1.3.0-exp.1] - 2024-06-11
Added
- The Multiplayer PlayMode Tools Window now calls synchronous
Connect
andDisconnect
methods, and now shows theHandshake
connection step. Handshake occurs when the client connection has been accepted by the server, but said client is awaiting aNetworkId
assignment RPC from said server. - Possibility to optimise the ghost serialization and pre-serialization by registering a custom chunk serialization function pointer that will let users reason on a per-archetype and write the serialization code without requiring virtual methods (function pointer call indirection) and optimised for the use case.
- Further clarifications, minor improvements, and fixes to the PlayMode Tools Window.
DefaultRelevancyQuery
to specify general rules for relevancy without specifying it ghost by ghost.- Tooltips and additional info for the NetCodeConfig, supporting
ClientServerTickRate
,ClientTickRate
, andGhostSendSystemData
. - Method
EnablePacketLogging.LogToPacket
, allowing user-code to add custom events to the netcode per-connection packet dump. - An optional connection approval procedure so you can validate that a connection is allowed to connect before a network ID is assigned to it. Connection Approval requests can be sent by client to server via an IApprovalRpcCommand RPC. The server can validate the arbitrary payload included in the RPC. No other data is processed by the server until the connection is approved.
- More documentation on prediction, edge cases to be careful about, interpolation, compression, physics ghost setup checklist and the general update loop.
- Increased validation applied to RPC serialization (including better error logging). We now ensure their deserialized size is the expected number of bytes.
- Test coverage for
windowSize: 64
forReliableSequencedPipelineStage
. - PredictedSpawnedGhostRollbackToSpawnTick property to the GhostAuthoringComponent to allow predicted ghost spawned by client to rollback and re-simulate their state starting from their spawn tick, until the authoritative spawn has been received from the server. The rollback only occurs if the client receives new snapshots from server that contains at least one predicted ghost.
- Changed usage of NetworkParameterConstants.MTU to use user configurable NetworkParameterConstants.MaxMessageSize. This allows snapshot and command buffers to reference the correct value and scale buffers accordingly.
- Exposed
NetworkStreamDriver.DriverStore
andLastEndPoint
. - Copy-free accessors for
NetworkStreamDriver
instances (viaGetDriverInstanceRW
andGetDriverInstanceRO
) and underlying drivers (viaGetDriverRW
andGetDriverRO
), 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.
Changed
- Added the full type name of the RPC component to the RPC entity name (behind "NetcodeRPC_" prefix).
- The netcode RPC header size has now changed (from 9B to 5B per packet, plus either 10B or 4B per RPC, depending on
DynamicAssemblyList
). - The max size of a serialized RPC is now 8192 bytes (ushort.MaxValue bits), as we now send the bits written, to be able to validate that the exact number of bits were read in the
RpcSystem
. - Reduced bandwidth consumption of netcode's
RpcSetNetworkId
RPC payload. - Updated
com.unity.transport
dependency to version 2.2.0. - Fixed another issue with predicted ghosts spawned again inside the prediction loop, not rolling back to the backup or re-predicting from the spawn tick, after being initialized by the PredictedSpawnGhostSystem (because of command buffer delay), effectively mispredicting again the first full tick and subsequent partial, and making the backup also contain mispredicted information.
- Renamed
RpcSetNetworkId
toServerApprovedConnection
. - The servers
Handshake
process is no longer instantaneous, resulting in a few extra ticks being required (typically) before a connection can be fully established (approximately 7 ticks, up from 4). See bug fix entry. NetCodeConnectionEvent
s are now raised on the server for the protocol version handshake process (theConnectionState.State.Handshake
enum value). See bug fix entry.- Reduced bandwidth consumption of netcode's
NetworkProtocolVersion
RPC.
Removed
- NoScale function delegate.
Fixed
- Compile error when having both com.unity.netcode and com.unity.dedicated-server package together.
- Issue where disconnecting your own client (via a direct
Disconnect
call) would fail to recycle theNetworkId
component, and fail to dispose of the Entity. - We now also correctly report and clean-up stale connections. I.e. Connections that are entered into invalid states by user-code.
- Issue where the
CommandSendSystem
was attempting to send RPCs with stale connections. - some slow path in the normal ghost serialization that was causing many re-serialization of the same chunk, in case the chunk data was not fitting inside the temporary stream buffer. That was almost the norm in many cases, when the serialised entities are large enough (either because of the number of components or because of the size of them).
- NetworkStreamConnection now holds an accurate connection state right after the call to driver's Connect, instead of having to wait a frame to get it updated.
- Minor documentation issues.
- InvalidOperationException: cases where EntityManager is part of an exclusive transaction we skip gathering analytics for its world.
- Breaking change where NoScale function was removed.
- Issue where the
NetCodeDebugConfig
would not reset to theLogLevel
default (ofNotify
) if toggled ON, changed, then toggled OFF, during playmode. - Minor documentation errors and improving overall grammar.
- Issue where
NetCodeConfig.Global
did not load correctly on first boot, if not selected in the Project assets window. If you have a globalNetCodeConfig
set in your PreloadedAssets Project Setting, we'll also auto-upgrade your project, moving the save to Project Settings (viaNetCodeClientAndServerSettings
). - Negative network delta time will skip updating the system group.
NETCODE_NDEBUG
define compiler error, and related missing documentation.- Issue where two IInputComponentData with the same name but in different namespaces would result in conflicted generated code. Namespace is now taken into account for source gen.
- Network emulation tooltip clarification.
- Off-by-one error causing RPCs sent on the same tick as the
ProtocolVersion
RPC to be corrupted. - Language improvements to PredictedSimulationSystemGroup and ClientServerBootstrap.
- Performance problems with GhostCollectionSystem, with large number of prefabs.
- PredictedGhostSpawnSystem incorrectly set the offset for serialized buffer data inside the snapshot buffer, making that incompatible with the GhostUpdateSystem logic and causing wrong data potentially copied back to the entity buffer.
- An issue with preserialized ghost, that were stomping component data with incorrect values.
- an issue in GhostUpdateSystem that was incorrectly handling the GhostComponentAttribute.SendToOwner flag, causing during continuation and partial ticks replicated data being overwritten incorrectly for predicted ghosts.
- An issue due to structural changes, that was causing a large number of prediction step performed by the client due to the fact a given ghost could not continue the current prediction from the last full ticks (either partial ticks or another full tick) because the entity data could not be found anymore in the prediction history buffer.
- Issue where RPCs appeared on deleted connection entities, leading to user code runtime exceptions, where, occasionally, the
NetworkId
component could not be found on theReceiveRpcCommandRequest.SourceConnection
(as the connection was already disconnected). - the client was acknowledging to the server only the last received snapshot instead of the last 32 (this was used to defeat packet loss). This was affecting both the ability to correct use all the available baseline for delta compression, and multiple re-sending static optimized ghost.
- Rendering issue in
GhostAuthoringInspectionComponent
, causing UI to right-clip. - Defensive fix for other rendering issue in
GhostAuthoringInspectionComponent
, causing the Refresh and auto-refresh buttons to not appear correctly. - Fixed check to early release allocations in the case where a ghost chunk has been reused. We now correctly free these chunks, reducing allocated memory overhead on the server.
- Rotation glitch issue with prediction switching interpolation
- Issue where RTT calculation would be incorrectly high when first connecting, especially with high packet loss.
- Issue where running a netcode test would invalidate the
NetworkTimeSystem.TimestampMS
for subsequent play-mode runs, when Domain Reloads are disabled, leading to0卤0
ping readout (and related issues). - an issue with predicted spawned ghost and enableable components state not being saved correctly in the snapshot buffer when the PredictedSpawnGhostRequest is processed and the entity initialized.
- an issue with pre-spawned ghost and enableable components state not being saved correctly in the predicted spawn baseline buffer.
- exception thrown by the
GhostPresentationGameObjectSystem
when an entity is destroyed. The system was accessing the trackedGameObject
list using an invalid index in cases where the removedGameObject
was the last element. - Exceptionally rare infinite loop crash in
SetupDataAndAvailableBaselines
. - an issue in the PredictedGhostHistorySystem, that was storing the backup of newly spawned ghost using the wrong ghost type and serializer. It was causing weird problem later in the GhostUpdateSystem, in case predi...
1.2.3
[1.2.3] - 2024-05-30
Changed
- Updated entities packages dependencies
1.2.1
[1.2.1] - 2024-04-26
Changed
- Updated Burst dependency to version 1.8.13
- Updated entities packages dependencies
1.2.0
[1.2.0] - 2024-03-22
Changed
*Release Preparation
1.2.0-pre.12
[1.2.0-pre.12] - 2024-02-13
Added
- Optimisations for the gather-ghost-chunk by batching function pointer calls and using a better hash map.
- BatchScaleImportanceDelegate, a new version of the importance scaling function that work in batches. It is not required to set both the ScaleImportance and the BatchScaleImportance function pointers. If the BatchScaleImportance is set, it is the preferred.
- TempStreamInitialSize, a new parameter in the GhostSendSystemData for tuning the initial size of the temporary buffer used by server to serialise ghosts. By default now the size is 8KB.
- AlwaysRelevantQuery to specify general rules for relevancy without specifying it ghost by ghost.
Changed
- 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
Fixed
- UI issue disallowing the user from enabling the Network Emulator utility when upgrading with a now-deprecated EditorPref value.
- an issue with pre-serialised ghosts, corrupting memory, crashing or copying wrong data into the snapshot buffer in certain conditions.
- avoided GC allocation and the costly Marshal.GetDelegateFromFunctionPointer every time an FunctionPointer.Invoke is called. This is done by using directly unmanaged function pointers. All this, compatible with Burst enabled/disabled at any time.
- lot of memory copies for loop invariants. This also reduced some SafetyChecks and costly operations.
- avoid costly re-serialization of the whole chunk when the temp buffer can't fit all the data. This is one of the biggest costs during the serialisation loop. By default now the buffer is 8KB that reduce this possibility almost to 0.
- Assigned InterpolationTick to always be equal ServerTick on the Server simulation (as stated in the summary for this parameter). Additionally the typos pointed out in the parameter summary were corrected.
- Issue where prespawn failed to initialize when relevancy list was updated before replicating internal prespawn ghosts.
1.2.0-pre.6
[1.2.0-pre.6] - 2023-12-13
Changed
- Promotion preparation
1.2.0-pre.4
[1.2.0-pre.4] - 2023-11-28
Added
- You can now disable the automatic Entities
ICustomBootstrap
bootstrapping (which calls NetCode's ownClientServerBootstrap
) by either; a) disabling it in the ProjectSettings (default value is enabled), or b) adding the newOverrideAutomaticNetcodeBootstrap
MonoBehaviour to your first build scene (i.e. your Active scene). Thus, there is no longer any need to write a custom bootstrap just to support a Frontend scene vs a Gameplay scene. - A
NetCodeConfig
ScriptableObject, containing most NetCode configuration variables, allowing customization without needing to modify code. Most variables are live-tweakable. - A 'Snapshot Sequence Id' (SSId), which is used to accurately measure packet loss. It adds 1 byte of header to each snapshot, but enables us to measure Netcode-caused causes of PL (i.e. out of order snapshots being discarded, and discarding a snapshot if another arrives on the same frame). Access statistics via a new struct on the client's
NetworkSnapshotAck
. RpcCollection.GetRpcHeaderLength
andNetworkStreamDriver.GetMaximumHeaderSize
to allow users to determine max safe payload sizes.
Fixed
- Esoteric exception in
MultiplayerPlaymodeWindow
in server-only cases. - Interpolated ghosts now support
IInputComponentData
andAutoCommandTarget
. - Improved
UpdateGhostOwnerIsLocal
to make it reactive toGhostOwner
changes, thus it no longer needs to poll. - NetDbg
ArgumentException
when a predicted ghost contains a replicated enableable flag component. - Display-only issue where the variants for additional entities (created via baking) were calculated as if they were 'root' entities. They are - in fact - child entities, thus the variants automatically selected for them should default to child defaults.
- QoL issue; we now allow users to opt-out of auto-baking
GhostAuthoringInspectionComponent
s when selecting their GameObject, reducing stalls when clicking around the Hierarchy or Project. - QoL issue where
GhostAuthoringInspectionComponent
was not always modifiable in areas of the Editor where it is valid to modify them. - Issue where
GhostAuthoringComponent
was disallowed in nested prefab setups (where the root prefab is NOT a ghost). - Log verbiage when creating a driver in DefaultDriverConstructor read like a 'call to action'. It's not.
1.1.0-pre.3
[1.1.0-pre.3] - 2023-10-17
Changed
- the DefaultTranslationSmoothingAction.DefaultStaticUserParams is now public and can be used by user code (to either change the defaults or use them in their own custom smoothing methods).
Fixed
- issue when using prediction error smoothing, causing wrong component data retrieved from the backup buffer and consequently not making the smoothing function work as expected.
- an issue in the reported elapsed time when executing the PredictedFixedStepSystemGroup in presence of partial ticks and PredictedFixedStepSimulationTickRatio grater than 1, causing problem with physics and character controller interpolation.
- An issue with the change mask not read correctly when serializing/deserializing components with more than 32 fields.
InvalidOperationException: Comparison function is incorrect
insideGhostComponentSerializerCollectionSystemGroup
due toComponentTypeSerializationStrategy.DefaultType
being abyte
flag enum (so it erroneously matched128 - 0
the same as0 - 128
due to wrapping).
1.1.0-exp.1
[1.1.0-exp.1] - 2023-09-18
Added
- source generator can now be configure to enable/disable logs, report timings. It also possible to set the minimal log level (by default is now Error).
- new public template specs and generator documentation
- Added convenience methods for getting the clientworld / serverworld (or thin client list) added to ClientServerBootstrap
- Additional analytics events. Multiplayer tools fields, prediction switching counters, tick rate configuration.
- New method on the
PredictedFixedStepSimulationSystemGroup
class to initialise the rate as a multiple of a base tick rate. Packet Fuzz %
is now configurable via the Network Simulator. It's a security tool that should not be enabled during normal testing. It's purpose is to test against malicious MitM attacks, which aim to take down your server via triggering exceptions during packet deserialization. Thus, all deserialization code should be written with safeguards and tolerances, ensuring your logic will fail gracefully.- CopyInputToCommandBufferSystemGroup group, that contains all the system that copy IInputCommandData to the underlying ICommand buffer. This let you now target this group with the guarantee that all inputs are not copied after it run.
- CopyCommandBufferToInputSystemGroup group, that contains all the system that copy ICommandData to their IInputCommandData representation. It runs first in the prediction loop and you can easily target it to do logic before or after the input are updated.
- GhostSpawnClassificationSystemGroup, that is aimed to contains all your classification systems in one place.
- Error messages to some missing
NetworkDriver.Begin/EndSend
locations. - defining
ENABLE_UNITY_RPC_REGISTRATION_LOGGING
will now log information about registered RPCs during netcode startup - We now automatically detect
Application.runInBackground
being set to false during multiplayer gameplay (a common error), and give advice via a suppressible error log as to why it should be enabled. - We introduced the new InputBufferData buffer, that is used as underlying container for all IInputComponentData.
- conditional compilation for some public interfaces in DefaultDriverBuilder to exclude the use of RegisterServer methods for WebGL build (they can't listen). It is possible to do everything manually, but the helper methods are not present anymore.
- new method for creating a NetworkDriver using WebSocketNetworkInterface.
- Added two new values to the
NetworkStreamDisconnectReason
enum:AuthenticationFailure
andProtocolError
. The former is returned when the transport is configured to use DTLS or TLS and it fails to establish a secure session. The latter is returned for low-level unexpected transport errors (e.g. malformed packets in a TCP stream).
Changed
- relaxed public field condition for variants. When declaring a ghost component variations, the variant fields are not required to be public. This make the type pretty much unusable for any other purpose but declaring the type serialisation.
- Increased the ThinClient cap on
MultiplayerPlayModePreferences.MaxNumThinClients
from 32 to 1k, to facilitate some amount of in-editor testing of high-player-counts. - NetcodeTestWorld updates the worlds in the same way the package does: first server, then all clients worlds.
- When Dedicated Server package is installed, the PlayMode Type value is overridden by the active Multiplayer Role.
Deprecated
- The public
PredictedFixedStepSimulationGroup.TimeStep
. You should always use thePredictedFixedStepSimulationGroup.ConfigureTimeStep
to setup the rate of thePredictedFixedStepSimulationSystemGroup.
. - the IInputBufferData interface (internal for code-gen use but public) has been deprecated and will be removed in the 1.2 release.
Fixed
- incorrect code generated serialization and calculated ChangeMask bits for component and buffers when the GhostFieldAttribute.Composite flag is set to true (in some cases).
- wrong check for typename in GhostComponentVariation
- missing region in unquantized float template, causing errors when used for interpolated field.
- improper check when the ClientServerSetting asset is saved, causing worker process not seeing the changes in the settings.
- The server world was not setting the correct rate to the group, if that was not done as part of the bootstrap.
- Exception thrown when the NetDbg tools is connecting to either the editor or player.
- Renamed (and marginally improved) the "Multiplayer PlayMode Tools" Window to the "PlayMode Tools" Window, to disambiguate it from "[MPPM] Multiplayer Play Mode" (an Engine feature).
- Attempting to access internals of Netcode for Entities (e.g. via Assembly Definition References) would cause compiler errors due to
MonoPInvokeCallbackAttribute
being ambiguous between AOT and Unity.Entities. - Packet dump logging exception when using relevancy, despawns, and packet dumps enabled. Also fixed performance overhead (as it was erroneously logging stack traces).
- An issue with variant hash calculation in release build, causing ghost prefab hash being different in between development/editor and release build.
- GhostUpdateSystem.RestoreFromBackup does not always invalidate/bump the chunk version for a component, but only if the chunk as changed since the last time the restore occurred.
- Issue in TryGetHashElseZero, that was using the ComponentType.GetDebugName to calculate the variant hash, leading incorrect results in a release player build
- A
NetworkDriver.BeginSend
error causing an infinite loop in theRpcSystem
. - Deprecated Analytics API when using 2023.2 or newer.
- compilation issue when using 2023.2, caused by an ambiguous symbol (define in both Editor and in Entities.Editor assembly)
- Errant netcode systems no longer show up in the DefaultWorld:
PhysicsWorldHistory
,SwitchPredictionSmoothingPhysicsOrderingSystem
,SwitchPredictionSmoothingSystem
,GhostPresentationGameObjectTransformSystem
,GhostPresentationGameObjectSystem
, andSetLocalPlayerGraphicsColorsSystem
. - Previous was hard to retrieve the generated buffer for a given IInputComponentData. Now is easy as doing something like InputBufferData.
- Compilation error when building for WebGL
- SnapshotDataLookupCache not created in the correct order, causing custom classification system using the SnapshotBufferHelper to throw exceptions, because the cache was not initialised.
- A replicated
[GhostEnabledBit]
flag component would throw anArgumentException
when added to a Prespawned Ghost due toArchetypeChunk.GetDynamicComponentDataArrayReinterpret
.
1.0.17
[1.0.17] - 2023-09-11
Added
- defining ENABLE_UNITY_RPC_REGISTRATION_LOGGING will now log information about registered RPCs during netcode startup
Changed
- NetcodePacket debug log filenames changed to include date/time and version information
Fixed
- addressed a case where it was possible for an exception to be thrown on the server if an RPC was queued for a then dropped connection.
- "AssetDatabase.RegisterCustomDependency are restricted during importing" exception thrown by the NetCodeClientSettings, NetCodeClientServerSettings, NetCodeServerSettings in their OnDisable method, when using 2023.2 or newer.