You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We disable the SyncPlugin in FixedPostUpdate and put it in PostUpdate.
That's because the VisualInterpolation plugin updates Position every frame in PostUpdate, and we want the sync from Position->Transform to happen after that, because some entities depend on the Transform (children, etc.)
Therefore we need to add PostUpdate system ordering as well. Fixed: #796
How come we have logs like
2025-01-10T06:20:38.865951Z INFO lightyear::client::prediction::rollback: Rollback check: mismatch for component between predicted and confirmed 40v1#4294967336 on tick Tick(1485) for component "avian3d::dynamics::rigid_body::AngularVelocity".
Current tick: Tick(1496) predicted_exist=true confirmed_exist=true
when the value of AngularVelocity is 0.0 on both server and client
ANSWER: the rollbacks are happening on the block characters, not on the controllable character!
When I remove the blocks completely, there are no rollbacks.
Avian uses some resources that are not rolled back.
After adding a non-networked resource to rollback I have an issue:
client connects and sync. Its tick becomes server_tick + X
prediction systems start running, in particular the resource gets added to history for server_tick + X. Also components get received for server_tick + X in the PredictionHistory
receive an update from the server for tick server_tick for Confirmed entities
the PredictionHistory did not have a value for server_tick, so we trigger a rollback
During the rollback, we restore the Predicted component values to the Confirmed values (usually this means no change)
However we also remove the Resource because it didn't exist at tick server_tick in the ResourceHistory. In general it's not possible to 'disable' a resource to make it ignored. That means that the resource gets removed (because of rollback), which causes the avian plugin to panic
a) When we receive a TickEvent, should we also update the values in the PredictionHistory/InterpolationHistory/ResourceHistory? (TickEvent means that client tick was very out of sync with server tick and we reset the client tick to be close to the server tick). And then we could just start adding stuff in the history before Sync. Maybe instead of storing actual ticks in the histories, we can store the offset compared to the present. I.e. tick -1, tick -2, etc. That way even if the present tick changes (for example on a sync event the present tick could jump from 10 to 1000) it doesn't matter because we still know that the component/resource was updated on tick 10-2 = 8 -> 1000-2 = 998 b) Does change the relative speed on the client change anything? probably not, it just means that we might run more FixedUpdate schedule steps to catch up to the server, but otherwise each FixedUpdate.delta is fixed. c)
Having VisualInterpolation enabled on the server causes issues, probably because the value that is being replicated is the interpolated value. I think we need some system ordering so that VisualInterpolation happens after sending packets!
with no Boxes, no Collision rollback, Sleep disabled, ExternalForce/ExternalImpulse full-replicated: NO ROLLBACKS
with no Boxes, Collision rollback, Sleeping enabled, ExternalForce/ExternalImpulse full-replicated: ROLLBACKS
with no Boxes, no Collision rollback, Sleeping enabled, ExternalForce/ExternalImpulse full-replicated: ROLLBACKS
Changing the Block shape from cube to a capsule removes most of the rollbacks. There is some kind of rotation/friction between the floor and the cube that is messing things up
-> It seems like the order of iteration on the contact points is not deterministic, or there is another source of non-determinism based on the order of entities
avian's transform interpolation happens in RunFixedMainLoop, so the interpolated value will be sent. This means that avian's transform interpolation should not be used on the server
The text was updated successfully, but these errors were encountered:
That's because the VisualInterpolation plugin updates Position every frame in PostUpdate, and we want the sync from Position->Transform to happen after that, because some entities depend on the Transform (children, etc.)
Therefore we need to add PostUpdate system ordering as well.
Fixed: #796
when the value of AngularVelocity is 0.0 on both server and client
ANSWER: the rollbacks are happening on the block characters, not on the controllable character!
When I remove the blocks completely, there are no rollbacks.
After adding a non-networked resource to rollback I have an issue:
server_tick + X
server_tick + X
. Also components get received forserver_tick + X
in the PredictionHistoryserver_tick
for Confirmed entitiesserver_tick
, so we trigger a rollbackserver_tick
in the ResourceHistory. In general it's not possible to 'disable' a resource to make it ignored. That means that the resource gets removed (because of rollback), which causes the avian plugin to panica) When we receive a TickEvent, should we also update the values in the PredictionHistory/InterpolationHistory/ResourceHistory? (TickEvent means that client tick was very out of sync with server tick and we reset the client tick to be close to the server tick). And then we could just start adding stuff in the history before Sync. Maybe instead of storing actual ticks in the histories, we can store the offset compared to the present. I.e. tick -1, tick -2, etc. That way even if the present tick changes (for example on a sync event the present tick could jump from 10 to 1000) it doesn't matter because we still know that the component/resource was updated on tick 10-2 = 8 -> 1000-2 = 998
b) Does change the relative speed on the client change anything? probably not, it just means that we might run more FixedUpdate schedule steps to catch up to the server, but otherwise each FixedUpdate.delta is fixed.
c)
Fixed: #798
Also do we need to rollback Time and Time? See Document components and resources needed for rollback Jondolf/avian#478
Do we need to handle entity sleeping?
Having VisualInterpolation enabled on the server causes issues, probably because the value that is being replicated is the interpolated value. I think we need some system ordering so that VisualInterpolation happens after sending packets!
Fixed: #799
Note:
-> It seems like the order of iteration on the contact points is not deterministic, or there is another source of non-determinism based on the order of entities
The text was updated successfully, but these errors were encountered: