CS2移动机制分析:Subtick等关键点解读

Analysis of movement in CS2 (subtick and more)

原帖地址:https://www.reddit.com/r/GlobalOffensive/comments/170nzzj/analysis_of_movement_in_cs2_subtick_and_more/

Hello. I wanted to clarify some things about movement in CS2 and how subtick affects movement. I already touched upon this in another thread, but I thought this deserves its own post so that the Counter-Strike community can understand how this works in detail.

大家好。我想解释一下 CS2 的移动机制和 subtick 如何影响我们的移动。在另一个帖子里我曾聊到过这一点,但我觉得它足够重要,值得为它单开一帖,以便使玩家社区能深入细节地理解它到底是如何工作的。

Moving and acceleration in CSGO

CSGO 中的移动和加速

Let's say that you are standing on a flat surface and press A for exactly one tick in Counter-Strike Global Offensive. What is the maximum velocity you get for that?

在 CSGO 中,假设你站在一个平整的地面上,精准地按住 A 一个 tick 的时长。这时你能达到的最大速度是多少?

The answer is that your velocity will peak at 21.48 u/s. The mathematical reasoning behind this, we can derive from CS:GO's movement code.

答案是你的速度最高是 21.48 u/s (单位距离/秒)。这背后的数学原因我们可以从 CSGO 的移动机制实现代码中得到。

Acceleration speed is equal to sv_accelerate * tick interval * max speed * surface friction.

移动速度等于 sv_accelerate x 一个 tick 的时间间隔 x 最大速度 x 表面摩擦惩罚

sv_accelerate default value is 5.5.

sv_accelerate 默认值是 5.5

The tick interval for 64 tick would be 0.015625 or written as (1 / 64).

一个 tick 的时间间隔对 64 tick 来说是 0.015625 或者写作六十四分之一。

Max speed is either 250 with your knife out, or equal to cl_sidespeed in the special case where this is below 250, but in csgo and cs2 this value is 450, so it does not matter.

最大速度在持刀状态下要么是 250,要么是 cl_sidespeed 当它小于 250 的时候,但是在 CSGO 和 CS2 中这个值默认是 450 所以它应当对此没有影响。

Surface friction is almost always 1, but could be lower on some textures like ice.

表面摩擦惩罚通常总是 1,但在某些材质比如冰上可以更低。

Calculating 5.5 * (1 / 64) * 250 * 1 gives a value of 21.484375, which corresponds to the speed we get in-game.

计算下,5.5 * (1 / 64) * 250 * 1 的结果为 21.484375,这和我们在游戏里测得的速度是一致的。

Now, the question is of course, how does this work in CS2?

现在来看我们最关心的问题,移动机制在 CS2 中是怎样工作的?

Subtick movement in CS2

CS2 中 Subtick 支撑的移动机制

To understand how subtick works in CS2, we need to look at what usercmds look like now.

要理解 subtick 在 CS2 中是怎样工作的,我们得先看看 CS2 中的 usercmd 长什么样。

If you were to toggle cl_showusercmd on, it will display the usercmds you send to the server. It is mostly like the one used in csgo, but there is a new section that is interesting to use. It is called subtick_moves and looks like this:

如果你打开 cl_showusercmd 命令,它就回把你发送给服务器的 usercmd 都显示出来。它的样子和 CSGO 中的差不多,但是多了一个新的值得关注的部分,叫做 subtick_moves,它长这样。

subtick_moves { button: 8 pressed: true when: 0.0173373781 }

Now, what happens when you press a key right in the middle of two ticks?

那么,当你在两个 tick 正中间的时刻按下按键时,会发生什么?

The game sets the time you pressed the key between two ticks in the subtick_moves section as a value between 0.0 and 1.0.

游戏会把你在两个 tick 间的按键的时间填充到 subtick_moves 里,记为一个 0.0 到 1.0 之间的值。

Lets do an experiment to see how this affects our velocity that we calculated earlier.

让我们做个实验看看这如何影响我们之前计算出的移动速度的理论值。

动图 1 原视频https://streamable.com/nw5hqr

In this clip, I press the A key roughly in the middle between two discreet ticks and let go just after we reach the next tick. The speed I got here was indeed not 21.48, but 9.17. Why is that? It is because the game now takes into account the value of the subtick_moves section of the usercmd, and the tick interval for the formula we talked about earlier is now not (1/64), but roughly (1/128).

在这个片段中,我在几乎准确的两个 tick 的中间时刻按下了 A 键,然后当到达下一个 tick 时松开。这里我达到的速度是 9.17 而不是 21.48。这是为什么呢?因为游戏现在会考虑usercmd 里 subtick_moves 记录的信息。之前我们的公式里的“一个 tick 里的时间间隔”现在不再是 (1/64) 了,而是接近于 (1/128)(译注:这里与 128 tick 无关,只是作者上文所提到的实验中加速了半个 tick 的时间)

Calculating the new value with 1/128 would be 5.5 * (1 / 128) * 250 * 1 = 10.7421875 u/s. So we can see that I was not 100% right in middle of two ticks, but slightly off. I am only human, but I hope you get the idea of how this works.

我们把新的 1/128 的值代入进公时重新计算,5.5 * (1 / 128) * 250 * 1 = 10.7421875 u/s (单位距离/秒)。通过这个值我们也能发现我不是 100% 精确地在两个 tick 的正中间按下了按键而是有些误差。毕竟我只是个正常人类,但通过这个实验我希望你能看懂这个机制是如何工作的。

So what we learned here is that the initial movement now is dependent on when you press down a key in relation to the apex of a tick.

那么,这里我们学到了的就是,移动的初始速度现在会受到按键时刻与 tick 发生时刻间的时间间隔的影响。

I think it is important to note here that no matter when you press your movement keys, you will never start moving before the next tick, just like in regular 64-tick without any subtick feature. It doesn't make your character move instantly, it just changes the initial velocity.

我觉得这里需要着重强调的是,无论你在什么时候按下了移动按键,你总是在下一个 tick 的时候才开始移动,和在没有 subtick 的 64 tick 服务器中是一样的。Subtick 不会让你的游戏人物在你按键的瞬间立刻开始移动,subtick 只是改变了移动的初始速度。

What is up with those binds?

那目前流行的哪些按键绑定是如何对移动机制起作用的?

Recently some people have been talking about binds to “desubtick” movement. Do these binds actually work? The answer is yes.

最近很多人在讨论“去 subtick 化”的移动按键绑定。这些按键绑定真的有用吗?答案是是的,它们有用。

What happens when you use aliases, is that the subtick_moves section of the usercmd we looked at earlier, is nulled out. This in practice means that there is no subtick data for the client to use, and you will get consistent results every time you use a movement key.

当你用这些按键绑定的时候,我们之前看到的 usercmd 中的 subtick_moves 部分被填空了。这意味着实际上客户端没有 subtick 的数据可以利用,这样你在每次按下移动键时都能得到一个稳定可预期的结果。

Here is a video of that in action.

下面是实际实验的结果。

动图3 原视频:https://streamable.com/n3grb3

Look at that. The velocity peaks at 21.48, just like in CS:GO. This happens regardless of when you press your key between ticks when this alias is enabled. This also affects jumping too, which is why some people use aliased jump binds.

从实验中可以看到,速度最高为 21.48,和在 CSGO 中是一样的。当你绑定按键之后,你在两个 tick 间的任意时刻按键总是能得到这样的结果。这个方法对跳跃同样有效果,所以有些人会对跳也使用按键绑定。

Jump height in CS2

CS2 中的跳跃高度

This is just an additional bit that I wanted to add. In cs2 it seems like you are slightly lower towards the ground (although I admit this could potentially be a problem with cl_showpos), which affects how high you can jump. I found that sv_jump_impulse 302.072838898 (sqrt of 800 * 2 * 57.03) restores the exact same jump height as in CS:GO.

这里我想说些题外话。在 CS2 中,似乎游戏人物的高度会稍微矮一点(当然我也承认这可能是 cl_showpos 指令有问题),这会影响你能跳到多高。我发现 sv_jump_impulse 302.072838898 (根下 800 * 2 * 57.03) 可以恢复 CSGO 中的跳跃高度。

Personal thoughts

(原作者的)个人想法

I am not so sure that subtick movement in cs2 is obviously a good thing. I believe that there could be a benefit to having movement locked to a 64hz grid, as that will allow you to have some level of consistency as there is a window you can hit. When subtick is enabled, you have a near infinite range of values between two ticks that you can hit, and they all affect how much speed you get on the next tick. And as you still dont move before the next tick anyway even with subtick, I don't see how useful it really is. I am looking forward to hearing what other people think about this though.

我不确定 CS2 中采用基于 subtick 的移动机制是不是件好事。我相信把移动绑定到 64Hz 是有好处的(译注:即开头讨论的 CSGO 中的基于 tick 的移动),因为它是人可以掌控的,可以提供某种程度上的稳定可预期性。当 subtick 被启用时,你的操作会被映射到两个 tick 间近乎无限个可能的时刻,而这个映射的结果会影响你下一个 tick 的移动速度。我实在看不出这种设计有什么用,不过我也想看看大家对这个设计的看法。

QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空