Fix zipline+water desync#168
Conversation
When a beaver rides a zipline toward a flooded station, MovementAnimator.Update() fires a group ID change every frame. Different frame rates cause ZiplineWaterPenaltyModifier to return different values, creating a movement speed desync. Co-Authored-By: SamuZad
|
Thanks for this - sounds like this was a tough one to track down and fix. I want to take a deeper dive before I release it, just to double-check for unintended consequences, but it looks good at first readthrough. I'll aim for including it in the next release. |
|
I've also got a persistent desync on a zipline save that I could test this against. It could very well be the cause. |
|
@SamuZad So my map isn't reproducing this like I expected (I actually think your earlier name sync PR fixed that :D). It sounds like flooding is an important part of it? Do you have a map that reliably reproduces this desync to test the fix? In the meantime I'll make sure there's no unintended consequences, and if not, I suppose I can just merge it. |
|
Ok, so I think this makes sense, but I wanted to confirm a few things before merging. I see the problem, and that's a subtle one, so thanks for tracking it down! First, can you explain your take on how the various groupIDs are being used ( Second, from what I understand, you fix doesn't prevent the group from being updated outside of a tick (e.g. during My only concern with the reset approach is that Would it make sense to also prevent group updates during |
|
FWIW, I think either way the content of the PR would be part of the fix, so I could go ahead and merge it and we could see if there are still issues. I don't think that resetting the group would create any new desyncs, since it only updates if needed. So if you think that's a longer conversation and just want to get it out, I can file an issue for what I discussed here and merge this. |
I since implementing the fix I have not seen this particular desync despite the occasional flooding of zipline stations around the map - so I think it would be worthwhile to merge as-is |
From my understanding: Same group concept across all three classes — one shared int propagated unchanged. Is it used for batch updates? Not that I could see (though of course I could be wrong). And yes, I essentially "reset" the position - I have not seen any desyncs and we've been playing with this "enabled" for quite some time - but of course it's possible that our playstyle is just not bringing out other edge cases With regards to the zipline though, I'm sure this is safe because it only happens on "transition" (ie when beavers get on and off the zipline) And yeah, I thought about touching |
When a beaver rides a zipline toward a flooded station,
MovementAnimator.Update()fires a group ID change every frame. Since different machines run at different frame rates,ZiplineVisitor.IsOnZiplinecan flip at different times relative to game ticks. This makesZiplineWaterPenaltyModifierreturn 0.5 on one machine and 1.0 on the other — a 2x movement speed difference that snowballs into a desyncThis PR addressed the problem stated above