s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
573 stars 197 forks source link

PM_CheckFalling angle boundary doubt #995

Open dystopm opened 4 weeks ago

dystopm commented 4 weeks ago

https://github.com/s1lentq/ReGameDLL_CS/blob/f9969aceab95783a537902282d127d4c88daf5ae/regamedll/pm_shared/pm_shared.cpp#L2729-L2735

Should the boundary check the Z axis instead of the X axis?

dystopm commented 4 weeks ago

@s1lentq @wopox1337

wopox1337 commented 4 weeks ago

https://github.com/s1lentq/ReGameDLL_CS/blob/c48be874743b2a440728889acb4797f4ec04137a/regamedll/pm_shared/pm_shared.cpp#L2730

1) I have BIG doubts that the screen should rotate along the Z axis.

In game engines BEFORE GoldSrc and AFTER, the screen has a logical "forward" tilt on the **X** axis when falling. 

Therefore, only the line that unreasonably rotates the Roll angle needs to be fixed. 

2) Also, investigating all possible source code of other similar engines it was found that the value here should be 0.01 (1% of the fall velocity to apply the angle).

Sources:

CS:GO:

https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/gamemovement.cpp#L4397-L4408

    float flFallVel = player->m_Local.m_flFallVelocity;
    if ( flFallVel > 16.0f && flFallVel <= PLAYER_FATAL_FALL_SPEED )
    {
        // punch view when we hit the ground
        QAngle punchAngle = player->GetViewPunchAngle();
        punchAngle.x = (flFallVel * 0.001);

        if ( punchAngle.x < 0.75 )
            punchAngle.x = 0.75;

        player->SetViewPunchAngle( punchAngle );
    }

Source-sdk-2013

https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/gamemovement.cpp#L3978-L3986


    //
    // Knock the screen around a little bit, temporary effect.
    //
    player->m_Local.m_vecPunchAngle.Set( ROLL, player->m_Local.m_flFallVelocity * 0.013 );

    if ( player->m_Local.m_vecPunchAngle[PITCH] > 8 )
    {
        player->m_Local.m_vecPunchAngle.Set( PITCH, 8 );
    }

Player fall tilt in Quake 2 (video)

Quake 2 RTX | P_FallingDamage (screen shake angle)

Q2 source code: https://github.com/id-Software/Quake-2/blob/372afde46e7defc9dd2d719a1732b8ace1fa096e/game/p_view.c#L560

Quake family engine tree

https://upload.wikimedia.org/wikipedia/commons/8/85/Quake_-_family_tree_2.svg

some reflections https://hlfx.ru/forum/showthread.php?s=8f03de21bacaf9bf2192e8defd2b8d74&postid=123925

dystopm commented 4 weeks ago

Actually it makes sense that roll changes, since it gives a feeling of imbalance. Changing pitch axis will provoke a little itch from client prediction, I suggest to only change the capping axis to Z instead of X and leave roll axis changing, what do you think?