Skip to content

AimSpreadScale | on sv_fps >20 #452

@gerardommilan

Description

@gerardommilan

Hi there, I'm not sure if I'm addressing this the right way but.

Lets take a look into bg_pmove.c | Line 2351 func

rtcwPro/src/game/bg_pmove.c

Lines 2351 to 2481 in 8fe7081

==============
PM_AdjustAimSpreadScale
==============
*/
//#define AIMSPREAD_DECREASE_RATE 300.0f
#define AIMSPREAD_DECREASE_RATE 200.0f // (SA) when I made the increase/decrease floats (so slower weapon recover could happen for scoped weaps) the average rate increased significantly
#define AIMSPREAD_INCREASE_RATE 800.0f
#define AIMSPREAD_VIEWRATE_MIN 30.0f // degrees per second
#define AIMSPREAD_VIEWRATE_RANGE 120.0f // degrees per second
void PM_AdjustAimSpreadScale( void ) {
// int increase, decrease, i;
int i;
float increase, decrease; // (SA) was losing lots of precision on slower weapons (scoped)
float viewchange, cmdTime, wpnScale;
// all weapons are very inaccurate in zoomed mode
if ( pm->ps->eFlags & EF_ZOOMING ) {
pm->ps->aimSpreadScale = 255;
pm->ps->aimSpreadScaleFloat = 255;
return;
}
cmdTime = (float)( pm->cmd.serverTime - pm->oldcmd.serverTime ) / 1000.0;
wpnScale = 0.0f;
switch ( pm->ps->weapon ) {
case WP_LUGER:
case WP_SILENCER:
wpnScale = 0.5f;
break;
case WP_AKIMBO: //----(SA) added
wpnScale = 0.5;
break;
case WP_COLT:
wpnScale = 0.4f; // doesn't fire as fast, but easier to handle than luger
break;
case WP_VENOM:
wpnScale = 0.9f; // very heavy
break;
case WP_VENOM_FULL:
wpnScale = 1.5f;
break;
case WP_SNIPERRIFLE: // (SA) looong time to recover
wpnScale = 10.0f;
break;
case WP_SNOOPERSCOPE: // (SA) looong time to recover
wpnScale = 8.0f;
break;
case WP_MAUSER:
wpnScale = 0.5f;
break;
case WP_GARAND:
wpnScale = 0.5f;
break;
case WP_MP40:
wpnScale = 0.6f; // 2 handed, but not as long as mauser, so harder to keep aim
break;
//----(SA) added
case WP_BAR:
case WP_BAR2:
wpnScale = 1.0f;
break;
//----(SA) end
case WP_FG42:
case WP_FG42SCOPE:
wpnScale = 0.6f;
break;
case WP_THOMPSON:
wpnScale = 0.6f;
break;
case WP_STEN:
wpnScale = 0.6f;
break;
//case WP_PANZERFAUST:
//case WP_ROCKET_LAUNCHER:
// wpnScale = 0.5;
// break;
}
if ( wpnScale ) {
// JPW NERVE crouched players recover faster (mostly useful for snipers)
if ( pm->ps->eFlags & EF_CROUCHING ) {
wpnScale *= 0.5;
}
// jpw
decrease = ( cmdTime * AIMSPREAD_DECREASE_RATE ) / wpnScale;
viewchange = 0;
// take player movement into account (even if only for the scoped weapons)
// TODO: also check for jump/crouch and adjust accordingly
if ( pm->ps->weapon == WP_SNIPERRIFLE || pm->ps->weapon == WP_SNOOPERSCOPE ) {
for ( i = 0; i < 2; i++ )
viewchange += Q_fabs( pm->ps->velocity[i] );
} else {
// take player view rotation into account
for ( i = 0; i < 2; i++ )
viewchange += Q_fabs( SHORT2ANGLE( pm->cmd.angles[i] ) - SHORT2ANGLE( pm->oldcmd.angles[i] ) );
}
viewchange = (float)viewchange / cmdTime; // convert into this movement for a second
viewchange -= AIMSPREAD_VIEWRATE_MIN / wpnScale;
if ( viewchange <= 0 ) {
viewchange = 0;
} else if ( viewchange > ( AIMSPREAD_VIEWRATE_RANGE / wpnScale ) ) {
viewchange = AIMSPREAD_VIEWRATE_RANGE / wpnScale;
}
// now give us a scale from 0.0 to 1.0 to apply the spread increase
viewchange = viewchange / (float)( AIMSPREAD_VIEWRATE_RANGE / wpnScale );
increase = (int)( cmdTime * viewchange * AIMSPREAD_INCREASE_RATE );
} else {
increase = 0;
decrease = AIMSPREAD_DECREASE_RATE;
}
// update the aimSpreadScale
pm->ps->aimSpreadScaleFloat += ( increase - decrease );
if ( pm->ps->aimSpreadScaleFloat < 0 ) {
pm->ps->aimSpreadScaleFloat = 0;
}
if ( pm->ps->aimSpreadScaleFloat > 255 ) {
pm->ps->aimSpreadScaleFloat = 255;
}
pm->ps->aimSpreadScale = (int)pm->ps->aimSpreadScaleFloat; // update the int for the client
}

From now I'll be using not precise values for context and basic math.

cmdTime = (float)( pm->cmd.serverTime - pm->oldcmd.serverTime ) / 1000.0;

That would return server timeframe time in msec.
At 20 fps 0.05
At 40fps 0.025

Now at decrease rate:

decrease = ( cmdTime * AIMSPREAD_DECREASE_RATE ) / wpnScale;

20fps: (0.05 * 200 ) / 0.6 == 16.66666
40fps: (0.025 *200) / 0.6 == 8.33333

Data:
msc: 0.05 or 0.025 (msc time)
Aim decrease rate: 200
wpnScale(mp40): 0.6

The aimspread will decrease X amount * time, the higher the tickrate the smaller amount of the decrease would be (50%) to be precise comparing 20fps and 40fps.

So the server running at 20fps would decrease more but have less updates.
And running at 40fps would decrease less but more frequenly (50% more)

At the end it would be the same amount of course. BUT if you look it over time, the feeling might not be the same, now it increases/decreases 50% less but more frequenly making it "more smoothly"? In numbers might, the feeling not, it changes a lot.

Image

This is a game changer in the shooting, players are receiving now corrections over the recoil/spreadscale faster making it easier to shot, (twice as fast or in half of the time 50% correction) and the added recoil spreadscale after shooting remains the same.

"50% of the correction if half of the time against no correction in half of the time" (that's a lot)

Is this right? You would say, yes, is more "smooth" but should we make the recoil& spreadscale smoother from the original feeling?

Smoothing out weapon recoil is a thing? for me it should feel as it has always been (20fps feeling) and movement spreadscale of course should remain the same.

We are talking about from 50msec corrections to 25msec corrections. That's a lot of aiming/shooting/movement feeling.

Not intenting to force 20fps, the 40fps hitreg updates is appreciated but side things as recoil/movement went away from original feeling (IMO).

Image

In a time line would this mean that at 20fps the player is 50% of the time more innacurate compared to 40fps?

I just want to open this to see what you guys think about it, I don't really spend much time in coding, I can be wrong in many things in this" issue" but wanted to provide some feedback/context to try to explain the issue and I'm not really sure if you guys agree, I'm 100% wrong, or it can even be compensated or debugged.

-Elver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions