Skip to content

fix: Fix per-physics-step tick jitter under sync_to_physics#626

Merged
elementbound merged 5 commits into
foxssake:mainfrom
sk0pega:fix/network-timer-with-sync-to-physics
Jul 8, 2026
Merged

fix: Fix per-physics-step tick jitter under sync_to_physics#626
elementbound merged 5 commits into
foxssake:mainfrom
sk0pega:fix/network-timer-with-sync-to-physics

Conversation

@sk0pega

@sk0pega sk0pega commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Under netfox/time/sync_to_physics = true, the tick loop runs inside _physics_process, but it still decides how many ticks to run from netfox's own wall-clock scheduler rather than from the physics step it's running in. Because that wall clock drifts against Godot's physics accumulator, individual physics steps end up running 0 or 2 ticks instead of 1, several times per second.

At the same time, when sync_to_physics is on, tick_factor is derived from Engine.get_physics_interpolation_fraction() — i.e. the physics-step timeline. So every 0/2-tick slip produces a from/to interpolation pair that disagrees with the fraction: TickInterpolator renders a backward snap followed by a double-speed catch-up. It reads as intermittent movement jitter.

The severity is set by the phase between the two clocks, which is frozen at NetworkTime.start() — so the same project stutters on some launches and is smooth on others, and the state persists for the whole session.

Comment thread addons/netfox/network-time.gd Outdated
Comment thread addons/netfox/network-time.gd Outdated
sk0pega and others added 5 commits July 8, 2026 22:19
Under netfox/time/sync_to_physics = true, the tick loop runs inside _physics_process, but it still decides how many ticks to run from netfox's own wall-clock scheduler rather than from the physics step it's running in. Because that wall clock drifts against Godot's physics accumulator, individual physics steps end up running 0 or 2 ticks instead of 1, several times per second.

At the same time, when sync_to_physics is on, tick_factor is derived from Engine.get_physics_interpolation_fraction() — i.e. the physics-step timeline. So every 0/2-tick slip produces a from/to interpolation pair that disagrees with the fraction: TickInterpolator renders a backward snap followed by a double-speed catch-up. It reads as intermittent movement jitter.

The severity is set by the phase between the two clocks, which is frozen at NetworkTime.start() — so the same project stutters on some launches and is smooth on others, and the state persists for the whole session.
@elementbound elementbound force-pushed the fix/network-timer-with-sync-to-physics branch from 62510ec to dbe9a50 Compare July 8, 2026 20:20
@elementbound elementbound merged commit 989cee2 into foxssake:main Jul 8, 2026
4 checks passed
@elementbound

Copy link
Copy Markdown
Contributor

Kudos for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants