Logo135.png We're building a new wiki, so information on this page may be out of date.

We'd love for you to help us out!

Accelerated Back Hopping

From SourceRuns
(Redirected from AFH)
Jump to: navigation, search

Accelerated Back Hopping (ABH for short) is a Glitch, and it's the main method of movement on OrangeBox Engine-based games. ABH replaces Bunnyhopping, which was fixed in the OrangeBox Engine. It is also significantly faster than bunnyhopping.

How to

Jump forward, turn around in the air and jump right as you land. It's recommended not to hold S or W (or your respective keys for moving forwards and back) while ABHing. Binding +jump to mouse wheel or using a jumping script is recommended as it makes timing jumps a lot easier.

Explanation

ABH works due to Valve not accounting for the direction of the player's speed when capping it, thus leading to the directly opposite result of accelerating the player even further.

Summary

Your speed is capped when the speed on your jump exceeds a certain threshold. When this happens, the game will try to slow you down by applying speed opposite your viewing direction, rather than your movement direction. As such, when you are moving backwards, the game will effectively accelerate you.


The amount of backward speed the game applies on you is based on your speed the moment before the jump; so the faster you are when you jump, the more speed you'll get.
Because of this, you can accelerate extremely fast, much faster than bunnyhopping.

ABHing and Bunnyhopping comparison chart, shows the speed gain on each jump (no sprint).

The speed threshold is dependent on your movement state when you jump. The table below will show these thresholds and the maximum speed you can get on your first ABH after doing a sprint jump (a normal run-up jump if without a suit), turning around exactly 180 degrees then entering the specified state. Note that some conditions will not give you speed because of how the speed is calculated.

Conditions Speed limit First possible ABH speed
With suit Without suit With suit Without suit
While crouching 209 165 495 285
While walking 225 225 479 n/a (2)
While running 285 419
While sprinting 352 n/a (1) n/a (3)

Notes:
(1) You cannot sprint without a suit.
(2) The only states you can enter without the suit is walking and crouching.
(3) You cannot sprint while jumping.

Ducking while doing ABH is recommended since it has the lowest speedcap of all states at 209 UPS. Walking is also recommended as it allows for better air control between jumps.

Equation

Compounding all the flaws shown below, we can calculate our next speed after an ABH (given that the jump is perfect and there is no angle change) with the equation below:

(your current speed) * 2 - flMaxSpeed

Substitute flMaxSpeed with the Speed limits from the table above and you will have your new speed.

How the game calculates and bounds your speed when bunnyhopping

The game goes through a few steps to decide how much to add to or subtract from the player's speed.

  1. Calculate the speed multiplier flSpeedBoostPerc for figuring out our speed addition and maximum speeds.
  2. This is calculated based on the state of the player when they jump. If we aren't sprinting and aren't ducked, it is set to 0.5, else it is set to 1.

    float flSpeedBoostPerc = ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked ) ? 0.5f : 0.1f;
    
  3. Calculate the initial value for our speed addition flSpeedAddition
  4. This is calculated by taking the absolute value of the product of mv->m_flForwardMove and flSpeedBoostPerc

    float flSpeedAddition = fabs( mv->m_flForwardMove * flSpeedBoostPerc );
    

    mv->m_flForwardMove is the normal speed we move while in the state we jumped in, so when we do a sprint jump, it is 320; a running jump is 190;...

  5. Calculate the maximum speed flMaxSpeed for bounding the player's speed later on.
  6. float flMaxSpeed = mv->m_flMaxSpeed + ( mv->m_flMaxSpeed * flSpeedBoostPerc );
    
  7. Calculate the player's initial new speed flNewSpeed
  8. It does this by simply taking the flSpeedAddition and adding it onto the player's initial speed when they jump.

    float flNewSpeed = ( flSpeedAddition + mv->m_vecVelocity.Length2D() );
    
  9. Check if the player's new speed is higher than the maximum. If it exceeds it, subtract from our speed addition how much our new speed surpasses the maximum allowed speed.
  10. // If we're over the maximum, we want to only boost as much as will get us to the goal speed
    if ( flNewSpeed > flMaxSpeed )
    {
    	flSpeedAddition -= flNewSpeed - flMaxSpeed;
    }
    

After all the steps above, the game takes the newly acquired flSpeedAddition and apply it onto the player's current speed.

The Flaw

Normally an ABH is done by doing a backward sprintjump, crouching in midair, landing then continue jumping without holding any directional keys. In the calculations below, we'll assume that inputs are frame-perfect without any loss of speed.
Let's imagine a player doing crouched ABHs in a straight line. When the player begins their run up by sprinting backwards and then jumping, their speed would be negative. Right before the next jump in the ABH sequence, their speed would be at 352 UPS. Ideally at this point, since they're crouched, mv->m_flForwardMove should be at 190; but because we are not holding any directional keys, it is 0 instead. This means our additional speed we get will also be 0.

float flSpeedAddition = fabs( mv->m_flForwardMove * flSpeedBoostPerc ) = fabs(0 * 0.1) = 0

As a result, our new speed will also be the same as the old which would be

float flNewSpeed = ( flSpeedAddition + mv->m_vecVelocity.Length2D() ) = 0 + 352 = 352

Because your speed is over the threshold when landing (we land at 352 UPS which is higher than the 209 UPS threshold when crouching), the game does the speed bounding routine. However, since our flSpeedAddition is 0, this will come out as negative.

flSpeedAddition 	-= flNewSpeed - flMaxSpeed
			= flSpeedAddition - (flNewSpeed - flMaxSpeed)
			= 0 - (352 - 209)
			= -143

And since you're moving backwards and your speed is negative, your new speed will be increased. Our new speed in this case is 495. After 2 another jumps, the speed increase will be massive

(2nd ABH jump)
flSpeedAddition 	-= flNewSpeed - flMaxSpeed
			= flSpeedAddition - (flNewSpeed - flMaxSpeed)
			= 0 - (352 + 143 - 209)
			= -286

(3rd ABH jump)
flSpeedAddition 	-= flNewSpeed - flMaxSpeed
			= flSpeedAddition - (flNewSpeed - flMaxSpeed)
			= 0 - (352 + 143 + 286 - 209)
			= -579

After these 2 jumps, our speed would be 1360 UPS.

Variants

There are some ways to gain speed similar to ABH:

Accelerated Forward Hopping (AFH)







How-to

Once you've gained some speed while ABH-ing, you can turn around and start pressing S every time you jump, allowing you to see where you're going. In games with relatively high air acceleration like Half-Life 2, the more precise your S-taps are. the more speed you'll preserve since the longer you hold S the more you decelerate yourself while in the air. On the other hand on games like Portal with lower air acceleration, you can simply hold S to do AFH's.

+strafe method
A more modern method of getting AFHs is to use the strafe modifier +strafe. When bound to a key and held, mouse movements are converted into player movement, with velocity and direction based on how fast and where to the mouse is moved. This means a downward mouse movement in this state is equivalent to pressing S. However, movement while in this state can be considerably slower than normal WASD movement, and as such the penalties for missing the "S tap" can be much lower, allowing for faster AFHs and more opportunities for getting an AFH with minimal to no run up.

Explanation

Summary
When you have forward speed and land, if you press or hold S and jump, the game will assume that you are moving backwards and thus it will try to "decelerate" you by applying speed the opposite direction, consequently accelerating you.

Detailed
When S is held, mv->m_flForwardMove is negative, which shouldn't interfere in the speed capping as the function uses its absolute value. However at the very bottom there's the following bit of code:

if ( mv->m_flForwardMove < 0.0f )
	flSpeedAddition *= -1.0f;

Which effectively turns the speed reduction amount from being negative to positive, thus accelerating you.

(before)
flSpeedAddition 	-= flNewSpeed - flMaxSpeed
			 = flSpeedAddition - (flNewSpeed - flMaxSpeed)
			 = 0 - (352 - 209)
			 = -143

(after)
flSpeedAddition 	*= -1.0f
flSpeedAddition 	 = -143 * -1
flSpeedAddition 	 = 143

143 UPS is added to your previous positive speed instead of the -143 from before.


Accelerated Side Hopping (ASH)







How-to

To execute this, start an ABH but instead of turning around in the air, adjust your view slightly to the left (or right) and hold S and D (or S and A) to gain speed. Unlike AFH, if you are ASH-ing close to the ground, you can hold your inputs and adjust your aim accordingly to consistently do the trick. However, if you're in the middle of a launch, releasing your inputs is recommended in order not to disturb with your jump and to allow better maneuverability while you're in the air.

Explanation

Like with AFH, when you hold down S and a strafe key, mv->m_flForwardMove would also be negative, consequently the speed "reduction" is reversed and added on top of your original speed. Turning your view slightly to the left or right depending on which strafe key you wish to hold is necessary to preserve speed, as it negates the penalties of holding S.

Personal tools