Movement/zh: Difference between revisions

From DDraceNetwork
No edit summary
(Created page with "速度上限:基础为 6000 方块每游戏刻,再加上当前加速度的值,例如重力、喷气背包、爆炸推力的加速度值(实际上是速度达到上限时,加速度提供了一游戏刻超出上限的速度,在下一个游戏刻速度才会被限制回到上限值)")
 
(29 intermediate revisions by the same user not shown)
Line 18: Line 18:
=== [[Special:MyLanguage/Jump|跳跃]] ===
=== [[Special:MyLanguage/Jump|跳跃]] ===


<div lang="en" dir="ltr" class="mw-content-ltr">
地面跳跃将玩家的竖直速度设置为-13.2 单位。
Ground jumping sets a tee's y velocity to -13.2, scaled by a value.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
空中跳跃(二段跳)将玩家的竖直速度设置为-12.0 单位。
Air jumping (double-jump) sets a tee's y velocity to -12.0, scaled by a value.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
跳跃是直接将玩家竖直速度'''设置'''为某个值,无视原有的速度。这个特性在用于取消原有的巨大速度时很有效。
Jumping will ''set'' the y velocity, cancelling out any previous upwards or downwards velocity. This is very useful in scenarios where you need to halt large vertical impulses.
</div>
{{Todo|Find the bps value or scaled coefficient for these values (same with the horizontal movement, these values are not in bps)}}
{{Todo|Find the bps value or scaled coefficient for these values (same with the horizontal movement, these values are not in bps)}}




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Horizontal_Movement:"></span>
=== Horizontal Movement: ===
=== 水平速度变化 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 在松开所有按键的情况下:
* Pressing nothing:
** 地面减速公式:每游戏刻减半<syntaxhighlight lang="c++" inline="">velocity.x = velocity.x * 0.5</syntaxhighlight>
** Ground: Every tick <syntaxhighlight lang="c++" inline="">velocity.x = velocity.x * 0.5</syntaxhighlight>
** 空中减速公式:每游戏刻减少 5%<syntaxhighlight lang="c++" inline="">velocity.x = velocity.x * 0.95</syntaxhighlight>
** Air: Every tick <syntaxhighlight lang="c++" inline="">velocity.x = velocity.x * 0.95</syntaxhighlight>
* 按下速度相反的方向键:
* Pressing key in opposite direction:
** 地面转向公式:每游戏刻减少 2 个单位,直到变成10个单位的反向速度。
** Ground: Every tick the horizontal velocity decreases by 2 until 10 in the opposite direction is reached
** 空中转向公式:每游戏刻减少 1.5 个单位,直到变成5个单位的反向速度。
** Air: Every tick the horizontal velocity decreases by 1.5 until 5 in the opposite direction is reached
* 按住左或者右(默认为{{key press|A}}{{key press|D}})的情况下:
* Horizontal speed up by pressing {{Kbd|a}} or {{Kbd|d}}:
** 地面加速公式:每游戏刻增加 2 个单位,速度上限为 10
** Ground: Every tick the horizontal velocity increases by 2 until 10 is reached
** 空中加速公式:每游戏刻增加 1.5 个单位,速度上限为 5
** Air: Every tick the horizontal velocity increases by 1.5 until 5 is reached\
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
按住左右移动时会无视摩檫力,因此高速前进的时候摩擦减速可能比按住反方向移动键更多,因为按住按键减速是固定值,但是摩檫减速会因速度增加而增大,从而大于这个固定值。
Friction is ignored when holding down a key. So, at high velocities, pressing nothing will slow a tee down faster than moving in the opposite direction, as the friction will have an exponential slowdown compared to the <code>a/d</code> linear slowdown.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Advanced"></span>
== Advanced ==
== 进阶特性 ==
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Max_Speed"></span>
=== Max Speed ===
=== 速度上限 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
速度上限:基础为 6000 方块每游戏刻,再加上当前加速度的值,例如重力、喷气背包、爆炸推力的加速度值(实际上是速度达到上限时,加速度提供了一游戏刻超出上限的速度,在下一个游戏刻速度才会被限制回到上限值)
Max speed: 6000 Sub-tiles/Tick (+speedup in one tick, e.g. gravity, jetpack, explosion).
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<code>src/game/gamecore.cpp</code> (在利用速度计算玩家下一个位置前有如下代码):<syntaxhighlight lang="c++">
<code>src/game/gamecore.cpp</code> (before calculating new position from velocity):<syntaxhighlight lang="c++">
if(length(m_Vel) > 6000)
if(length(m_Vel) > 6000)
     m_Vel = normalize(m_Vel) * 6000;
     m_Vel = normalize(m_Vel) * 6000;
</syntaxhighlight>This is the bottleneck in vertical movement. In horizontal movement a “ramp”-Value is multiplied to the horizontal speed. Causing the tee to slow down and stop when getting too fast. This is most commonly observed in speed ups.
</syntaxhighlight>其中内嵌了一个归一化函数重新计算了速度带来的影响,是竖直速度的瓶颈由来。而水平方向上则有一个ramp曲线因子,导致玩家在速度过快时减速或者停下。在加速时很容易看见这些现象。
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
速度的精度有每游戏刻 <math>\frac{1}{256}</math> 个单位的向下舍入误差。
The speed is rounded down to a precision of <math>\frac{1}{256}</math> every tick. This is causing the tee to stop moving horizontal when having too much speed.
 
</div>
理论上速度超过一定值后,ramp修正因子应该让速度稳定到一个固定值。例如说想要保持最大速度为 1,在速度小于 1 时不作修正,而速度大于 1 的时候,比如说 50,则因子应该变为 1/50 ,这样一来速度就不会超过 1。 但是这样一来速度达到 257 的时候,修正因子理论上应该为 1/257,但是这个数值比单位刻度1/256要小,因此被舍入为 0,这导致实际上玩家水平速度过大时游戏表现为停下不动。


{{Todo|* convert sub-tiles/tick into tiles/sec * find max vel und real max vel (from where would a constant function fit) * find speed, where the tee stops moving * write about ramp speed, and add diagram}}
{{Todo|* convert sub-tiles/tick into tiles/sec * find max vel und real max vel (from where would a constant function fit) * find speed, where the tee stops moving * write about ramp speed, and add diagram}}




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Corner_Skimming"></span>
=== Corner Skimming ===
=== 斜角掠过 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
判定玩家处于地面或滞空的根据是玩家位置到地面的距离,而不是向下的速度。因此玩家上升过程中也可能判定为贴地,比如斜向飞行时擦到方块的角。
A tee is considered on the ground only due to its position and distance to the ground - it does not require the tee to have downwards velocity. So, it is possible for a tee to be "grounded" while traveling upwards, as long as the tee skims the corner of a tile.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
关于斜角掠过:
Corner skimming:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 玩家的二段跳将会刷新(在地图 [https://ddnet.org/maps/Impetuous Impetuous] 偷鸡时很好用)。
* allows a tee to refresh its double-jump (useful when skipping maps such as [https://ddnet.org/maps/Impetuous Impetuous]).
* 判定玩家在地面时有一小段时间可以利用地面更高的水平加速和限速(注意滞空的加速和限速比在地面小)。
* can apply ground acceleration and max speed to a tee for a short amount of time (assuming the tee's horizontal midair speed is less than the maximum ground speed prior to corner skimming)
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
斜角掠过通常不算一种玩家会主动使用的技巧(除了地图 [https://ddnet.org/maps/Short-32-And-32-Precise-32-7/ Short and Precise 7] 等),但是在速通时可以考虑一下。
Corner skimming is not often intentionally used in map parts (except for maps such as [https://ddnet.org/maps/Short-32-And-32-Precise-32-7/ Short and Precise 7]), but can be used in short speedruns as small optimizations.
</div>
{{Todo|add gif}}
{{Todo|add gif}}


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Elevated_Jump"></span>
=== Elevated Jump ===
=== 抬升跳 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
玩家离地少许依旧能够使用地面跳,因此可以获取比平地直接跳稍微高一点的高度。
A ground jump can be performed even if the tee is a few subunits above the ground.
</div>
[[Category:Game-Mechanic{{#translation:}}]]
[[Category:Game-Mechanic{{#translation:}}]]

Latest revision as of 05:44, 13 August 2023

此条目仍需进行内容补充,您可以帮助我们编辑和修订以扩充其内容。

基本移动是 Teeworlds 和 DDrace 的核心操作方式之一。


基础信息

重力

处于默认重力下的玩家会在竖直方向 Y 轴每游戏刻增加 0.5 的向下速度。


跳跃

地面跳跃将玩家的竖直速度设置为-13.2 单位。

空中跳跃(二段跳)将玩家的竖直速度设置为-12.0 单位。

跳跃是直接将玩家竖直速度设置为某个值,无视原有的速度。这个特性在用于取消原有的巨大速度时很有效。

待办: Find the bps value or scaled coefficient for these values (same with the horizontal movement, these values are not in bps)


水平速度变化

  • 在松开所有按键的情况下:
    • 地面减速公式:每游戏刻减半velocity.x = velocity.x * 0.5
    • 空中减速公式:每游戏刻减少 5%velocity.x = velocity.x * 0.95
  • 按下速度相反的方向键:
    • 地面转向公式:每游戏刻减少 2 个单位,直到变成10个单位的反向速度。
    • 空中转向公式:每游戏刻减少 1.5 个单位,直到变成5个单位的反向速度。
  • 按住左或者右(默认为AD)的情况下:
    • 地面加速公式:每游戏刻增加 2 个单位,速度上限为 10。
    • 空中加速公式:每游戏刻增加 1.5 个单位,速度上限为 5。


按住左右移动时会无视摩檫力,因此高速前进的时候摩擦减速可能比按住反方向移动键更多,因为按住按键减速是固定值,但是摩檫减速会因速度增加而增大,从而大于这个固定值。


进阶特性

速度上限

速度上限:基础为 6000 方块每游戏刻,再加上当前加速度的值,例如重力、喷气背包、爆炸推力的加速度值(实际上是速度达到上限时,加速度提供了一游戏刻超出上限的速度,在下一个游戏刻速度才会被限制回到上限值)

src/game/gamecore.cpp (在利用速度计算玩家下一个位置前有如下代码):

if(length(m_Vel) > 6000)
    m_Vel = normalize(m_Vel) * 6000;

其中内嵌了一个归一化函数重新计算了速度带来的影响,是竖直速度的瓶颈由来。而水平方向上则有一个ramp曲线因子,导致玩家在速度过快时减速或者停下。在加速时很容易看见这些现象。

速度的精度有每游戏刻 个单位的向下舍入误差。

理论上速度超过一定值后,ramp修正因子应该让速度稳定到一个固定值。例如说想要保持最大速度为 1,在速度小于 1 时不作修正,而速度大于 1 的时候,比如说 50,则因子应该变为 1/50 ,这样一来速度就不会超过 1。 但是这样一来速度达到 257 的时候,修正因子理论上应该为 1/257,但是这个数值比单位刻度1/256要小,因此被舍入为 0,这导致实际上玩家水平速度过大时游戏表现为停下不动。

待办: * convert sub-tiles/tick into tiles/sec * find max vel und real max vel (from where would a constant function fit) * find speed, where the tee stops moving * write about ramp speed, and add diagram


斜角掠过

判定玩家处于地面或滞空的根据是玩家位置到地面的距离,而不是向下的速度。因此玩家上升过程中也可能判定为贴地,比如斜向飞行时擦到方块的角。

关于斜角掠过:

  • 玩家的二段跳将会刷新(在地图 Impetuous 偷鸡时很好用)。
  • 判定玩家在地面时有一小段时间可以利用地面更高的水平加速和限速(注意滞空的加速和限速比在地面小)。


斜角掠过通常不算一种玩家会主动使用的技巧(除了地图 Short and Precise 7 等),但是在速通时可以考虑一下。

待办: add gif

抬升跳

玩家离地少许依旧能够使用地面跳,因此可以获取比平地直接跳稍微高一点的高度。