9-15 4,708 views
作者:nenn(百度id:正正正正正好)
注1:本文中部分内容为对Minecraft技术wikia的直接翻译,译者为本人nenn。
蓝色框中的内容为原文,绿色框中的内容为参考译文,橙色框中的内容为译者注释。翻译原文的来源为:
http://technical-minecraft.wikia.com/wiki/0-tick_pulses
注2:本文中的翻译部分为学习交流用途而非商业用途,不声明版权,翻译内容仅供参考和交流。其余内容版权为Redstone Machinery Communication 红石机械交流促进会 所有。欢迎喜欢的读者注明本文链接并转载。当然,我们不介意明月庄主(优酷账号:明月庄主moon,百度id:明月庄主moon,Minecraft游戏名:moonboos)在未标明原链接的情况下使用本文中的翻译和讲解,因为已经见怪不怪了(滑稽)。
一。
简单来说,游戏刻就是Minecraft进行更新的最小单位时间间隔,1游戏刻=0.05秒。游戏刻英语表达为“game tick”,常简称“gt”,这是为了与红石电路中常用的红石刻(1红石刻=2游戏刻=0.1秒,常简称“t”)相区分。
二。
脉冲信号表达的是一种局部的信号概念。多数初级玩家口中常称作的脉冲并非脉冲原本的含义。虽然时钟信号也是一种周期性的脉冲信号,但是脉冲本身是一个大类的概念,把时钟信号称作脉冲极其容易造成误解。举个例子类比,你可以说人是一种灵长类动物,但是你不能说灵长类动物就是人。因为灵长类动物还包括多种猩猩、猴子等种类。类似的,你可以把时钟信号称作脉冲信号,但是当设计更复杂的时序电路时,这样的表达会造成误解,因为你无法区分单脉冲和周期性脉冲,也无法区分一般的周期性脉冲和时钟信号。根据常用习惯,一般脉冲的说法多指单脉冲,而非多数初级玩家所指的时钟信号。关于脉冲的详细概念,可以参考本人写的另一个帖子:【Confidential】短脉冲的实现及应用。其中详细介绍了脉冲的基本概念,建议先阅读该贴,不然会对后文的理解造成麻烦。
三。
0刻脉冲是指脉冲的长度(也可称脉冲宽度)为0游戏刻。也就是说,这个脉冲的两个边沿信号在同一个游戏刻内。但关于这两个边沿究竟在哪一个游戏刻,并不是我们关心的问题。因此这里的解释着重在强调这一点:0刻脉冲不是说在拉下拉杆的瞬间放出一个脉冲,而是指这个脉冲在时间上的展开长度是0游戏刻,也就是转瞬即逝。
For many blocks, the block update order will be location dependent, and therefore appear random to most human beings. But there are certain redstone triggered events, that reliably wait for almost all other blocks to update first, which can be used to compensate for the otherwise random update order. However it needs to be mentioned, that sometimes things in 0 tick technology can appear completely nonsensical and weird, because of the constant randomness introduced by the update order.
对多种方块来说,方块更新的顺序取决于其所在位置,所以对于大部分人来说,这个顺序呈现随机性。但游戏内有着确定的红石触发事件,其定会待所有其他方块先更新。这个机制将用于补偿其他的随机更新顺序。然而需要指出的是,有时0刻脉冲技术中的事物将变得完全无意义或者怪诞,这是因为由于更新顺序引入的不随时间变化(此处constant有永恒之意,故译作不随时间发生变化)的随机性。
Repeaters and comparators wait for almost all other redstone components to update first before they activate themselves. Additionally, comparators will always wait for all repeaters to update. Redstone components that wait a long time before updating are very helpful when making 0 tick pulse based contraptions. With repeaters and comparators the following 0 tick generator can be made:
Blue is input. Red block gets a 0 tick pulse output. This 0 tick generator was first discovered by test137e29.
红石中继器和红石比较器会待几乎所有其他红石元件先更新之后,他们才会被激活。另外,红石比较器将总是待所有的红石中继器先更新后才更新。使用特殊装置产生0刻脉冲时,在元件更新前需要等待很长时间的红石元件非常有用。带有红石中继器和红石比较器的0刻脉冲发生器就可以这样制作:
蓝色方块为输入端,红色方块为0刻脉冲输出端。0刻脉冲发生器最早由test137e29发现。
红石中继器总是先于红石比较器更新。
红石中继器总是先于红石比较器更新,正是基于这一点,在同一个游戏刻内才能形成固定的更新顺序。如果将这里的一个红石中继器和一个红石比较器换成两个红石中继器或者两个红石比较器,那么更新顺序就会表现出随空间变化的随机特点,无法形成稳定的可靠的0刻脉冲发生器方案。例如下图的测试结果。
Chaining repeaters and comparators
As previously mentioned, in each game tick first all repeaters will update, and afterwards all comparators will update. However there’s still the following question: If two repeaters update within the same game tick, which one updates first? The answer to that question is: The repeater that first recieved its input one r-tick ago, will also output first. This makes repeaters and comparators even more useful, since the following things can be done:
If the lever on the picture on the right is flicked, the iron blocks, and technical blocks connected to them will update in the order, that is numerically shown on the picture. The blocks 1 and 2, will of course update before 3 and 4, because there are repeaters activating them, instead of comparators. However it is also guaranteed, that block 1 will activate before block 2, because the repeater that activates block 1 will be activated before the repeater that activates block 2, since the first repeater gets activated by a repeater, while the second repeater gets activated by a comparator. For similar reasons block 3 is also guaranteed to activate before block 4. It is even possible to make longer chains of repeaters and comparators to get more than just 4 updates in a reliable order.
恰如前文所述,每个游戏刻内所有的红石中继器先进行更新,然后所有的红石比较器才会更新。然而还有一个问题:如果两个中继器在同一个游戏刻内更新,那么哪一个会先更新呢?这个问题的答案是:先接收到随机刻输入的红石中继器将先进行输出。这导致红石中继器和红石比较器更有应用上的意义,因为可以实现:
如果拉动图中的拉杆,那么与拉杆相连的铁块和技术方块将会按图中数字的顺序更新。方块1和2,将毫无疑问先于3和4更新,这是因为激活它们的是红石中继器而不是红石比较器。同样可以保证的是,方块1将会先于方块2激活,这又是因为激活方块1的红石中继器将先于激活方块2的。1这一路的第一个红石中继器被红石中继器激活,而2这一路的第一个红石中继器被红石比较器激活。类似的原因,方块3同样一定会先于方块4线更新。制作更长的红石中继器和红石比较器串将会得到超过4个有着可靠顺序的更新。
关于微观延时的更多信息,可以参考下面的连接:
【RMC精选】黑石原理及技术
【黑石】关于黑石原理的一些重要实验
【元件库】精密时序比较器——关于时序精密描述的实现
【元件库】精密脉冲边沿比较器
When a piston is extended and gets deactivated, it does not instantly retract when it updates. When the piston first gets updated, it will transform into a glitchy state, which looks like this:
The piston will then wait for other blocks to update first, before the piston updates a second time, which will convert it to block 36, and which will also convert the block in front of the piston to block 36, if the piston is sticky. The 2 updates will happen within 1 game tick, but while the first update happens relatively early in the update order, the second update happens quite late and most other blocks including repeaters and comparators will update, before the second update of the piston retraction happens (This needs to be verified, even though Myrens is pretty sure, that this is correct, since 90% of his 0 tick technology is based on this assumption, and it works)
当一个活塞伸长且退激活时,他不会在更新时立即收回。当活塞第一次更新时,它会转换到一种非常规态,看起来就像这样:
在活塞第二次更新前,活塞会待其他方块先更新。这个过程中,活塞会转变为36号方块,而如果活塞是粘性活塞,那么它之前的方块也将会为36号方块。这两次更新会在同一个游戏刻内发生,但第一次更新在更新序列中相对靠前,第二次活塞收回时的更新则较晚,晚于其他大部分方块包括红石中继器和红石比较器的更新。(虽然Myrens非常确信这种说法很正确,因为他90%的0刻技术基于该假设,且都与其符合地很好,但这一点需要进一步的证实。)
A 0 tick pulse generator, that turns the signal off using a piston retraction. When the green wool (input) gets powered, after 1 redstone tick of delay, the red wool (output) recieves a 0 tick pulse.
0刻脉冲发生器使用活塞的收回来切断信号。绿色羊毛(输入端)被充能后经过1红石刻的延时,红色羊毛(输出端)会接收到0刻脉冲。
These 0 tick pulse generators are widely used, because they generate comparatively long 0 tick pulses. The longer a 0 tick pulse is, the more technical blocks will react to it in a direction and location-independent way.
This is a pulse generator that directly powers a block, first shown by Defanive on YouTube. It also cuts the signal using a piston retraction, causing the 0 tick pulse to be long enough to make all technical blocks react to it, independent of direction or position.
那些0刻脉冲发生器现在已被广泛应用,这是因为他们产生相对较长的0刻脉冲。长0刻脉冲表示在某个单独的方向和位置时会有更多的技术性方块对其响应。
这就是一个直接给方块供能的脉冲发生器,最早由Defanive在Youtube上展示。其同样使用活塞的收回来切断信号,这产生了一个足够长的0刻脉冲,以至于任何位置任何朝向的技术方块都能够对其响应。
Multiple zero tick pulse generators may be chained, and if the generator uses redstone blocks, the signal may be taken using redstone dust. This was first shown by pi314159265358978.
多个0刻脉冲发生器可以互相串接起来,如果它们用到红石块,那么0刻脉冲信号就可以被红石粉获取。这个现象最早由pi314159265358978揭示。
While a piston is in its glitchy state, the piston base is movable. This can be used to create the following, unexpected effects.
Pulling an extended piston:
If the lever on the picture is switched off, the piston on the left will be able to pull the piston on the right, even though the piston on the right is extended, and is supposed to be unmovable. This works in the following way:
When the lever is switched off, there will first be a one r-tick delay from the repeater and the comparator, before anything else happens. Then within one game tick the following updates happen:
First the repeater will turn off, because repeaters always update before comparators. This will cause the piston on the left to be converted into its glitchy state.
After that the comparator will turn off and the piston on the right will get converted into its glitchy state.
Now, since there’s nothing else to update, the pistons, who are in the glitchy state, will start retracting. However, since the piston on the left transformed into its glitchy state first, it will also retract first (it is really surprising how inuitive and reliable the update order of piston retractions is). When the piston on the left retracts, it will try to pull the piston on the right, which is still in its glitchy state. Since the piston base of a piston in a glitchy state is movable, the piston on the left will successfully pull the piston on the right.
当活塞处于非常规态,活塞的基底就可以移动。这一点可以用来形成下述的非常规效应。
拉动一个已经伸长的活塞:
如果图中的拉杆拉起切断电源,那么即使右侧的活塞已经伸长,也理应不可移动,左边的活塞也依然可以拉动右侧的活塞。这可以通过下面的方法来做到:
拉杆拉起切断电源时,在任何现象发生之前,红石中继器和红石比较器首先会有一个随机刻延时。在之后的一个游戏刻内则会发生下列更新:
首先,红石中继器会退激活,这是因为它总是先于红石比较器更新。这会导致左侧活塞转变为非常规态。
之后,红石比较器将会退激活,右侧的活塞将会转变为非常规态。
此时,由于已经没有元件需要更新,所以还处在非常规态的活塞将开始收回。然而,因为左侧的活塞先转变为非常规态,因此它也将先收回(活塞收回的更新顺序与直觉的吻合及其可靠程度都令人惊叹)。左侧的活塞收回时,它将试图拉动右侧的还处在非常规态的活塞。因为处于非常规态的活塞基底是可移动的,所以左侧的活塞将会成功拉动右侧右侧的活塞。
If a piston is given a zero-tick-pulse, the piston will be in a state very similar to the glitchy state, after the zero tick pulse turned off. The only difference will be, that there is not a piston head in front of him, but the block 36 of an extending piston head. In this other glitchy state, the piston base is also movable. The contraption on the right will use this to push and extend a piston at the same time. This results in a block 36 of an extending piston head, that is not connected to any piston. The block 36 will ignore the fact, that there is no piston base, but after 3 game ticks, once the block 36 turns into a piston head, the piston head will realize, that it has no piston base, and it will delete itself.
The comparator in the middle is actually unnecessary with this precise setup.
如果活塞接收到一个0刻脉冲,那么在0刻脉冲结束后,它将会转变为一个很接近非常规态的新状态。这个状态和非常规态唯一的区别在于,其前方没有活塞臂,而是活塞臂的36号方块。在这种其他的非常规态下,这个活塞同样可以被移动。图中的装置就可以在活塞伸长的同时让它被推动。这造成了一个没有和任何活塞相连的伸长活塞臂的36号方块。36号方块将会无视实际情况,即无视其后方没有活塞的基底,但是3个游戏刻以后,一旦一个36号方块转变为活塞臂,这个活塞臂将会意识到其本身后方没有活塞基底,然后游戏将删除这个活塞臂。。
中间的红石比较器对于这个精密的装置来说是不必要的。
If a piston is moved, while it extends, and another piston is pushed in its position in less than 3 game ticks, then the piston head of the first piston will not delete itself, because it recognizes that it is connected to a piston base, without checking, whether that piston is facing in the same direction as the piston head. This means that one may get many strange configurations, such as pistons with multiple heads.
Creating a piston with two heads using comparator-repeater timings.
如果活塞被移动,然后伸出,其他的活塞在少于3游戏刻的时间内被推动到这个活塞的位置,那么第一个活塞的活塞臂就不会被删除,这是因为其意识到其与活塞的基底相连,而不会检查活塞是否与活塞臂朝向相同。这意味着我们可以得到许多奇怪的结构,比如多臂活塞。
用红石中继器和红石比较器组成的时序来创造出一个有两个活塞臂的活塞。
If a sticky piston gets converted from its glitchy state to its retracting state, while a block 36 that resulted out of a piston extension (and not retraction) is in front of the sticky piston, and if that block 36 moves in the direction the sticky piston is facing, then that block 36 will be instantly converted into its block form at its destination. What this practically means is, that if a sticky piston recieves a 1 tick pulse, the block in front of its face will finish its extension after one tick, instead of the usual 1.5 redstone ticks. What this means in relation to 0 tick pulses is, that if a sticky piston recieves a 0 tick pulses, the block in front of its face will finish its extension in 0 ticks, meaning it gets instnatly teleported. However this only applies to sticky pistons. If a normal piston recieves a 0 tick pulse, the block in front of its face will need 1.5 redstone ticks to travel to the next block.
如果一个粘性活塞从非常规态转变为它的收回状态,此时活塞伸长(而不是收回)造成的36号方块在粘性活塞前方,且那个36号方块运动的方向与粘性活塞的朝向相同,那么那个36号方块就会立刻在其最后被推到的位置处转化为方块。这意味着,如果一个粘性活塞接收到一个1刻脉冲,其前方的方块将会在1红石刻后完成推动,而不是平时的1.5红石刻。这和0刻脉冲的关系就在于,如果一个粘性活塞接收到一个0刻脉冲,那么其前方的方块将会在0游戏刻内完成推动,这意味着这个方块被瞬移了。然而,这只适用于粘性活塞。如果一个普通活塞接收到一个0刻脉冲,那么其前方的方块依然需要1.5红石刻完成推动。
特别感谢:
好时(百度id:Hershey4)为搭建官网做出的巨大贡献。
chyx(百度id:让他该人士说)推荐Wikia。
RMC平台上参与讨论的各位。
版权属于: Redstone Machinery Communication 红石机械交流促进会
原文地址: http://www.rmcteam.ml/0-tick-pulse.html
转载时必须以链接形式注明原始出处及本声明。