|
CSGO: lbyt update prediction
Because of my efforts in this this topic, trying to explain how this all worked, i still saw some threads about this subject, so i decided to release some code. the point of this code is rebuilding how the server will calculate when your lbyt will update. since the client-sided animstate should be updated every client frame, the server animstate runs on server fames, also known as ‘ticks’ and is ‘not processed’ when one is choking. you normally would run this code somewhere after createmove, since that is where the server processing happens too. the code also assumes that your curtime at that point is tickbase*ipt.
// player changed, free old animation state. // need to reset? (on respawn) // note new spawn time. // need to allocate or create new due to player change. if( state != nullptr ) // used to detect if we need to recreate / reset. // note anim state for future use. // run the animstate code how the server would too. // back up some data to not mess with game.. UpdateAnimationState( m_serverAnimState, m_angRealAngle ); // restore that data.. // walking, delay next update by .22s. // calculate delta. // standing, update every 1.1s. void Animations::CreateAnimationState( CCSGOPlayerAnimState* state, Player* player ) { static auto CreateAnimState = ( CreateAnimState_t )0xca11ab1e; CreateAnimState( state, player ); void Animations::UpdateAnimationState( CCSGOPlayerAnimState* state, QAngle ang ) { __asm { movss xmm1, dword ptr[ ang + 4 ] call UpdateAnimState void Animations::ResetAnimationState( CCSGOPlayerAnimState* state ) { static auto ResetAnimState = ( ResetAnimState_t )0xca11ab1e; ResetAnimState( state ); |
|