Tick: Difference between revisions
| (3 intermediate revisions by one other user not shown) | |||
| Line 15: | Line 15: | ||
The rate at which the world ticks is dependent on the game speed. | The rate at which the world ticks is dependent on the game speed. | ||
While ZZT's code intended to support a variety of game speeds, in practice on most machines and all emulators the speed is always a multiple of PIT ticks (approximately 18.2 Hz). | While ZZT's code intended to support a variety of game speeds, in practice on most machines and all emulators the speed is always a multiple of PIT ticks (approximately 18.2 Hz), making most of the speed settings redundant. | ||
The speed of [[play|sounds]] is not affected by the game speed. | The speed of [[play|sounds]] is not affected by the game speed. | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+List of game speeds | ||
! Game speed | ! Game speed | ||
! Intended tick period | ! Intended tick period | ||
! PIT ticks per game tick | ! PIT ticks per game tick | ||
! Effective tick period | ! Effective tick period | ||
!Default message display ticks | |||
!Effective message display duration | |||
|- | |- | ||
| 0 (F) | | 0 (F) | ||
| Line 30: | Line 32: | ||
| 0 | | 0 | ||
| Uncapped | | Uncapped | ||
|200 | |||
|Short | |||
|- | |- | ||
| 1 | | 1 | ||
| Line 35: | Line 39: | ||
| rowspan="2" | 1 | | rowspan="2" | 1 | ||
| rowspan="2" | 55 ms (18.2 Hz) | | rowspan="2" | 55 ms (18.2 Hz) | ||
|66 | |||
|3.63 seconds | |||
|- | |- | ||
| 2 | | 2 | ||
| 40 ms (25 Hz) | | 40 ms (25 Hz) | ||
|40 | |||
|2.2 seconds | |||
|- | |- | ||
| 3 | | 3 | ||
| 60 ms (16.67 Hz) | | 60 ms (16.67 Hz) | ||
| rowspan="3" | 2 | | rowspan="3" | '''2''' | ||
| rowspan="3" | 110 ms (9.1 Hz) | | rowspan="3" | '''110 ms (9.1 Hz)''' | ||
|28 | |||
|3.08 seconds | |||
|- | |- | ||
| 4 (default) | | '''4 (default)''' | ||
| 80 ms (12.5 Hz) | | '''80 ms (12.5 Hz)''' | ||
|'''22''' | |||
|'''2.42 seconds''' | |||
|- | |- | ||
| 5 | | 5 | ||
| 100 ms (10 Hz) | | 100 ms (10 Hz) | ||
|18 | |||
|1.98 seconds | |||
|- | |- | ||
| 6 | | 6 | ||
| Line 54: | Line 68: | ||
| rowspan="3" | 3 | | rowspan="3" | 3 | ||
| rowspan="3" | 165 ms (6.06 Hz) | | rowspan="3" | 165 ms (6.06 Hz) | ||
|15 | |||
|2.47 seconds | |||
|- | |- | ||
| 7 | | 7 | ||
| 140 ms (7.14 Hz) | | 140 ms (7.14 Hz) | ||
|13 | |||
|2.14 seconds | |||
|- | |- | ||
| 8 (S) | | 8 (S) | ||
| 160 ms (6.25 Hz) | | 160 ms (6.25 Hz) | ||
|11 | |||
|1.81 seconds | |||
|} | |} | ||
Most ZZT [[world|worlds]] are designed for the default tick speed, which is equal to 4, or approximately 9.1 Hz. | Most ZZT [[world|worlds]] are designed for the default tick speed, which is equal to 4, or approximately 9.1 Hz. | ||
When the [[player]] gets a game over, the game speed is set to 0 (uncapped). | |||
=== Detecting game speed === | |||
Since the message timer's tick duration differs for each game speed value, one can create a board where the message timer occupies the final slot on the [[stat]] list, counting after how many ticks another stat can be created after displaying a message to infer the game speed. This technique was discovered by Dr. Dos in 2020<ref>Dr. Dos. (2020). ''[https://museumofzzt.com/file/view/2020dotzzt/?file=2020.ZZT&board=17 2020 dot ZZT].''</ref>. | |||
== References == | |||
<references/> | |||
Latest revision as of 23:03, 27 December 2025
The fundamental unit of time in a ZZT world is the tick. During a tick, the player input is collected, after which all stats are processed in order based on their cycle.
Cycle handling
Whether a given stat is processed on a given tick is based on the following conditions: Cycle =/= 0 and TickCounter % Cycle == StatIndex % Cycle, where:
Cyclerefers to the stat's Cycle value,TickCounterrefers to the game's tick counter,StatIndexrefers to the stat's index.
The tick counter is set to a random value between 0 and 99 on start, and is incremented until it reaches the value 420, after which it is reset back to 1. This has a consequence of only divisors of 420 ticking at a consistent rate throughout gameplay: 1, 2, 3, 4, 5, 6, 7, 10, 12, 14, 15, 20, 21, 28, 30, 35, 42, 60, 70, 84, 105, 140, 210 and 420. Other cycle values, such as 8, 9, 11..., will eventually skip cycles. In addition, as all stats have a lower index than 420 (and all non-player stats have a higher index than 0), stats with a cycle rate higher than 420 will tick as if they had a cycle rate of 420.
Game speed
The rate at which the world ticks is dependent on the game speed.
While ZZT's code intended to support a variety of game speeds, in practice on most machines and all emulators the speed is always a multiple of PIT ticks (approximately 18.2 Hz), making most of the speed settings redundant.
The speed of sounds is not affected by the game speed.
| Game speed | Intended tick period | PIT ticks per game tick | Effective tick period | Default message display ticks | Effective message display duration |
|---|---|---|---|---|---|
| 0 (F) | 0 ms (Uncapped) | 0 | Uncapped | 200 | Short |
| 1 | 20 ms (50 Hz) | 1 | 55 ms (18.2 Hz) | 66 | 3.63 seconds |
| 2 | 40 ms (25 Hz) | 40 | 2.2 seconds | ||
| 3 | 60 ms (16.67 Hz) | 2 | 110 ms (9.1 Hz) | 28 | 3.08 seconds |
| 4 (default) | 80 ms (12.5 Hz) | 22 | 2.42 seconds | ||
| 5 | 100 ms (10 Hz) | 18 | 1.98 seconds | ||
| 6 | 120 ms (8.33 Hz) | 3 | 165 ms (6.06 Hz) | 15 | 2.47 seconds |
| 7 | 140 ms (7.14 Hz) | 13 | 2.14 seconds | ||
| 8 (S) | 160 ms (6.25 Hz) | 11 | 1.81 seconds |
Most ZZT worlds are designed for the default tick speed, which is equal to 4, or approximately 9.1 Hz.
When the player gets a game over, the game speed is set to 0 (uncapped).
Detecting game speed
Since the message timer's tick duration differs for each game speed value, one can create a board where the message timer occupies the final slot on the stat list, counting after how many ticks another stat can be created after displaying a message to infer the game speed. This technique was discovered by Dr. Dos in 2020[1].
References
- ↑ Dr. Dos. (2020). 2020 dot ZZT.