Apologies for the double post, encountered an error in Outlook.

From: pmckeown2...@hotmail.com
To: hlcoders@list.valvesoftware.com
Date: Sun, 31 May 2015 02:27:42 +0100
Subject: [hlcoders] Solution to laggy first-person spectating







Greetings everyone,

There is an intermittent bug with the codebase where in 
some situations the first person spectating of other players can become 
very laggy, as interpolation for m_angEyeAngles stops. This problem is most 
easily found when the spectator target's viewmodel is hidden and thus isn't 
requiring interpolation (meaning there is no reason to interpolate the parent 
player either).

This bug 
is present in TF2's code as well as I've seen it there too. The
 issue is that the player's ShouldInterpolate() doesn't take into 
account if the local player is spectating this player or not, causing it
 to no longer have it's interpolated variables (like m_iv_angEyeAngles) 
processed. I've been hunting this bug for a while in my mod and finally 
solved it, and I figured I'd share the solution here:

In c_baseplayer.cpp, go to the ShouldInterpolate() function, and add this at 
the bottom above BaseClass::ShouldInterpolate():

if ( GetLocalPlayer() && GetLocalPlayer()->GetObserverTarget() == this )
        return true;

This will fix it. Hope this helps!

Note: I didn't look too much into this, but the spectating of players is done 
via CalcView which doesn't appear to change what render->GetViewEntity() 
returns - the entity returned by this always interpolated, which would seem to 
be the intended way for this to work, but doesn't in practice.

Regards,

Peter


                                          

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders                
                          
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Reply via email to