-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Models stutter due to client side interpolation #3228
Comments
Is this somehow related to the bug where if a player would stand on top of another crouching player his camera would stutter vertically? |
I don't think so, this only affects the model's render position, not the player's camera position. |
Understood. Thanks. |
Added additional step to fix |
Added additional steps to fix |
When Half-Life 1 was updated to handle studio model rendering in the client dll with SDK 2.0 a bug started occurring where studio models moved by other entities like
func_tracktrain
would stutter.Here's a video that shows the stuttering as well as the expected behavior: video
The most likely cause is that the time value used by model rendering is being overwritten by an older time value used by the client side prediction code. The animation time values jump back and forth from the present to the past in a way that causes interpolation to sometimes interpolate to some point in the future and sometimes to some point in the past, causing the model to "pinball" between the past and future interpolated positions.
The cause of this is somewhere in the engine, not fixable in SDK code as-is. A workaround exists to disable interpolation in these cases to prevent the stuttering effect from occurring, originally provided by Uncle Mike on the HLFX forums: https://hlfx.ru/forum/showthread.php?s=&threadid=15&highlight=%C8%ED%F2%E5%F0%EF%EE%EB%FF%F6%E8%FF
(Unfortunately you need an account to access this thread)
The changes required are as follows:
Change this line:
halflife/dlls/nihilanth.cpp
Line 291 in c7240b9
To this:
Change this line:
halflife/dlls/osprey.cpp
Line 156 in c7240b9
To this:
(the same change is needed in Opposing Force's Black Ops Osprey code)
After this line:
halflife/dlls/cbase.h
Line 149 in c7240b9
Add this:
After this line:
halflife/dlls/cbase.cpp
Line 586 in c7240b9
Add this:
After this line:
halflife/dlls/tentacle.cpp
Line 258 in c7240b9
Add this:
After this line:
halflife/dlls/client.cpp
Line 1097 in c7240b9
Add this:
Change this logic:
halflife/dlls/client.cpp
Lines 1194 to 1201 in c7240b9
To this:
Change this logic:
halflife/cl_dll/StudioModelRenderer.cpp
Lines 474 to 477 in c7240b9
To this:
const auto pseqdesc = (mstudioseqdesc_t*)((byte*)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence; if ((pseqdesc->motiontype & STUDIO_LX) != 0 || (m_pCurrentEntity->curstate.eflags & EFLAG_SLERP) != 0) { for (i = 0; i < 3; i++) { modelpos[i] += (m_pCurrentEntity->origin[i] - m_pCurrentEntity->latched.prevorigin[i]) * f; } }
These changes restrict model interpolation to animations that have movement on the X axis and entities that have interpolation enabled, which is enabled for any entity that sets the
FL_FLY
flag. Entities can also force interpolation by setting theEFLAG_SLERP
flag onCBaseEntity::m_EFlags
.Tentacles will not interpolate correctly when loading a save game made before these code changes were applied.
A better solution would be to identify the cause of the bug (likely the incorrect time values) and fixing that, but that would require an investigation and testing to verify that the fix doesn't break anything that may be depending on this buggy behavior somehow.
The text was updated successfully, but these errors were encountered: