ValveSoftware / Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
636 stars 74 forks source link

[TF2] Removing sentry gun internal delay #6384

Open hamnTF2 opened 1 week ago

hamnTF2 commented 1 week ago

The sentry gun has interval delay to reduce lag of animation. But this results in unintended balance patch; especially firing speed.

It would be good to watch explanation from sigsegv's steam community reply: https://steamcommunity.com/app/440/discussions/1/523898291497993506/#c523898291499252514

What was originally intended is for the sentry gun to fire bullets every 0.1 second, and the server to fire every 7 ticks(0.105s) because 66 ticks per second. But there's delay in the code. In game/server/tf/tf_obj_sentrygun.cpp, it defines SENTRY_THINK_DELAY 0.05 and it makes server think every 3 ticks instead of a tick. Eventually, the sentry gun will be fired at 9 ticks, which is the actual next tick.

Not only does this deviate from the information written on the wiki and from the real, but it also has a significant impact on MvM sentry firing speed upgrade. This is why sentry gun only could upgrade first tick not like heavy's minigun.

Suggestion: Moving to game/server/tf/tf_obj_sentrygun.cpp. In CObjectSentrygun::Spawn(),

// Rotate Details
m_iRightBound = 45;
m_iLeftBound = 315;
m_iBaseTurnRate = 6;
m_flFieldOfView = VIEW_FIELD_NARROW;

Remove m_iBaseTurnRate = 6; like below.

// Rotate Details
m_iRightBound = 45;
m_iLeftBound = 315;
m_flFieldOfView = VIEW_FIELD_NARROW;

It will be added in another function.

In CObjectSentrygun::SentryThink( void )

SetContextThink( &CObjectSentrygun::SentryThink, gpGlobals->curtime + SENTRY_THINK_DELAY, SENTRYGUN_CONTEXT );

Fix code to check m_iState is in attack like below.

if ( m_iState == SENTRY_STATE_ATTACKING )
{
    m_iBaseTurnRate = 2;
    SetContextThink( &CObjectSentrygun::SentryThink, gpGlobals->curtime, SENTRYGUN_CONTEXT );
}
else
{
    m_iBaseTurnRate = 6;
    SetContextThink( &CObjectSentrygun::SentryThink, gpGlobals->curtime + SENTRY_THINK_DELAY, SENTRYGUN_CONTEXT );
}

This fixed code can make sentry think in a tick when attacking only, without lagging animation.

Edit: tf_obj_spy_trap.cpp to tf_obj_sentrygun.cpp. I confused.

Marxvee commented 6 days ago

This will cause sentry guns to fire at a faster rate than what everyone's been used to for the past 17 years. I would personally alter the fire rates and Wrangler fire rate multipliers accordingly if this were to be done just so there isn't a significant gameplay change outside of MvM. Furthermore, fixing this bug (and adjusting the fire rates + wrangler mult) would actually cause a DPS nerf for the sentry firing speed MvM upgrade.