Skip to content

Commit

Permalink
4.6.1
Browse files Browse the repository at this point in the history
- Added preciseTick.AsDouble extension.
- Added double.AsPreciseTick extension.
- Added NetworkObject.IsDestroying to know when a NetworkObject is being destroyed or pooled during OnStop callbacks.
- Added TimeManager.TimeToTicks(long).
- Added NetworkObject.IsInitializedNested.
- Added ServerSpawner component which automatically spawns NetworkObjects when the server starts.
- Added OfflineTickSmoother.
- Added NetworkTickSmoother.
- Fixed Network/OfflineTickSmoother detach/reattach settings not working (Introduced in 4.6.0).
- Improved ReplicateState terminology: Future is now only ever true when reconciling, and when data tick has not been run as Current.
- Changed ReplicateState is now a flag.
- Changed ReplicateState previous values now use flag checks internally.
- Added replicateState.FastContains for flag checking.
- Added ReplicateState.IsCurrent, which is the opposite of IsFuture.
- Obsoleted several ReplicateState values in favor of new terminology.
- Improved CharacterControllerPrediction demo notes.
- Improved CharacterControllerPrediction now uses NetworkTrigger to attach and detach from platforms.
- Improved Stable and Beta mode are now available per feature.
- Improved several API and ToString methods to be more verbose.
- Improved PlayerSpawner to find NetworkManager within hierarchy, using InstanceFinder only as a fallback.
- Changed PredictionManager.StateInterpolation is now public.
- Changed Reader.Initialize methods are now public.
- Fixed set RollbackPhysicsType enum as flag.
- Fixed OnStop callbacks not firing on Instantiated objects nested to scene objects when server suddenly disconnects.
Removed debug.
- Fixed DefaultScene incorrectly loading Offline scene when a server stops, even if another server is running such as through Multipass.
- Fixed TimeManager.Tick drifting with latency.
- Fixed UseGlobalCustomSerializer attribute not working on types within read-only assemblies.
- Fixed Object Initialized Twice Error when stopping and starting all sockets without stopping the editor or application.
- Fixed conditional Writer corruption when manually calling RebuildObservers.
- Fixed NetworkObject.SetInitializedValues not running on prefab scene objects with properties that differed from the prefabs.
- Fixed nested NetworkObjects being destroyed on socket stop when using object pooling (#842).
- Fixed collection modified error when using extension transform.DestroyChildren with destroyImmediate as true.
- Fixed BandwidthDisplay showing flipped in/out values for client usage (#843).
- Fixed NetworkCollider/Trigger sometimes incorrectly firing OnEnter/Exit events during reconcilations.
- Obsoleted NetworkBehaviour/Object.HasAuthority; replaced with IsController.
- Obsoleted DetachableNetworkTickSmoother; replaced with NetworkTickSmoother.
- Obsoleted MonoTickSmoother; replaced with OfflineTickSmoother.
- Obsoleted NetworkObject smoother settings in favor of using NetworkTickSmoother.
- Removed HistoryDuration on NetworkCollider/Trigger as it is no longer needed.
- Removed unused ReplicateState values.
  • Loading branch information
FirstGearGames committed Feb 25, 2025
1 parent fdc8fcb commit 5bdacb5
Show file tree
Hide file tree
Showing 131 changed files with 5,592 additions and 4,967 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public PredictionReaders(MethodReference replicateReader, MethodReference reconc
public override bool ImportReferences()
{
System.Type locType;
SR.MethodInfo locMi;
//SR.MethodInfo locMi;

base.ImportReference(typeof(BasicQueue<>));
ReplicateULDelegate_TypeRef = base.ImportReference(typeof(ReplicateUserLogicDelegate<>));
Expand Down
8 changes: 4 additions & 4 deletions Assets/FishNet/CodeGenerating/Processing/ReaderProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ internal void CreateInitializeDelegate(MethodReference readMr)
/* If a global serializer is declared for the type
* and the method is not the declared serializer then
* exit early. */
if (wp.IsGlobalSerializer(readMr.ReturnType) && readMr.Name.StartsWith(UtilityConstants.GeneratedReaderPrefix))
if (wp.DeclaresUseGlobalCustomSerializer(readMr.ReturnType) && readMr.Name.StartsWith(UtilityConstants.GeneratedReaderPrefix))
return;

GeneratedReader_OnLoad_MethodDef.RemoveEndRet(base.Session);
Expand Down Expand Up @@ -294,7 +294,7 @@ internal List<Instruction> CreateRead(MethodDefinition methodDef, ParameterDefin
if (readMr != null)
{
TypeReference dataTr = readMr.ReturnType;
bool isGlobalSerializer = base.GetClass<WriterProcessor>().IsGlobalSerializer(dataTr);
bool isGlobalSerializer = base.GetClass<WriterProcessor>().DeclaresUseGlobalCustomSerializer(dataTr);

//Make a local variable.
createdVariableDef = base.GetClass<GeneralHelper>().CreateVariable(methodDef, readTypeRef);
Expand Down Expand Up @@ -340,7 +340,7 @@ internal bool CreateReadIntoClassOrStruct(MethodDefinition readerMd, ParameterDe
if (readMr != null)
{
WriterProcessor wp = base.GetClass<WriterProcessor>();
bool isGlobalSerializer = (wp.IsGlobalSerializer(encasingValueVd.VariableType) || wp.IsGlobalSerializer(memberValueFr.FieldType));
bool isGlobalSerializer = (wp.DeclaresUseGlobalCustomSerializer(encasingValueVd.VariableType) || wp.DeclaresUseGlobalCustomSerializer(memberValueFr.FieldType));

ILProcessor processor = readerMd.Body.GetILProcessor();
/* How to load object instance. If it's a structure
Expand Down Expand Up @@ -448,7 +448,7 @@ internal void CreateInitializeDelegates()
internal bool HasDeserializer(TypeReference typeRef, bool createMissing)
{
bool result = (GetInstancedReadMethodReference(typeRef) != null) ||
(GetStaticReadMethodReference(typeRef) != null);
(GetStaticReadMethodReference(typeRef) != null) || base.GetClass<WriterProcessor>().DeclaresUseGlobalCustomSerializer(typeRef);

if (!result && createMissing)
{
Expand Down
14 changes: 7 additions & 7 deletions Assets/FishNet/CodeGenerating/Processing/WriterProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private void CreateInitializeDelegate(MethodReference writeMr)
/* If a global serializer is declared for the type
* and the method is not the declared serializer then
* exit early. */
if (IsGlobalSerializer(writeMr.Parameters[1].ParameterType) && writeMr.Name.StartsWith(UtilityConstants.GeneratedWriterPrefix))
if (DeclaresUseGlobalCustomSerializer(writeMr.Parameters[1].ParameterType) && writeMr.Name.StartsWith(UtilityConstants.GeneratedWriterPrefix))
return;

//Check if ret already exist, if so remove it; ret will be added on again in this method.
Expand Down Expand Up @@ -314,7 +314,7 @@ private void CreateInitializeDelegate(MethodReference writeMr)
internal bool HasSerializer(TypeReference typeRef, bool createMissing)
{
bool result = (GetInstancedWriteMethodReference(typeRef) != null) ||
(GetStaticWriteMethodReference(typeRef) != null);
(GetStaticWriteMethodReference(typeRef) != null) || DeclaresUseGlobalCustomSerializer(typeRef);

if (!result && createMissing)
{
Expand Down Expand Up @@ -522,7 +522,7 @@ internal void CreateWriteBool(ILProcessor processor, ParameterDefinition writerP
/// <summary>
/// Returns if a type should use a declared/custom serializer globally.
/// </summary>
public bool IsGlobalSerializer(TypeReference dataTypeRef)
public bool DeclaresUseGlobalCustomSerializer(TypeReference dataTypeRef)
{
return dataTypeRef.CachedResolve(base.Session).HasCustomAttribute<UseGlobalCustomSerializerAttribute>();
}
Expand All @@ -538,7 +538,7 @@ internal List<Instruction> CreateWriteInstructions(MethodDefinition methodDef, o

if (writeMr != null)
{
bool isGlobalSerializer = IsGlobalSerializer(valueParameterDef.ParameterType);
bool declaresUseGlobalSerializer = DeclaresUseGlobalCustomSerializer(valueParameterDef.ParameterType);

if (pooledWriterDef is VariableDefinition)
{
Expand Down Expand Up @@ -567,7 +567,7 @@ internal List<Instruction> CreateWriteInstructions(MethodDefinition methodDef, o
writeMr = writeMr.GetMethodReference(base.Session, genericTr);
}

if (isGlobalSerializer)
if (declaresUseGlobalSerializer)
{
//Switch out to use WriteUnpacked<T> instead.
writeMr = base.GetClass<WriterImports>().Writer_Write_MethodRef.GetMethodReference(base.Session, valueTr);
Expand Down Expand Up @@ -604,7 +604,7 @@ internal void CreateWrite(MethodDefinition writerMd, ParameterDefinition encasin
{
if (writeMr != null)
{
bool isGlobalSerializer = (IsGlobalSerializer(memberValueFd.FieldType) || IsGlobalSerializer(encasingValuePd.ParameterType));
bool declaresUseGlobalSerializer = (DeclaresUseGlobalCustomSerializer(memberValueFd.FieldType) || DeclaresUseGlobalCustomSerializer(encasingValuePd.ParameterType));

ILProcessor processor = writerMd.Body.GetILProcessor();
ParameterDefinition writerPd = writerMd.Parameters[0];
Expand Down Expand Up @@ -639,7 +639,7 @@ internal void CreateWrite(MethodDefinition writerMd, ParameterDefinition encasin
* across assemblies, but at runtime we can make sure to favor the
* created one as described above. */
//True if has Write prefix for generated writers.
if (isGlobalSerializer)
if (declaresUseGlobalSerializer)
{
//Switch out to use WriteUnpacked<T> instead.
TypeReference genericTr = base.ImportReference(memberValueFd.FieldType);
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

21 changes: 21 additions & 0 deletions Assets/FishNet/Demos/Benchmarks/NetworkTransform/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This is a simple benchmark for our NetworkTransform component.

Setup:
* Start server and client in two editors, or clientHost.

Notes:
* To configure spawned object:
* Open NetworkTransform Benchmark scene.
* Select any prefab NetworkTransform Benchmark XYZ.

* To configure spawn count:
* Open NetworkTransform Benchmark scene.
* Select Prefab Spawner, and set amount.

* To configure tick rate:
* Open NetworkTransform Benchmark scene.
* Select NetworkManager, change Tick Rate on TimeManager.

* To configure object rates and movement:
* Open prefab NetworkTransform Benchmark XYZ.
* Configure MoveRandomly.
Loading

0 comments on commit 5bdacb5

Please sign in to comment.