Fix/restream streamout collision gap#4978
Open
naouh wants to merge 2 commits into
Open
Conversation
The anti-thrash cooldown added in multitheftauto#4744 (minStreamInDelayAfterOutMs, 1200ms in CClientStreamer::Restream) also delayed deliberate restreams that go through StreamOutForABit (engineReplaceModel, and model restore via RestreamObjects/RestreamPeds/RestreamVehicles/etc). This kept restreamed elements - and their collision - streamed out for over a second, so players standing on / driving over a model that was replaced or restored at runtime would fall through the world during the gap. StreamOutForABit is documented to stream back in next frame, so clear m_lastStreamOutTime to exempt the deliberate restream path from the distance-based cooldown. The multitheftauto#4744 ping-pong only occurs through the distance-based InternalStreamOut calls, which keep their timestamp, so that fix is preserved.
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.
Summary
StreamOutForABitis used for deliberate restreams (engineReplaceModel, andmodel restore via RestreamObjects / RestreamPeds / RestreamVehicles / etc).
It is documented to stream the element back in on the next frame.
Since #4744 added an anti-thrash cooldown (
minStreamInDelayAfterOutMs, 1200ms)before an element can stream back in after a stream-out, these deliberate
restreams were blocked for over a second too.
This clears
m_lastStreamOutTimeinStreamOutForABitso the restream path isexempt from the cooldown and streams back in right away again. The distance
based stream-out keeps its timestamp, so the #4744 ping-pong fix stays intact.
Motivation
After #4744, replacing or restoring a model at runtime (for example
engineReplaceModel on a road/object, or destroyElement on a custom DFF) keeps
the affected objects streamed out for about 1.2 seconds. During that gap the
collision is gone, so any player standing on or driving over that model falls
through the world. It used to be instant before #4744.
This is a regression from #4744.
Test plan
engineReplaceModelon that model id, thendestroyElementthe replacement DFF to restore the original.
falls through the object during the gap.
no fall-through.
Before:
https://streamable.com/4gyu8i
After:
https://streamable.com/z3x3n4
Checklist