feat: Durable spawn tick for synchronizer nodes - #620
Merged
Conversation
aromancev
commented
Jun 28, 2026
aromancev
force-pushed
the
fix/past-spawn
branch
3 times, most recently
from
June 28, 2026 09:43
86810c7 to
adc2962
Compare
elementbound
force-pushed
the
fix/past-spawn
branch
from
July 4, 2026 13:12
adc2962 to
30138bc
Compare
elementbound
added a commit
that referenced
this pull request
Jul 28, 2026
Since the spawn fix #620, when something is spawned it becomes active on the same tick by default. That means we have to resimulate the same tick with that node already participating. This is ok from the correctness point but forces an unnecessary resimulation. Even in single player without any peers connected this will double the work. In real network conditions, it just adds one extra simulation tick of load. The fix is to make spawned objects live on the next tick. That also exposes another problem which is that the correct state seeded before gets rewritten on subsequent `spawn` calls even if they provide the correct spawn tick. So the second part of the fix to maintain a consistent state when `spawn` is called again: * Align `spawn_tick` with the new spawn tick (strictly not necessary but is more logical). * Clear previous despawn as it may no longer be relevant or worse be earlier than the new spawn. * (critical) push the new initial state again for the new spawn tick since it will be erased by resimulation from the previously seeded state that may no longer be correct. Specifically, in my game I observed a stale player position being retained and hence leading to a wrong projectile initial position. Updated player position would arrive on the next tick and should be able to correct the previous one. --------- Co-authored-by: Tamás Gálffy <ezittgtx@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, a node spawned in the past does not simulate correctly which leads to desync between different clients.
Failure mode
This failure has two components:
This change effectively does two things:
Note:
spawn_tickis exposed on both synchronizers to control the exact spawn tick. It defaults toNetworkRollback.tickso simply spawning the node during the rollback simulation will work correctly. But if the consumer doesn't want to spawn the node during rollback, they can setspawn_tickto whatever tick they consider as the first alive tick when spawning the node (before the deferredprocess_settingsexecutes).