Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed on expression #743

Closed
SnaiperoG3D opened this issue Aug 1, 2024 · 5 comments
Closed

Assertion failed on expression #743

SnaiperoG3D opened this issue Aug 1, 2024 · 5 comments
Labels
Bug Something isn't working Resolved Pending Release

Comments

@SnaiperoG3D
Copy link

SnaiperoG3D commented Aug 1, 2024

General
Unity version: 2022.3.29f1
Fish-Networking version: 4.3.5Pro
Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1066802880151048212

Description
Floating error appears with RollbackManager on server side with client and server setup with parrelsync in 2 windows. Found in Discord 3 messages with this error. One of them have info that for some reason Quaternion null was recorded, but its not. I did debug in placed where new rollback record goes and where lerp goes. There are no null quaternion adds in AddSnapshot method. So i believe that problem in recycle snapshots code part.
Assertion failed on expression: '!CompareApproximately(aScalar, 0.0F)' UnityEngine.Quaternion:Lerp (UnityEngine.Quaternion,UnityEngine.Quaternion,single) FishNet.Component.ColliderRollback.ColliderRollback/RollingCollider:Rollback (FishNet.Component.ColliderRollback.ColliderRollback/FrameRollbackTypes,int,single) (at Assets/FishNet/Runtime/Plugins/ColliderRollback/Scripts/ColliderRollback.cs:113) FishNet.Component.ColliderRollback.ColliderRollback:Rollback (single) (at Assets/FishNet/Runtime/Plugins/ColliderRollback/Scripts/ColliderRollback.cs:401) FishNet.Component.ColliderRollback.RollbackManager:Rollback (int,FishNet.Managing.Timing.PreciseTick,FishNet.Component.ColliderRollback.RollbackPhysicsType,bool) (at Assets/FishNet/Runtime/Plugins/ColliderRollback/Scripts/RollbackManager.cs:281) FishNet.Component.ColliderRollback.RollbackManager:Rollback (FishNet.Managing.Timing.PreciseTick,FishNet.Component.ColliderRollback.RollbackPhysicsType,bool) (at Assets/FishNet/Runtime/Plugins/ColliderRollback/Scripts/RollbackManager.cs:236) DamageRegister:TimeManager_OnTick () (at Assets/Game/Scripts/Player/DamageRegister.cs:84) FishNet.Managing.Timing.TimeManager:IncreaseTick () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:678) FishNet.Managing.Timing.TimeManager:<TickUpdate>g__MethodLogic|98_0 () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:342) FishNet.Managing.Timing.TimeManager:TickUpdate () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:332) FishNet.Transporting.NetworkReaderLoop:Update () (at Assets/FishNet/Runtime/Transporting/NetworkReaderLoop.cs:28)

Replication
Cant find 100% variant to repeat yet. In my case it happens when 50 bots with rollback collider on them

Expected behavior
No errors

@SnaiperoG3D
Copy link
Author

I did investigate into rollback code. And i have one theory. rollbackType is determined depends of decimalFrame and _maxSnapshots. decimalFrame depends of TickDelta, but _maxSnapshots setted in Initialize once. So i believe that error happens when Rollback called, but ColliderRollback doesnt have records yet, but _maxSnapshots setted to 2 minimum. In situation for example, when nob with ColliderRollback spawned on tick when Rollback called or + 1 tick. This therory explains why in my case it happens when a lot of bots in game, because my bots killing each other very often

@SnaiperoG3D
Copy link
Author

SnaiperoG3D commented Aug 1, 2024

Yes, i was right. Problem appear when nob spawned at same tick when Rollback call. I did logs when bot spawned and when Assertion failed error appear. Both errors goes to same nob when click on them.
image
Assertion failed appears on nob what was spawned at same tick, 701 in this case.

@SnaiperoG3D
Copy link
Author

Also i have info about why i can so easily find it, cuz it should be hard to catch in first thouths. I have i guess unique case again. My player attack have around 15-30 tick long. So instead of sending PreciseTick each frame, i do send PreciseTick on start attack, and do increase Tick of PreciseTick on server each tick. I guess it can be helpfull for unit tests and etc.

@SnaiperoG3D
Copy link
Author

There is my temp solution. ColliderRollback.cs. Add two vars

private int _writeCount = 0;
private bool _writeDone = false;

In ResetSnapshots method reset them

_writeCount = 0;
_writeDone = false;

In AddSnapshot method check that we have atleast 2 recorded frames

if(!_writeDone)
{
    _writeCount++;
    if (_writeCount >= 2)
        _writeDone = true;
}

And last in main Rollback method, where transform changes add check for _writeDone in method begining

if (!_writeDone)
    return;

The point here is to return in Rollback method if there are less then 2 records for rollback

@FirstGearGames FirstGearGames added Bug Something isn't working Resolved Pending Release labels Aug 2, 2024
@FirstGearGames
Copy link
Owner

Fixed in 4.4.0. Ty again for the find.

FirstGearGames pushed a commit that referenced this issue Aug 20, 2024
Changes in 4.4.2
- Fixed stackoverflow error on an editor script.
- Improved removed redundant explicit type casts.
- Changed refactor on spawning; new code, same behavior.
- Fixed package.json not specifying all dependencies (#719).
- Fixed NetworkTransform potentially applying eventual consistency to relayed client-authoritative datas.
- Fixed TimeManager.LastPacketTick not resetting on network stop (#748).
- Changed removed all MethodImplOptions.AggressiveInlining.
- Added TickNetworkBehaviour.OnUpdate/OnLateUpdate overrides.
- Added Benchmarks folder.
- Added NetworkTransform benchmark.
- Removed Network Level of Detail; it's being replaced with a better system.
- Improved reduced CPU usage for writing spawn messages.
- Improved reduced bandwidth for writing spawn messages.
- Fixed NetworkTransform _cachedTransform not being set when object is disabled.
- Improved NetworkObject automatically adds EmptyNetworkBehaviour is no NetworkBehaviours are present at runtime.
- Improved NetworkObject performance by removing Update loop.
- Improved NetworkTransform performance by removing Update loop.
- Improved NetworkAnimator performance by removing Update loop.

Changes in 4.4.1
- Fixed modified collection/stackOverflow caused during observer rebuild.

Changes in 4.4.0
- Added delta serializers for prediction. This is a beta feature, you may switch to Stable using the Fish-Networking menu.
- Fixed SyncVar not sending latest values when the networkObject is spawned and despawned on the same tick (#692).
- Improved SyncVar no longer resets values prior to client deinitializing the object.
- Improved NetworkTransform performance by caching transform (#742).
- Fixed OnStopNetwork invoking on clientHost when client lost observation, while server was still active (#733).
- Fixed PredictedSpawn.OnTrySpawnServer not calling (#725).
- Fixed failed PredictedSpawns not skipping remaining data on the spawn, potentially corrupting the packet remainder.
- Added Writer.InsertUInt16Unpacked.
- Fixed ColliderRollback assertion error when rolling back before 2 snapshots were created (#743).
- Improved removed garbage collection from ColliderRollback fields and types.
- Changed several exposed internal API renamed on NetworkObject.
- Added boolean includeNested for PredictedOwner as well NetworkObject Give/RemoveOwnership.
- Obsoleted several methods in favor of includeNested for ownership.
- Fixed prediction graphicalObject smoothing for spectators when state forwarding was disabled (#734).
- Fixed replicate being run on spectators when state forwarding was disabled; related to (#734).
- Improved TimeManager.TickToLocalTick and LocalTickToTick can now return future tick values (#736).
- Added NetworkObject.HasAuthority.
- Fixed sceneIds sometimes not generating until after script compile or using regenerate sceneId menu.
- Fixed nested NetworkObjects spawning at the wrong coordinates for clients (#738).
- Fixed networkObject.SetParent(null) causing NullreferenceException.
- Fixed OnStopNetwork invoking on clientHost when client lost observation, while server was still active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Resolved Pending Release
Projects
None yet
Development

No branches or pull requests

2 participants