Welcome to hackvshack.net Forum!
Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, and More!
Register

C++ Function fix simtime segmentation + how to calc choke(and velocity/origin mismatches)

simonhook.dmp

Rookie HvHer
User ID:
245346
Messages:
57
Reactions:
31
Badges:
10
REP:
−1/16+
Level:
98
simtime isn't networked as a time.
it's 8 bits: ticks since a base thats the current tick rounded down to 100 (GetNetworkBase).
SendProxy_SimulationTime ( ):

C++:
Expand Collapse Copy
int addt = 0;
if ( ticknumber >= tickbase )   // cant encode the past
    addt = ( ticknumber - tickbase ) & 0xff;
pOut->m_Int = addt;

when fakelagging, cmds all land at once, 15 in one packet, one server frame. until they land his simtime is frozen(normal, server hasnt seen our packets). the base moves every 100 ticks and SPROP_ENCODED_AGAINST_TICKCOUNT forces a repack when it does ( ), so if that happens mid choke his simtime is "the past" and you get sent 0. the client ( ) decodes 0 as "simulated right at the base tick".
so it arrives as 0ms -> 62.5ms(spliced) -> 218.75ms(example values, these actually have high variance) instead of one clean 0ms -> 218.75ms. your client thinks the simulation was split in two(normal, you receive 2 different simtimes). it wasnt, the server ran it as one batch.
that matters because velocity for other players is estimated straight off the delta ( ):

C++:
Expand Collapse Copy
float flTimeDelta = m_flSimulationTime - m_flOldSimulationTime;

Vector newVelo = ( GetNetworkOrigin() - GetOldOrigin() ) / flTimeDelta;

SetLocalVelocity( newVelo );

// supremacy does the following equivalent:
// record->m_velocity = ( record->m_origin - previous->m_origin ) * ( 1.f / game::TICKS_TO_TIME( record->m_lag ) );

(as done in supremacy, along with every others hacks)
split in two it runs twice: once with time but no origin change, velocity 0. then the whole origin jump over the leftover slice, a huge velocity that never happened.
(you can try it yourself, print m_velocity.length( ), every 1.5~s your length will go == 0.f then jump)
wire-0 just means "hasnt simulated since the base", and the real update still arrives with the batch, so dropping it loses nothing:

C++:
Expand Collapse Copy
if ( !pData->m_Value.m_Int ) // fix segmenting of updates
    return;

and boom, chokes come through whole again: one update, one clean jump.
ps: some people(FATALITY, cough cough,! simon's favourite source to paste from) count lag off layer 11 (the alive loop) instead, stepping its cycle forward a tick at a time until it matches the new update's cycle. dont. the server rolls that layer with rng (SetUpAliveloop, ): cycle starts at RandomFloat( 0, 1 ), rate re-rolls by RandomFloat( 0.8, 1.1 ) every time the sequence finishes, sequence changes on weapon switch. you cant replay random numbers, and when nothing matches those impls throw the whole record away, bones and all.

when it does match your choke thats coincidence: the batch updates the animstate once, m_flLastUpdateIncrement just happens to cover the same gap. one big step equals the 15 small ones. and that only lines up on builds past 2019, which simulate on the last tick instead of the oldest.

simtime with the fix gives you the tick count outright. and it has to be simtime, not server_tick: that one only ever counts up, while simtime goes backwards on anyone shifting their tickbase. you want to follow him there, not keep incrementing.
BONUS:
if you want to effectively check for animation updates, don't rely on simulation time, rely on animation layers
they are networked and cannot diverge from the server (apart from encoding for cycle)
so the following:

C++:
Expand Collapse Copy
            if( stored_layer.m_sequence != cur_layer.m_sequence
                || stored_layer.m_weight != cur_layer.m_weight
                || stored_layer.m_weight_delta_rate != cur_layer.m_weight_delta_rate
                || stored_layer.m_cycle != cur_layer.m_cycle
                || stored_layer.m_playback_rate != cur_layer.m_playback_rate
                ) {
                update = true;
            }
will always match when the server updates

NOTE: doing this means you need to separate lagcomp records from anim records
for simple fix, use:

simtime != last_stored_sim_time
 
Last edited:
simtime isn't networked as a time.
it's 8 bits: ticks since a base thats the current tick rounded down to 100 (GetNetworkBase).
SendProxy_SimulationTime ( ):

C++:
Expand Collapse Copy
int addt = 0;
if ( ticknumber >= tickbase )   // cant encode the past
    addt = ( ticknumber - tickbase ) & 0xff;
pOut->m_Int = addt;

when fakelagging, cmds all land at once, 15 in one packet, one server frame. until they land his simtime is frozen(normal, server hasnt seen our packets). the base moves every 100 ticks and SPROP_ENCODED_AGAINST_TICKCOUNT forces a repack when it does ( ), so if that happens mid choke his simtime is "the past" and you get sent 0. the client ( ) decodes 0 as "simulated right at the base tick".
so it arrives as 0ms -> 62.5ms(spliced) -> 218.75ms(example values, these actually have high variance) instead of one clean 0ms -> 218.75ms. your client thinks the simulation was split in two(normal, you receive 2 different simtimes). it wasnt, the server ran it as one batch.
that matters because velocity for other players is estimated straight off the delta ( ):

C++:
Expand Collapse Copy
float flTimeDelta = m_flSimulationTime - m_flOldSimulationTime;

Vector newVelo = ( GetNetworkOrigin() - GetOldOrigin() ) / flTimeDelta;

SetLocalVelocity( newVelo );

// supremacy does the following equivalent:
// record->m_velocity = ( record->m_origin - previous->m_origin ) * ( 1.f / game::TICKS_TO_TIME( record->m_lag ) );

(as done in supremacy, along with every others hacks)
split in two it runs twice: once with time but no origin change, velocity 0. then the whole origin jump over the leftover slice, a huge velocity that never happened.
(you can try it yourself, print m_velocity.length( ), every 1.5~s your length will go == 0.f then jump)
wire-0 just means "hasnt simulated since the base", and the real update still arrives with the batch, so dropping it loses nothing:

C++:
Expand Collapse Copy
if ( !pData->m_Value.m_Int ) // fix segmenting of updates
    return;

and boom, chokes come through whole again: one update, one clean jump.
ps: some people(FATALITY, cough cough,! simon's favourite source to paste from) count lag off layer 11 (the alive loop) instead, stepping its cycle forward a tick at a time until it matches the new update's cycle. dont. the server rolls that layer with rng (SetUpAliveloop, ): cycle starts at RandomFloat( 0, 1 ), rate re-rolls by RandomFloat( 0.8, 1.1 ) every time the sequence finishes, sequence changes on weapon switch. you cant replay random numbers, and when nothing matches those impls throw the whole record away, bones and all.

when it does match your choke thats coincidence: the batch updates the animstate once, m_flLastUpdateIncrement just happens to cover the same gap. one big step equals the 15 small ones. and that only lines up on builds past 2019, which simulate on the last tick instead of the oldest.

simtime with the fix gives you the tick count outright. and it has to be simtime, not server_tick: that one only ever counts up, while simtime goes backwards on anyone shifting their tickbase. you want to follow him there, not keep incrementing.
BONUS:
if you want to effectively check for animation updates, don't rely on simulation time, rely on animation layers
they are networked and cannot diverge from the server (apart from encoding for cycle)
so the following:

C++:
Expand Collapse Copy
            if( stored_layer.m_sequence != cur_layer.m_sequence
                || stored_layer.m_weight != cur_layer.m_weight
                || stored_layer.m_weight_delta_rate != cur_layer.m_weight_delta_rate
                || stored_layer.m_cycle != cur_layer.m_cycle
                || stored_layer.m_playback_rate != cur_layer.m_playback_rate
                ) {
                update = true;
            }
will always match when the server updates
noting this down so i can send this to pxnch for his premium paste that he sells for 50 dollars.
 
and boom, chokes come through whole again: one update, one clean jump.
ps: some people(FATALITY, cough cough,! simon's favourite source to paste from) count lag off layer 11 (the alive loop) instead, stepping its cycle forward a tick at a time until it matches the new update's cycle. dont. the server rolls that layer with rng (SetUpAliveloop, csgo_playeranimstate.cpp): cycle starts at RandomFloat( 0, 1 ), rate re-rolls by RandomFloat( 0.8, 1.1 ) every time the sequence finishes, sequence changes on weapon switch. you cant replay random numbers, and when nothing matches those impls throw the whole record away, bones and all.
just bypass their checks?
like compare current playbackrate with previous playbackrate at all
 
just bypass their checks?
like compare current playbackrate with previous playbackrate at all
wrong, you need to wait for simtime to be fully sent out without fragment to properly lagcompensate
if layers come in packet 1 and not packet 2 (where simulation time isnt fully sent yet) you end up with an animation record without a valid simulation time attached to it
 
wrong, you need to wait for simtime to be fully sent out without fragment to properly lagcompensate
if layers come in packet 1 and not packet 2 (where simulation time isnt fully sent yet) you end up with an animation record without a valid simulation time attached to it

u receive all the data on the unchoke + delay
u don't need to do anything with the player (simulation or anything like that) if the server hasn't sent an update

If you want the game to skip some checks in CCSGOPlayerAnimState::SetUpAliveLoop you should just compare the current playback rate with the previous one
 
u receive all the data on the unchoke + delay
u don't need to do anything with the player (simulation or anything like that) if the server hasn't sent an update

If you want the game to skip some checks in CCSGOPlayerAnimState::SetUpAliveLoop you should just compare the current playback rate with the previous one
loop all ur entities at frame_net_update_end (or postdataupdate_start)
have someone bhop at you full fakelagging
print different in simtime each time it changes
you will see that it does not
even m_flOldSimulationTime does not
 
u receive all the data on the unchoke + delay
u don't need to do anything with the player (simulation or anything like that) if the server hasn't sent an update

If you want the game to skip some checks in CCSGOPlayerAnimState::SetUpAliveLoop you should just compare the current playback rate with the previous one
My big bro hi✋
 
wire-0 just means "hasnt simulated since the base", and the real update still arrives with the batch, so dropping it loses nothing:
wire zero also represents a player simulated exactly at the base tick. with base tick 1000, both simulation tick 999 and simulation tick 1000 encode as zero. returning from the receive proxy for every zero makes you skip on real simtimes (you want to animate those). the byte alone cannot distinguish the two cases.

when fakelagging, cmds all land at once, 15 in one packet, one server frame.
receiving multiple commands together does not mean executing them as one simulation. CBasePlayer::PhysicsSimulate calls PlayerRunCommand separately for each available command.
C++:
Expand Collapse Copy
for (int i = 0; i < commandsToRun; ++i)
    PlayerRunCommand(&commands[i], MoveHelperServer());

simtime with the fix gives you the tick count outright.
this fix drops some valid updates, and a zero doesnt have enough info to rebuild an earlier tick. so the tick count cant be guaranteed correct.

they are networked and cannot diverge from the server (apart from encoding for cycle)
cycle is not the only layer value subject to encoding. weight is quantized too. the received layer is not necessarily identical to the servers unencoded layer.
 
wire zero also represents a player simulated exactly at the base tick. with base tick 1000, both simulation tick 999 and simulation tick 1000 encode as zero. returning from the receive proxy for every zero makes you skip on real simtimes (you want to animate those). the byte alone cannot distinguish the two cases.


receiving multiple commands together does not mean executing them as one simulation. CBasePlayer::PhysicsSimulate calls PlayerRunCommand separately for each available command.
C++:
Expand Collapse Copy
for (int i = 0; i < commandsToRun; ++i)
    PlayerRunCommand(&commands[i], MoveHelperServer());


this fix drops some valid updates, and a zero doesnt have enough info to rebuild an earlier tick. so the tick count cant be guaranteed correct.


cycle is not the only layer value subject to encoding. weight is quantized too. the received layer is not necessarily identical to the servers unencoded layer.
it does not, you always receive them, just on the next packet
read up a little bit
there's a reason onetap separated their animsys and their lagcomp sys
they are 2 distincts thing
your animation updates on layer update but your lagcomp records need the simtime hook + to check for simtime change
the "ghetto" fix is just to do like skeet and older onetap does, dont animate until simtime has changed
that way you achieve accurate simtime for lagcompensation and you dont need to separate your lagcomp records from your anim records

from neverlose itself btw:
1790700760541.webp
 
Last edited:
it does not, you always receive them, just on the next packet

a later packet contains the later state, not a replay of every simulation time omitted by a receive-proxy hook. POC:

for entity index 32, entityIndex % 32 == 0, so its network base changes from 900 to 1000 at server tick 1000. suppose the player simulates on ticks 999, 1000, and 1001:

C++:
Expand Collapse Copy
int NetworkBase(int serverTick, int entityIndex)
{
    return 100 * ((serverTick - entityIndex % 32) / 100);
}

int EncodeSimTick(int simTick, int serverTick, int entityIndex)
{
    const int base = NetworkBase(serverTick, entityIndex);
    return simTick >= base ? (simTick - base) & 0xff : 0;
}

EncodeSimTick(999,  999, 32);  // 99
EncodeSimTick(1000, 1000, 32); // 0: legitimate simulation at the base
EncodeSimTick(1001, 1001, 32); // 1: a different, later simulation

the tick-1000 packet contains a valid zero. your hook drops it. the next packet contains one, representing tick 1001. It does not give the client the missed tick-1000 update. your record history becomes 999 → 1001 instead of 999 → 1000 → 1001.

if the player does not simulate again immediately, the next snapshot still has encoded zero. there is no nonzero timestamp waiting to “fix” the previous packet. the snapshot writer compares the old and new packed states and writes changed properties; it does not queue an earlier property value for replay just because a client-side receive hook chose to ignore it.



your animation updates on layer update but your lagcomp records need the simtime hook + to check for simtime change

i honestly dont see how this is relevant to the point, thats purely a design choice.

 
  • Like
Reactions: wizardballs
a later packet contains the later state, not a replay of every simulation time omitted by a receive-proxy hook. POC:

for entity index 32, entityIndex % 32 == 0, so its network base changes from 900 to 1000 at server tick 1000. suppose the player simulates on ticks 999, 1000, and 1001:

C++:
Expand Collapse Copy
int NetworkBase(int serverTick, int entityIndex)
{
    return 100 * ((serverTick - entityIndex % 32) / 100);
}

int EncodeSimTick(int simTick, int serverTick, int entityIndex)
{
    const int base = NetworkBase(serverTick, entityIndex);
    return simTick >= base ? (simTick - base) & 0xff : 0;
}

EncodeSimTick(999,  999, 32);  // 99
EncodeSimTick(1000, 1000, 32); // 0: legitimate simulation at the base
EncodeSimTick(1001, 1001, 32); // 1: a different, later simulation

the tick-1000 packet contains a valid zero. your hook drops it. the next packet contains one, representing tick 1001. It does not give the client the missed tick-1000 update. your record history becomes 999 → 1001 instead of 999 → 1000 → 1001.

if the player does not simulate again immediately, the next snapshot still has encoded zero. there is no nonzero timestamp waiting to “fix” the previous packet. the snapshot writer compares the old and new packed states and writes changed properties; it does not queue an earlier property value for replay just because a client-side receive hook chose to ignore it.





i honestly dont see how this is relevant to the point, thats purely a design choice.

ofc and im saying my design is the better if you are a lazy bum and simply want it working
 

Who has read this thread (Total: 2) in last 1 hours View details