Wall Strafing by injx

Wall strafing is a technique that allows a player to increase their speed beyond the 320ups speed limit enforced by g_speed simply by accelerating into a wall while sliding along it.

This article will look at the mathematics of wall strafing to determine the maximum speed obtainable, and the required angles.

When positioned against a wall or other obstacle, the usual player movement acceleration can still be applied, even if it is pointing into the wall, but obviously the player is prohibited from moving through the wall. When an acceleration is applied, the engine first calculates the change in velocity this produces, even if the acceleration would take the player to a prohibited location. Once the new velocity has been calculated, then the engine looks for walls and clips the velocity appropriately.

diagram 1

Consider a player moving parallel to a wall, and let the acceleration angle (between the velocity/wall and proposed acceleration direction) be angle delta, d.

The applied acceleration, a, produces a change in the existing velocity, v, giving a new velocity, v (read: “v-prime”). The usual friction is applied and then the accleration is added, giving

v-prime,

where c is the friction constant and T is the frame-time.

diagram 2

Next, the wall is taken into account, and as the player is already touching the wall, they are not allowed to move any further into it. As you can see above, the new velocity (v-prime) has some component into the wall.

The engine clips the velocity by removing the component of the new velocity that points into the plane of the wall, leaving the component along the wall. Mathematically, the resultant velocity is given by

resultant velocity

and its direction is the same as the original velocity, along the wall. [Here the hat notation represents a unit-vector]

By substituting in the expression for v-prime, expanding the brackets and evaluating the dot-products,

resultant velocity
resultant velocity
resultant velocity

From this expression, it’s trivial to see that the greatest increase in speed is obtained when the cosine of angle delta is as large as possible – i.e. when angle delta itself is as small as possible. For those of you who’ve read Strafing Theory alarm bells should be ringing at this news.

The smallest possible angle delta that gives full acceleration is the same optimal angle used in Strafing Theory and Circle-Jump Theory,

cos delta opt

By using this optimal angle, we can look for the maximum velocity obtainable. The maximum velocity is, mathematically speaking, a fixed-point where r = v. Using this, we gain an expression for the maximum wall-running speed:

v-max

This is actually very similar to the maximum ground speed expression obtained in Circle-Jump Theory. In fact the values given by this expression are a little smaller than those for the max ground speed, which isn’t unexpected.

On the ground, this gives values of 406ups for VQ3 and 486ups for CPM.

Note that if you are in the air (hence no friction, c = 0) there is no limit on the max velocity due to the wall.

And finally by substituting in the max velocity expression, we can get an absolute expression for the angle delta required to achieve it,

delta opt,

which gives 40 degrees for VQ3 and 53 degrees for CPM.

In order to perform wall-running, most players use the combination of a strafe key together with the forwards key, meaning that the view angle required is 45 degrees less than those angles given above. This means that the view angles are -5 and +8 degrees for VQ3 and CPM respectively. This is interesting as it means for VQ3 the view angle is 5 degrees away from the wall, whereas for CPM the view angle is 8 degrees into the wall.

 

Source: web.archive.org