Skip to content

Signal Timing

CD4017BE edited this page Jan 12, 2020 · 5 revisions

When dealing with fast switching circuitry, correct timing becomes very important.

Minecraft simulates the world in small time steps of 50ms which are called ticks. So when computation is not lagging behind, it will run 20 ticks per second. Naturally one tick is also the shortest time interval over which a signal can switch its state.

However, individual game objects are not updated simultaneously but rather one after the other so when a particular object is updated some of the objects it is interacting with have already been updated earlier this tick, showing a new state, while others are still waiting for their update, showing their old state. This can cause inconsistent timing artifacts for signals transmitted between devices: if devices are updated in order the signal basically travels instantly whereas if they update in reverse order the signal is delayed by one tick every time.

Ticking

To avoid this issue and ensure reliable tick precise timing and signal latencies, most of signal components in this mod don't update during regular Tile/Entity ticking but instead during a post-tick Forge event which basically happens in the time between world ticks. Plus there is some additional magic going on that ensures signal changes send during these updates are always received exactly one tick later. The following diagram illustrates the signal propagation:

  • In this example the signals A and B are caused during world tick. This can be in the form of a vanilla Redstone signal or as status output of machines like the controlled Item Translocator or Block Breaker.
  • Signal B feeds into a signal component like Redstone Read Socket that updates post-tick producing X(B).
  • A and X are then combined inside another post-tick updating component producing Y(A, X) with guaranteed one tick latency between X and Y.
  • Finally Y is received by some device (connected via Redstone Write Socket) that updates during world-tick again causing a reaction R(Y).

Generally you can expect all vanilla blocks and devices from other mods to update during world tick (which is the red area in the timing diagram) whereas in this mod depending on the device, operations may be performed either during world tick (typically things involving resource transfer and other block interaction) or during post-tick (all pure signal processing components). For details see the device descriptions or the following tables.

Timing tables

Summary of signal transmission latencies:

Transmission Latency
W -> W ?
W -> P 1/2 t
P -> P 1 t
P -> W 1/2 t
-> I -> 0 t

List of devices with their update phase: W = world-tick, P = post-tick, I = instant pass-on

Device update
3D Block Selector P
Analog Signal Combiner P
Arithmetic Signal Combiner P
Binary Signal Packer P
Binary Signal Unpacker I
Block Reference Splitter I
Block Reference Multiplexer P
Block Reference Delay Line P
clocked Comparator I*
controlled Item Translocator W
controlled Fluid Translocator W
controlled Block Breaker W
controlled Item User W
Counter I*
external RAM chip I*
Logic Signal Combiner P
Oscilloscope I
Power Regulator I/W
Redstone Processor P
Redstone Read Socket P
Redstone Write Socket I
Signal Splitter I
XOR-Gate P
Signal Delay Line P
Signal IO Controller P
Signal Offset I
Signal Scaler I
Signal Threshold Latch I

Clone this wiki locally