{"id":198,"date":"2021-07-30T11:14:12","date_gmt":"2021-07-30T15:14:12","guid":{"rendered":"https:\/\/www.artifexquake.com\/?page_id=198"},"modified":"2024-08-02T20:29:14","modified_gmt":"2024-08-03T00:29:14","slug":"wall-strafing-by-injx","status":"publish","type":"page","link":"https:\/\/www.artifexquake.com\/?page_id=198","title":{"rendered":"Wall Strafing by injx"},"content":{"rendered":"<p>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.<\/p>\n<p>This article will look at the mathematics of wall strafing to determine the maximum speed obtainable, and the required angles.<\/p>\n<p>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 <i>clips<\/i> the velocity appropriately.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/diag1.gif\" alt=\"diagram 1\" width=\"128\" height=\"248\" \/><\/p>\n<p>Consider a player moving <b>parallel<\/b> to a wall, and let the acceleration angle (between the velocity\/wall and proposed acceleration direction) be angle <b>delta<\/b>, <span class=\"var\">d<\/span>.<\/p>\n<p>The applied acceleration, <span class=\"vector\">a<\/span>, produces a change in the existing velocity, <span class=\"vector\">v<\/span>, giving a new velocity, <span class=\"vector\">v<i>&#8216;<\/i><\/span> (read: &#8220;v-prime&#8221;). The usual friction is applied and then the accleration is added, giving<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-vprime.gif\" alt=\"v-prime\" width=\"164\" height=\"33\" \/>,<\/p>\n<p>where <span class=\"var\">c<\/span> is the friction constant and <span class=\"var\">T<\/span> is the frame-time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/diag2.gif\" alt=\"diagram 2\" width=\"143\" height=\"220\" \/><\/p>\n<p>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.<\/p>\n<p>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<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-r.gif\" alt=\"resultant velocity\" width=\"83\" height=\"32\" \/><\/p>\n<p>and its direction is the same as the original velocity, along the wall. [Here the hat notation represents a unit-vector]<\/p>\n<p>By substituting in the expression for v-prime, expanding the brackets and evaluating the dot-products,<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-r2.gif\" alt=\"resultant velocity\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-r3.gif\" alt=\"resultant velocity\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-r4.gif\" alt=\"resultant velocity\" \/><\/p>\n<p>From this expression, it&#8217;s trivial to see that the greatest increase in speed is obtained when the cosine of angle delta is as large as possible &#8211; i.e. when angle delta itself is as small as possible. For those of you who&#8217;ve read Strafing Theory alarm bells should be ringing at this news.<\/p>\n<p>The smallest possible angle delta that gives full acceleration is the same optimal angle used in Strafing Theory and Circle-Jump Theory,<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-cosdeltaopt.gif\" alt=\"cos delta opt\" \/><\/p>\n<p>By using this optimal angle, we can look for the maximum velocity obtainable. The maximum velocity is, mathematically speaking, a fixed-point where <span class=\"var\">r = v<\/span>. Using this, we gain an expression for the maximum wall-running speed:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-vmax.gif\" alt=\"v-max\" \/><\/p>\n<p>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&#8217;t unexpected.<\/p>\n<p>On the ground, this gives values of <b>406ups for VQ3<\/b> and <b>486ups for CPM<\/b>.<\/p>\n<p>Note that if you are in the air (hence no friction, <span class=\"var\">c<\/span> = 0) there is no limit on the max velocity due to the wall.<\/p>\n<p>And finally by substituting in the max velocity expression, we can get an absolute expression for the angle delta required to achieve it,<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20081224112455im_\/http:\/\/www.funender.com\/quake\/images\/wallstrafe\/math-deltaopt.gif\" alt=\"delta opt\" \/>,<\/p>\n<p>which gives <b>40 degrees for VQ3<\/b> and <b>53 degrees for CPM<\/b>.<\/p>\n<p>In order to perform wall-running, most players use the <b>combination of a strafe key together with the forwards key<\/b>, meaning that <b>the view angle required is 45 degrees less than those angles given above<\/b>. This means that the view angles are <b>-5<\/b> and <b>+8<\/b> degrees for <b>VQ3<\/b> and <b>CPM<\/b> respectively. This is interesting as it means for VQ3 the view angle is <b>5 degrees away from the wall<\/b>, whereas for CPM the view angle is <b>8 degrees into the wall<\/b>.<\/p>\n<p>&nbsp;<\/p>\n<p>Source: web.archive.org<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip;<br \/><a href=\"https:\/\/www.artifexquake.com\/?page_id=198\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Wall Strafing by injx<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-198","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=\/wp\/v2\/pages\/198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=198"}],"version-history":[{"count":0,"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=\/wp\/v2\/pages\/198\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.artifexquake.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}