Releases: needle-mirror/com.unity.netcode
Releases · needle-mirror/com.unity.netcode
1.0.0-pre.47
[1.0.0-pre.47] - 2023-02-28
Fixed
- Snapshot history buffer not restore correctly, causing entities component to be stomped with random data.
1.0.0-pre.44
[1.0.0-pre.44] - 2023-02-13
Added
- Validation checks to the
GhostDistanceDataTileSizeto prevent invalid tile assignment or DivideByZeroException. - Added a HelpURL (linking to docs) for
DisableAutomaticPrespawnSectionReportingAuthoring,GhostAuthoringComponent,GhostAuthoringInspectionComponent,DefaultSmoothingActionUserParamsAuthoring,GhostPresentationGameObjectAuthoring,NetCodeDebugConfigAuthoring,GhostAnimationController,GhostPresentationGameObjectEntityOwner, andNetCodePhysicsConfig. - New GetLocalEndPoint API to NetworkStreamDriver
Changed
- Make EnablePacketLogging component public to allow for per connection debug information.
- Updated
com.unity.transportdependency to version 2.0.0-pre.6.
Fixed
- An issue with the
NetworkEmulatorin the editor when enabling domain reload (while switching play-mode) that was causing the game to forcibly immediately exit the the play state. - An issue with pre-spawned ghost baking when the baked entity has not LocalTransform (position/rotation for transform v1) component.
- "Ghost Distance Importance Scaling" is now working again. Ensure you read the updated documentation.
- Missing field write in
NetworkStreamListenSystem.OnCreate, fixing Relay servers. - Code-Generated Burst-compiled Serializer methods will now only compile inside worlds with
WorldFlag.GameClientandWorldFlag.GameServerWorldFlags. This improves exit play-mode speeds (when Domain Reload is enabled), baking (in all cases), and recompilation speeds. - Fixed an issue where multiple ghost types with the same archetype but difference data could sometime trigger errors about ghosts changing type.
- 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 IComponentDatainGhostPredictionHistorySystem.PredictionBackupJob. Added comprehensive test coverage for theGhostPredictionHistorySystem(via adding a predicted ghost version of theGhostSerializationTestsForEnableableBitstests). - 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. GhostUpdateSystemnow 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
- Exposed NetworkTick value to Entity Inspector
1.0.0-pre.15
[1.0.0-pre.15] - 2022-11-16
Added
- A "Client & Server Bounding Boxes" debug drawer has been added to the package (at
Packages\com.unity.netcode\Editor\Drawers\BoundingBoxDebugGhostDrawerSystem.cs), allowing you to view the absolute positions of where the client thinks a Ghost is, vs where it actually is on the server. This drawer can also be used to visualize relevancy logic (as you can see widgets for server ghosts that are "not relevant" for your client). Enable & disable it via theMultiplayer PlayMode Tools Window. - FRONTEND_PLAYER_BUILD scripting define added to the NetCodeClientSetting project setting.
- new GhostSpawnBufferInspectorHelper and GhostSpawnBufferComponentInspector structs, that permit to read from the ghost spawn buffer any type of component. They can be used in spawn classification systems to help resolving predicted spawning requests.
- GhostTypeComponent explicit conversion to Hash128.
- Templates for serialising
doubletype. - A
TransformDefaultVariantSystemthat optionally setup the default variant to use forLocalTransform, (Rotation,Positionfor V1) if a user defined default is not provided. - A
PhysicsDefaultVariantSystemthat optionally setup the default variant to use forPhysicVelocityif a user defined default is not provided.
Changed
- Updated com.unity.transport dependency to 2.0.0-exp.4
- SharedGhostTypeComponent is also added to the client ghost prefab to split ghosts in different chunks.
- GhostTypeComponent equals/match the prefab guid.
- Removed
CodeGenTypeMetaData, and made internal changes to howVariantTypestructs are generated. We also renamedVariantTypetoComponentTypeSerializationStrategiesto better reflect their purpose, and to better distinguish them from the concept of "Variants". - Support for replicating "enable bits" on
IEnableableComponents (i.e. "enableable components") via new attributeGhostEnabledBitAttribute([GhostEnabledBit]), which can be added to the component struct.
Note: If this attribute is not added, your enabled bits will not replicate (even on components marked with[GhostField]s).
This is a breaking change. Ensure all your "enableable components" with "ghost fields" on them now also have[GhostEnabledBit]on the struct declaration. - All
DefaultVariantSystemBaseare all grouped into theDefaultVariantSystemGroup. - It is not necessary anymore to define a custom
DefaultGhostVariantsystem if aLocalTransform(RotationorPositionfor V1) orPhysicsVelocityvariants are added to project (since a default selection is already provided by the package). - Updated com.unity.transport dependency to 2.0.0-pre.2
Removed
- Removing dependencies on
com.unity.jobspackage.
Fixed
- Error in source generator when input buffer type was in default namespace
- Always pass SystemState by ref to avoid UnsafeLists being reallocated in a copy but not the original.
- Use correct datatype for prespawned count in analytics.
- Use EditorAnalytics to verify whether it is enabled.
- exception thrown by the hierarchy window if a scene entity does not have a SubScene component.
- Issue with the GhostComponentSerializerRegistrationSystem and the ghost metadata registration system trying accessing the GhostComponentSerializerCollectionData before it is created.
- A crash in the GhostUpdateSystem, GhostPredictionHistorySystem and others, when different ghost types (prefab) share/have the same archetype.
- A NetCodeSample project issue that was causing screen flickering and entities rendered multiple times when demos were launched from the Frontend scene.
- an issue in the GhostSendSystem that prevent the DataStream to be aborted when an exception is throw while serialising the entities.
- InvalidOperationException in the
GhostAuthoringInspectionComponentwhen reverting a Variant back to the default. - UI layout issues with the
GhostAuthoringInspectionComponent. - Hashing issue with
GhostAuthoringInspectionComponent.ComponentOverridesduring baking, where out-of-date hashes would still be baked into the BlobAsset. You now get an error, pointing you to the offending (i.e. out-of-date) Ghost prefab. - quaternion cannot be added as field in ICommandData and/or IInputComponentData. A new region has been added to the code-generation templates for handling similar other cases.
- Fixed hash generation when using
DontSerializeVariant(orClientOnlyVariant) onDefaultVariantSystemBase.Rule. They now use the constant hashes (DontSerializeHashandClientOnlyHash). - NetDbg will now correctly show long namespaces in the "Prediction Errors" section (also: improved readability).
- Removed CSS warning in package.
- A problem with baking and additional ghost entities that was removing
LocalTransform,WorldTransformandLocalToWorldmatrix. - Mismatched ClientServerTickRate.SimulationTickRate and PredictedFixedStepSimulationSystemGroup.RateManager.Timestep will throw an error and will set the values to match each other.
Upgrade Guide
NetCodeClientTargetmoved from namespaceAuthoring.HybridtoUnity.NetCode.HybridVariantTypehas been renamed toSerializationStrategy, in an attempt to disambiguate the roles of “Variants” vs “Serialization Strategies”.ComponentTypeSerializationStrategy- Denotes the rules used to serialize a specific Component, on a specific GhostType.- “Variant” (via
GhostComponentVariation) - The name for a custom struct modifying the serialization rules for a singleComponentType.
- Defining
DefaultVariantSystemBaserules has changed. You now must pass in aDefaultVariantSystemBase.Rulerather than theSystem.Typeof the VariantType. VariantHashes for ghost variants may have changed. Make sure that there are no errors when baking all GhostTypes (in subscenes and prefabs), and use theGhostAuthoringInspectionComponentto debug and validate that the “default rules” (for yourComponentTypes) are correct. Note that GhostFields on components on child entities are no longer replicated (i.e. serialized) by default.- TRANSFORMS_V2 will break all Variant modifications made to (now legacy)
TranslationandRotationComponents. You'll need to either:- a) reimplement these custom Variants yourself (targeting
LocalTransform) or - b) use one of the new built-in
LocalTransformVariants provided. - Note that currently, these invalid "Component Overrides" on
GhostAuthoringInspectionComponentsare not automatically updated for you. They are simply force-deleted (with an associated error message, which should provide some useful context).
- a) reimplement these custom Variants yourself (targeting
1.0.0-exp.13
[1.0.0-exp.13] - 2022-10-19
Fixed
- quaternion cannot be added as field in ICommandData and/or IInputComponentData. A new region has been added to the code-generation templates for handling similar other cases.
- Removed the deprecated NativeList to NativeArray implicit cast and use NativeList.AsArray instead.
- fixed a NotImplementedException thrown in standalone player client build.
1.0.0-exp.8
[1.0.0-exp.8] - 2022-09-21
Added
- Added a new unified
NetCodePhysicsConfigto configure in one place all the netcode physics settings. LagCompensationConfig and PredictedPhysicsConfig are generated from these settings at conversion time. - Predicted ghost physics now use multiple physics world: A predicted physics wold simulated the ghost physics and a client-only physics world can be used for effect. For more information please refer to the predicted physics documentation.
- When there is a protocol version mismatch error when connecting, the versions and hashes used for the protocol are dumped to the log so it's easier to see why the versions don't match
- added some sanity check to prevent updating invalid ghosts
- Added a new method,
GhostPrefabCreation.ConvertToGhostPrefabwhich can be used to create ghost prefabs from code without having an asset for them. - Added a support for creating multiple network drivers. It is now possible to have a server that listen to the same port using different network interfaces (ex: IPC, Socket, WebSocket at the same time).
- Hybrid assemblies will not be included in DOTS Runtime builds.
- code generation documentation
- RegisterPredictedPhysicsRuntimeSystemReadWrite and RegisterPredictedPhysicsRuntimeSystemReadOnly extension methods, for tracking dependencies when using predicted networked physics systems.
- Support for runtime editing the number of ThinClients.
- Added: A new NetworkTime component that contains all the time and tick information for the client/server simulation. Please look at the upgrade guide for more information on how to update your project.
- Support for enabledbits.
- An input interface, IInputData, has been added which can be used to automatically handle input data as networked command data. The input is automatically copied into the command buffer and retrieved from it as appropriate given the current tick. Also added an InputEvent type which can be used inside such an input component to reliably synchronize single event type things.
- Added support for running the prediction loop in batches by setting
ClientTickRate.MaxPredictionStepBatchSizeRepeatedTickandClientTickRate.MaxPredictionStepBatchSizeFirstTimeTick. The batches will be broken on input changes unless the input data that changes is marked with[BatchPredict]. - Some optimisation to reduce the number of predicted tick and interpolation frames when using InProc client/server and IPC connection.
- Added a
ConnectionStatesystem state component which can be added to connection to track state changes, new connections and disconnects. - Added a
NetworkStreamRequestConnectcomponent which can be added to a new entity to create a new connection sintead of callingConnect. - Added
IsClient,IsServerandIsThinClienthelper methods toWorldandWorldUnmanaged. - Dependency on Unity.Logging package.
- Ghosts are now marked-up as Ghosts in the DOTS Hierarchy (Pink = Replicated, Blue = Prefab). The built-in Unity Hierarchy has a similar markup, although limited due to API limitations.
- The GhostAuthoringComponent now uses a ghost icon.
- Update API documentation for importance scaling functions and types
- Predicted Physics API documentation
- Helper methods to DefaultDriverBuilder, these allows creation and registering IPC- and Socket drivers. On the server both are used for the editor and only socket for player build. On the client either IPC if server and client is in the same process or socket otherwise.
- A Singleton API for Ghost Metrics.
- Helper methods RegisterClientDriver and RegisterServerDriver added to DefaultDriverBuilder. These takes certificate and keys necessary to initialize a secure connection.
- Improved the
GhostAuthoringComponentwindow, and movedComponentOverridesto a new, optional component;GhostAuthoringInspectionComponent. - Source generators now use a CancellationToken to early exit execution when cancellation is requested.
- NetworkStreamRequestListen to start listening to a new connection instead of invoking NetworkStreamDriver.Listen
- Helper methods RegisterClientDriver and RegisterServerDriver added to DefaultDriverBuilder. These takes relay server data to connect using a relay server.
- Analytics callback for ghost configuration as well as scene setup scaling.
- A default spawn classification system is will now handle client predicted spawns if the spawn isn't handled by a user system first (matches spawns of ghost types within 5 ticks of the spawn tick).
- GhostCollectionSystem optimisation when importing and processing ghost prefabs.
- A new sample that show how to backup/rollback non replicated components as part of the prediction loop.
- ChangeMaskArraySizeInBytes and SnapshotHeaderSizeInBytes utility methods
- internal extension to dynamic buffer, ElementAtRO, that let to get a readonly reference for a buffer element.
Changed
- hybrid will tick the client and server world using the player loop instead of relying on the default world updating the client and server world via the Tick systems.
- Predicted ghost physics now use custom system to update the physics simulation. The built-in system are instead used for updating the client-only simulatiom.
- The limit of 128 components with serialization is now for actively used components instead of components in the project.
- all errors are now reporting the location and is possible to go the offending source code file / class by clicking the error in the console log.
- removed unused GHOST_MASK_BATCH region from all templates
- PhysicsWorldHistory register readonly dependencies to the predicted runtime physics data when predicted physics is enabled.
- fixed crash in source generator if package cache folder contains temporary or invalid directory names.
- refactored source generators and added support for .additionalfile (2021.2+)
- Renamed
ClientServerTickRate.MaxSimulationLongStepTimeMultipliertoClientServerTickRate.MaxSimulationStepBatchSize NetDebugSystem.NetDebughas been replaced by aNetDebugsingleton.GhostSimulationSystemGroup.SpawnedGhostEntityMaphas been replaced by aSpawnedGhostEntityMapsingleton.- The interpolation delay is now calculated based on the perceived average snapshot ratio perceived by client, that help compensate for packet loss and jitter.
- Update to use StreamCompressionModel rather than deprecated type NetworkCompressionModel.
- Various improvements to the
Multiplayer PlayMode Tools Window, including; simulator "profiles" (which are representative of real-world speeds), runtime thin client creation/destruction support, live modification of simulator parameters, and a tool to simulate lag spikes via shortcut key. - The ghost relevancy map and mode has moved from the
GhostSendSystemto aGhostRelevancysingleton. - The
ConnectandListenmethods have moved to theNetworkStreamDriversingleton. - The utility method
GhostPredictionSystemGroup.ShouldPredicthas been moved to thePredictedGhostComponent. GhostCountOnServerandGhostCountOnClienthas been moved fromGhostReceiveSystemto a singleton APIGhostCount- The API to register smoothing functions for prediction has moved from the
GhostPredictionSmoothingSystemsystem to theGhostPredictionSmoothingsingleton. - The API to register RPCs and get RPC queues has moved from
RpcSystemto the singletonRpcCollection - Removed use of the obsolete AlwaysUpdateSystem attribute. The new RequireMatchingQueriesForUpdate attribute has been added where appropriate.
- Convert GhostDistancePartitioningSystem to ISystem
- GhostReceiveSystem converted to ISystem.
- Convert GhostSendSystem to ISystem. Public APIs have been moved to SingletonEntity named GhostSendSystemData
- PredictedPhysicsWorldHelper class visibility is internal.
- CommandReceiveClearSystem and CommandSendPacketSystem are not internal
- StartStreamingSceneGhosts and StopStreamingSceneGhosts to be internal RPC. If user wants to customise the prespawn scene flow, they need to add their own RPC.
- PrespawnsSceneInitialized, SubScenePrespawnBaselineResolved, PrespawnGhostBaseline,PrespawnSceneLoaded, PrespawnGhostIdRange have internal visibility.
- PrespawnSubsceneElementExtensions has internal visibility.
- LiveLinkPrespawnSectionReference are now internal. Used only in the Editor as a work around to entities conversion limitation. It should not be a public component that can be added by the user.
- Serialization code is now generated also for Component/Buffers/Commands/Rpcs that have internal visibility.
- The GhostCollectionSystem.CreatePredictedSpawnPrefab API is deprecated as clients will now automatically have predict spawned ghost prefabs set up for them. They can instantiate prefabs the normal way and don't need to call this API.
- Child entities in Ghosts now default to the
DontSerializeVariantas serializing child ghosts is relatively expensive (due to poor 'locality of reference' of child entities in other chunks, and the random-access nature of iterating child entities). Thus,GhostComponentAttribute.SendDataForChildEntity = falseis now the default, and you'll need to set this flag to true for all types that should be sent for children. If you'd like to replicate hierarchies, we strongly encourage you to create multiple ghost prefabs, with custom, faked transform parenting logic that keeps the hierarchy flat. Explicit child hierarchies should only be used if the snapshot updates of one hierarchy must be in sync. RegisterDefaultVariantshas changed signature to now use aRule. This forces users to be explicit about whether or not they want their user-defined defaults to apply to child entities too.- You must now opt-into "Prefab Override" customization for a specific type, via either:
a) Explicitly adding the[SupportPrefabOverride]attribute to the component.
b) Explicitly adding a custom variant of a Component via `[GhostComponentVariat...
0.51.1-preview.21
[0.51.1] - 2022-06-27
Changed
- Package Dependencies
com.unity.entitiesto version0.51.1
[0.51.0] - 2022-05-04
Changed
- Package Dependencies
com.unity.entitiesto version0.51.0
- Updated transport dependency to 1.0.0.
Added
- prevent the netcode generator running if the assembly compilation that does not references netcode package.
0.51.0-preview.32
[0.51.0] - 2022-05-04
Changed
- Package Dependencies
com.unity.entitiesto version0.51.0
- Updated transport dependency to 1.0.0.
[0.50.1] - 2022-03-18
Added
- Hybrid assemblies will not be included in DOTS Runtime builds.
Changed
- Changed: Tick systems (Initialization, Simulation, Presentation) are not created as part of the default client-server bootstrap for Hybrid and the Client and Server worlds are updated by the PlayerLoop instead.
Fixed
- Fixed an exception in
PhysicsWorldHistorywhen enabling lag compensation. - Fixed a rare compile error when source generators found invalid data in the package cache.
- Fixed issue that prevent systems been shown in System Hierarchy window.
- Fixed an issue where RPCs could be lost in rare cases when sending too many of them.
- Fix an incorrect overflow exception when pre-spawned or predicted spawned ghost serialize a subset of the fields.
0.50.1-preview.19
[0.50.1] - 2022-03-18
Added
- Hybrid assemblies will not be included in DOTS Runtime builds.
Changed
- Changed: Tick systems (Initialization, Simulation, Presentation) are not created as part of the default client-server bootstrap for Hybrid and the Client and Server worlds are updated by the PlayerLoop instead.
Fixed
- Fixed an exception in
PhysicsWorldHistorywhen enabling lag compensation. - Fixed a rare compile error when source generators found invalid data in the package cache.
- Fixed issue that prevent systems been shown in System Hierarchy window.
- Fixed an issue where RPCs could be lost in rare cases when sending too many of them.
- Fix an incorrect overflow exception when pre-spawned or predicted spawned ghost serialize a subset of the fields.
[0.50.0] - 2021-09-17
Added
- Added new methods
GhostSpawnSystem.ConvertGhostToInterpolatedandGhostSpawnSystem.ConvertGhostToPredictedfor switching the prediction mode of a ghost. The methods have an optional transition time parameter which when not zero will smoothly transition the visual transform from the old to the new state. - Made it possible for clients to on demand load ghost prefabs by setting
GhostCollectionPrefab.LoadingtoGhostCollectionPrefab.LoadingState.LoadingActivewhile the prefab is being loaded. - Added the possibility to dynamically load new sub-scenes with pre-spawned ghosts at runtime, while the both server and client are in game.
- Added the possibility for a client to have only a sub-set of scenes loaded in respect to the server. Client will be able to load / unload them on demand. Creating a singleton with a DisableAutomaticPrespawnSectionReporting component lets you disable the built-in sub-scene synchronisation and implement your own logic. Can be used to implement more complex streaming scenario or other special needs.
- Support for FirstSendImportanceMultiplier, which can be used to artificially inflate the importance of new (to the client) ghosts. I.e. Allows all ghosts to be sent to the client quickly, even if MinSendImportance is high.
- A DriverMigrationSystem to allow migration of a NetworkDriver and related Connection Entities. To see a working example look into the
WorldMigrationTests - Netcode bootstrap can now handle ISystemBase systems.
- The NetDbg will now auto-connect when you focus on it, or when it's first opened, unless you manually call disconnect.
- It is now possible to send commands without setting the
CommandTargetComponentif theICommandDatais on a ghost which is predicted, owned by the current connection and hasSupportAutoCommandTargetenabled in the authoring component.SupportAutoCommandTargetwill add aAutoCommandTargetcomponent, the server can set theEnabledmember to false to prevent commands from being sent. TheAutoCommandTargetcan be used to send commands for multiple entities. It is also possible to have multipleICommandDataon the same entity, both forAutoCommandTargetandCommandTargetComponent. - Added
ClientServerTickRate.MaxSimulationLongStepTimeMultiplierwhich allows you to run server ticks with longer delta time instead of, or in addition to, running more ticks in a frame. - Added
ClientServerTickRate.SendSnapshotsForCatchUpTicksto decide if the server should send snapshots for all ticks or just the last when it needs multiple ticks in a frame. The default is to only send snapshot for the last tick.
Changed
- Changed
GhostFieldAttribute.MaxSmoothingDistancefrominttofloat - Changed
ConnectionAcceptJob.debugPrefixfromFixedString32toFixedString128to account for longer world names. - Made sure despawning can handle large number of ghosts desapwning at the same time. This also reduces the bandwidth required to despawn, but can increase the latency of despawns if there is packet-loss.
- UpdateInWorld renamed to UpdateInWorldAttribute
- UpdateInWorld.TargetWorld enum move to Unity.NetCode namespace.
- Client can now enter/exit from "in game" without the need to disconnect from the server.
- Server can now stop streaming ghosts to all clients (exit from game), load a new scene/subscene and start streaming ghost again.
GhostPredictionDebugSystemonly runs when NetDbg is connected and processes more errors in parallel to improve performance.- Use stopwatch instead of TimeSpan for dots-runtime portability
- Improve the handling of ticks when applying ghost state to avoid errors about not having a state to roll back to.
- Server is now responsible to assign to all the pre-spawned ghosts their unique id.
- All types in the generated serialiser now use qualified names
- Debug logging is implemented using com.unity.logging
- Added validation check on the server side that verify the command target entity, when set, has a ICommandData buffer.
- Fixed command age not updated on the server if a non null entity target is set but no command data buffer is present. That was causing problem on the clients that were constantly increasing the prediction loop count and dropping the frame rate.
- Pre-spawned ghost entities are disabled during conversion and re-enabled at runtime after their baseline are initialised. This should prevent user code to modify components before the entities are ready and consequently avoiding pre-spawned ghost hash validation failures.
- An error is reported if a fields in ICommandData/IRpcCommand or replicated fields in IComponentData/IBufferElement starts with the reserver prefix __GHOST or __COMMAND
- Replaced the out-out
DisableLagCompensationwith an opt-inLagCompensationConfig. - Removed previously deperecated
GhostCollectionAuthoringComponent. - Undeprecated
ConvertToClientServerEntity. It was deprecated because the old source gen could no support runtime conversion of ghosts, that is not a problem in the new source generator. We still recommend using subscenes for everything involving ghosts. NetworkStreamCloseSystemhas been moved toNetworkReceiveSystemGroup.- Network connection entities now has
LinkedEntityGroupwhich makes it easier to delete ghosts on disconnection in simple cases. - The
GhostAuthoringComponenthas a new checkbox for adding aGhostOwnerComponentto a ghost without additional authoring components. - SceneLoadingTests are not Editor only tests
- Websocket's DebugWebSocket code fixed for il2cpp tests
Fixed
- Fixed GhostAuthoringEditor not showing the correct default variant assigned to a component.
- Fixed memory leak. GhostVariantAssignmentCollection blob data not disposed.
- Fixed issue with ghost variant cache. GhostComponentVariation attribute where collected only if the annotated struct was public.
- Stale inputs are no longer stored in the input buffer on the server. This makes it more reliable to compare current input state to last frames state.
- Avoid overflow in RTT calculation if reported processing time is greater than the calculated delta time
- Fixed hash calculation for child entities
- Fixed an inconsistency error thrown when registering a generic job with a generic RPC type by changing the accessibility of 'RpcCommandRequest.SendRpcData' from protected to public
- Fixed wrong stats packet size that was causing random crashes.
- Fix GhostStatsSystem try access a NetworkAckComponent singleton when it does not exists (client only)
- Typo in GhostSnapshotValueULong that cause compilation error when an RPC contains unsigned long fields.
- LogAssert.ignoreFailingMessages not reset to true, causing some failing tests not being reported.
- IrrelevantImportanceDownScale is now guarded to not go below 1.
SnapshotDataBufferandSnapshotDynamicDataBuffernow use[InternalBufferCapacity(0)], which will reduce entity size in a chunk.- Compilation error due to generated serializer class trying to cast types without prepending the correct namespace.
- Ghost gen fails with GhostCodeGen failed for fragment.. if you have a namespace, typename or field name start with double underscores. An error is actually reported if GHOSTXXX or COMMANDXXX keywords are present.
- UX improvement when creating an invalid Ghost Authoring.
- No error reported if an component implement multiple interfaces at the same time, causing generating code for the wrong one.
- PacketLogger output files are now saved for standalone player in Application.consoleLogPath instead of current folder, causing errors in some platform/environment.
- No compilation errors for missing assemblies references are reported anymore if the assembly that does not contains types which require code-generated serializers.
- Overriding nested component in a prefab will be assigned correct GameObject reference
Upgrade guide
- TargetWorld enum is now part of the Unity.NetCode namespace. Find and replace all the
UpdateInWorld.TargetWorldoccurrences withTargetWorldand continue to keep the enum old value. DisableLagCompensationno longer exists. If you were note using lag compensation you can remove it, if you were using lag compensation you must add aLagCompensationConfigin order for it to run.GhostCollectionAuthoringComponentis now removed, see previous upgrade guide and the getting started doc page for information on what to do instead.
0.50.0-preview.29
[0.50.0] - 2021-09-17
Added
- Added new methods
GhostSpawnSystem.ConvertGhostToInterpolatedandGhostSpawnSystem.ConvertGhostToPredictedfor switching the prediction mode of a ghost. The methods have an optional transition time parameter which when not zero will smoothly transition the visual transform from the old to the new state. - Made it possible for clients to on demand load ghost prefabs by setting
GhostCollectionPrefab.LoadingtoGhostCollectionPrefab.LoadingState.LoadingActivewhile the prefab is being loaded. - Added the possibility to dynamically load new sub-scenes with pre-spawned ghosts at runtime, while the both server and client are in game.
- Added the possibility for a client to have only a sub-set of scenes loaded in respect to the server. Client will be able to load / unload them on demand. Creating a singleton with a DisableAutomaticPrespawnSectionReporting component lets you disable the built-in sub-scene synchronisation and implement your own logic. Can be used to implement more complex streaming scenario or other special needs.
- Support for FirstSendImportanceMultiplier, which can be used to artificially inflate the importance of new (to the client) ghosts. I.e. Allows all ghosts to be sent to the client quickly, even if MinSendImportance is high.
- A DriverMigrationSystem to allow migration of a NetworkDriver and related Connection Entities. To see a working example look into the
WorldMigrationTests - Netcode bootstrap can now handle ISystemBase systems.
- The NetDbg will now auto-connect when you focus on it, or when it's first opened, unless you manually call disconnect.
- It is now possible to send commands without setting the
CommandTargetComponentif theICommandDatais on a ghost which is predicted, owned by the current connection and hasSupportAutoCommandTargetenabled in the authoring component.SupportAutoCommandTargetwill add aAutoCommandTargetcomponent, the server can set theEnabledmember to false to prevent commands from being sent. TheAutoCommandTargetcan be used to send commands for multiple entities. It is also possible to have multipleICommandDataon the same entity, both forAutoCommandTargetandCommandTargetComponent. - Added
ClientServerTickRate.MaxSimulationLongStepTimeMultiplierwhich allows you to run server ticks with longer delta time instead of, or in addition to, running more ticks in a frame. - Added
ClientServerTickRate.SendSnapshotsForCatchUpTicksto decide if the server should send snapshots for all ticks or just the last when it needs multiple ticks in a frame. The default is to only send snapshot for the last tick.
Changed
- Changed
GhostFieldAttribute.MaxSmoothingDistancefrominttofloat - Changed
ConnectionAcceptJob.debugPrefixfromFixedString32toFixedString128to account for longer world names. - Made sure despawning can handle large number of ghosts desapwning at the same time. This also reduces the bandwidth required to despawn, but can increase the latency of despawns if there is packet-loss.
- UpdateInWorld renamed to UpdateInWorldAttribute
- UpdateInWorld.TargetWorld enum move to Unity.NetCode namespace.
- Client can now enter/exit from "in game" without the need to disconnect from the server.
- Server can now stop streaming ghosts to all clients (exit from game), load a new scene/subscene and start streaming ghost again.
GhostPredictionDebugSystemonly runs when NetDbg is connected and processes more errors in parallel to improve performance.- Use stopwatch instead of TimeSpan for dots-runtime portability
- Improve the handling of ticks when applying ghost state to avoid errors about not having a state to roll back to.
- Server is now responsible to assign to all the pre-spawned ghosts their unique id.
- All types in the generated serialiser now use qualified names
- Debug logging is implemented using com.unity.logging
- Added validation check on the server side that verify the command target entity, when set, has a ICommandData buffer.
- Fixed command age not updated on the server if a non null entity target is set but no command data buffer is present. That was causing problem on the clients that were constantly increasing the prediction loop count and dropping the frame rate.
- Pre-spawned ghost entities are disabled during conversion and re-enabled at runtime after their baseline are initialised. This should prevent user code to modify components before the entities are ready and consequently avoiding pre-spawned ghost hash validation failures.
- An error is reported if a fields in ICommandData/IRpcCommand or replicated fields in IComponentData/IBufferElement starts with the reserver prefix __GHOST or __COMMAND
- Replaced the out-out
DisableLagCompensationwith an opt-inLagCompensationConfig. - Removed previously deperecated
GhostCollectionAuthoringComponent. - Undeprecated
ConvertToClientServerEntity. It was deprecated because the old source gen could no support runtime conversion of ghosts, that is not a problem in the new source generator. We still recommend using subscenes for everything involving ghosts. NetworkStreamCloseSystemhas been moved toNetworkReceiveSystemGroup.- Network connection entities now has
LinkedEntityGroupwhich makes it easier to delete ghosts on disconnection in simple cases. - The
GhostAuthoringComponenthas a new checkbox for adding aGhostOwnerComponentto a ghost without additional authoring components. - SceneLoadingTests are not Editor only tests
- Websocket's DebugWebSocket code fixed for il2cpp tests
Fixed
- Fixed GhostAuthoringEditor not showing the correct default variant assigned to a component.
- Fixed memory leak. GhostVariantAssignmentCollection blob data not disposed.
- Fixed issue with ghost variant cache. GhostComponentVariation attribute where collected only if the annotated struct was public.
- Stale inputs are no longer stored in the input buffer on the server. This makes it more reliable to compare current input state to last frames state.
- Avoid overflow in RTT calculation if reported processing time is greater than the calculated delta time
- Fixed hash calculation for child entities
- Fixed an inconsistency error thrown when registering a generic job with a generic RPC type by changing the accessibility of 'RpcCommandRequest.SendRpcData' from protected to public
- Fixed wrong stats packet size that was causing random crashes.
- Fix GhostStatsSystem try access a NetworkAckComponent singleton when it does not exists (client only)
- Typo in GhostSnapshotValueULong that cause compilation error when an RPC contains unsigned long fields.
- LogAssert.ignoreFailingMessages not reset to true, causing some failing tests not being reported.
- IrrelevantImportanceDownScale is now guarded to not go below 1.
SnapshotDataBufferandSnapshotDynamicDataBuffernow use[InternalBufferCapacity(0)], which will reduce entity size in a chunk.- Compilation error due to generated serializer class trying to cast types without prepending the correct namespace.
- Ghost gen fails with GhostCodeGen failed for fragment.. if you have a namespace, typename or field name start with double underscores. An error is actually reported if GHOSTXXX or COMMANDXXX keywords are present.
- UX improvement when creating an invalid Ghost Authoring.
- No error reported if an component implement multiple interfaces at the same time, causing generating code for the wrong one.
- PacketLogger output files are now saved for standalone player in Application.consoleLogPath instead of current folder, causing errors in some platform/environment.
- No compilation errors for missing assemblies references are reported anymore if the assembly that does not contains types which require code-generated serializers.
- Overriding nested component in a prefab will be assigned correct GameObject reference
Upgrade guide
- TargetWorld enum is now part of the Unity.NetCode namespace. Find and replace all the
UpdateInWorld.TargetWorldoccurrences withTargetWorldand continue to keep the enum old value. DisableLagCompensationno longer exists. If you were note using lag compensation you can remove it, if you were using lag compensation you must add aLagCompensationConfigin order for it to run.GhostCollectionAuthoringComponentis now removed, see previous upgrade guide and the getting started doc page for information on what to do instead.
[0.8.0] - 2021-03-23
New features
- New code-generation system based on Roslyn source generators.
- Added pre-serialization support to ghosts which can reduce CPU time for serializing complex ghosts which are sent to multiple connections every frame.
- Added parameters to control how much data the server serializes based on CPU time in addition to bandwith. The parameters are MinSendImportance, MinDistanceScaledSendImportance, MaxSendChunks and MaxSendEntities.
- Added default baselines for pre-spawned ghosts
- Added bandwidth (and cpu) optimization for pre-spawned ghosts when a new client connect to the server. Only pre-spawned ghosts which have changed in respect their default baseline are sent.
If static optimization is turned on, no data is sent for the prespawns unless changed. - Added runtime client/server validation to verify that pre-spawned ghosts baselines and sub-scenes has the same data on both client and server.
Changes
- Entities created by NetCode now has appropriate names
- Removed IGhostDefaultOverridesModifier.
- To modify or changed the component/buffer serialization GhostComponentVariation must be used instead.
- To add custom templates you should implement the partial class
UserDefinedTemplates
- NetCode generated classes are not presents in the project anymore.
- NetCode code generation windows has been removed
- It is now possible to keep snapshot history on structural changes in some cases when `GhostSendSystem.KeepSnapshotHisto...
0.6.0-preview.7
[0.6.0] - 2020-11-26
New features
- Added DynamicBuffers serialization support to ghosts. Like IComponentData, is now possible to annotate IBufferElementData with GhostComponentAttribute and members with GhostFieldAttribute
and having the buffers replicated through the network. - ICommandData are now serializable and can be sent to the remote players.
- Added new SendToOwner property to the GhostComponentAttribute that can be used to configure to witch
subset of players the component should be sent to: only to the owner, only to the non owner, or all. - Ghost Component Serialization Variant. A new GhostComponentVariation attribute has been introduced that let you to specify different serialization options for a component or buffer, by overriding
the[GhostField]and[GhostComponent]properties present in the original type definition. - It is possible to prevent a component to support variation by using the
[DontSupportVariation]attribute. When present, if a GhostComponentVariation is defined for that type, an exception is triggered. - Ghost components attributes and serialization variants can be customized per prefabs. For every component in a ghost prefab, it is possible to change:
- PrefabType
- GhostSendType
- The variant to use, if variants for that component exist.
- Is possible to prevent a component to support per-prefab overrides by using the [DontSupportPrefabOverride] attribute. When present, the component can't be further customized in the inspector.
- It's now possible to register a prediction smoothing function, by calling the
GhostPredictionSmoothingSystem.RegisterSmoothingAction<ComponentType>(SmoothingActionDelegate)and supplying aComponentTypeandGhostPredictionSmoothingSystem.SmoothingActionDelegate(see Runtime/Snapshot/DefaultUserParams.cs for an example). - Added a new
ClientTickRatecomponent which when added to a singleton entity controls the interpolation times used to calculate time on the client. The default values can be accessed through the staticNetworkTimeSystem.DefaultClientTickRate. - Added support for extrapolation when the tick being applied to interpolated ghosts on the client has not been received yet and is outside the interpolation delay. Set the new
Smoothingfield in theGhostFieldattribute toSmoothingAction.InterpolateAndExtrapolateto enable extrapolation. - Added a
MaxSmoothingDistanceparameter to the[GhostField]attribute. If specified interpolation will be disabled when the values change more than that limit between two snapshots. This is useful for dealing with teleportation and similar changes which should not be interpolated.
Changes
- It is no longer required to create a ghost collection, as long as there is a prefab for a ghost it will be picked up automatically. You can create a prefab by referencing it in a spawner component or by placing a pre spawned instance of a ghost.
Fixes
- Fixed an issue where the elapsed time was not using the max simulation rate - causing the fixed time step physics to take more and more time.
- Fixed an issue causing time rollbacks when running client and server in the editor if performance is too low.
Upgrade guide
The Interpolate bool in the GhostField attribute has been replaced with Smoothing. Replace Interpolate=true with Smoothing=SmoothingAction.Interpolate to keep the old value, or set it to SmoothingAction.InterpolateAndExtrapolate to enable extrapolation.
[0.5.0] - 2020-10-01
New features
- Added RpcSystem.DynamicAssemblyList which can be used to delay the checksums for RPCs and ghost components when the set of assemblies are different on the client and server.
- Added to RPC and Command the possiblity to send Entity reference from both client and server.
Changes
- Change the system ordering to be compatible with latest physics.
NetworkTimeSystemhas moved toClientInitializationSystemGroup. The SimulationSystemGroup runsGhostSpawnSystemGroup(client),GhostReceiveSystemGroupandGhostSimulationSystemGroupbeforeFixedStepSimulationSystemGroupwhere physics is running.RpcCommandRequestSystemGroup,RpcSystemandGhostSendSystem(server) is running at the end of the frame, after all simulation code. Other systems has been moved into one of the groups. - Created a new
GhostInputSystemGroupwhere systems adding inputs to the input buffer should run.
Fixes
Upgrade guide
- The systems adding input to the
ICommandDatabuffer needs to be moved toGhostInputSystemGroup