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
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

Bunnyhopping is capped if your speed on your jump exceeds a certain threshold. When your speed is over the limit, by default the game assumes you are always moving forward so the game accelerate you backwards to reduce your speed down to the threshold. However if you are moving backwards when the game bounds your speed, the game will try to slow you down by adding backward speed, consequently accelerating you.
As mentioned above, the amount of backward speed the game applies on you is based on your speed when you jump, so the faster you go, 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 based on the state of the player when you jump. The table below will show those thresholds and first ABH speeds if you sprint jump then enter the conditions listed and frame-perfectly do ABH's. 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 n/a 479 n/a
While running 285 225 419 n/a
While sprinting 352 n/a n/a n/a

Ducking while doing ABH is recommended since it has the lowest speedcap of all states at 209 UPS.

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 player speed and whether to subtract instead.

  1. Calculate flSpeedBoostPerc to figure out the multiplier for calculating the additional speed and maximum speed for bounding it.
  2. The game calculates flSpeedBoostPerc based on the state of the player when they jump, so when we are crouched or we are sprinting, it chooses 0.1; for other states like running or walking, it chooses 0.5.

    float flSpeedBoostPerc = ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked ) ? 0.5f : 0.1f;
    
  3. Calculate the initial flSpeedAddition which is the amount of speed to add onto the player's existing speed.
  4. The way the game calculates the addition speed is to take 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 you move in the state you jumped in, so when you 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 take the flSpeedAddition and adding it to 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 is too high, calculate the new amount of speed to apply onto the player using an equation.
  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 speed.

The Flaw

Normally an ABH is done by doing a backward sprintjump, crouch in midair, land and continue jumping without holding any directional keys. In the calculations below, we'll assume that inputs are frame-perfect without any loss of speed.
When the player sprints and then jump backwards, their speed will be negative and when they land and crouchjump, our speed will be 352 UPS. Ideally mv->m_flForwardMove should be 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

This means 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 bound routine. But 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 2 jumps our speed'd be 1333 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.

Explanation

Summary
When you're flying forwards and land, if you press or hold S and press Space, 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 you're holding S, 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, although some speed is lost.

Personal tools