brief description of how teching works in ssbm
0
ssbm-tech.md
edited
1# SSBM tech: the code
2
3Teching in SSBM depends on two values: `timer_LR` and `since_rapid_lr`.
4
5
6## How do these values behave?
7
8Both values initialise at -1 at game start.
9
10`timer_LR`:
11- sets to 0 on any digital trigger press.
12- increments every frame unless it is equal to -1.
13- naturally overflows from 127 to -128 when incrementing.
14
15`since_rapid_lr`:
16- records the exact value of timer_LR at the last digital trigger press.
17- does not increment, is not a timer.
18
19
20## What this means for logic
21
22On the frame a trigger press is recorded:
23- `since_rapid_lr` is set to the value of `timer_LR`.
24- `timer_LR` is then set to 0.
25
26
27## When can I tech?
28
29A tech happens if and only if: the player is in hitstun or tumble (aka any variant of the DamageFly or DamageFall states) && 0 <= `timer_LR` < 20 && (`since_rapid_lr` < 0 || 40 <= `since_rapid_lr`)
30
31
32## What is the tech window, and what is a lockout?
33
34tech windows and lockouts are purely conceptual:
35> the `tech window` corresponds to the period of time where `timer_LR` is counting up from 0 to 20 and `since_rapid_lr` is not between 0 and 40.
36>
37> the `tech lockout` is simply whenever both `timer_LR` and `since_rapid_lr` are between 0 and 40, as another trigger input will keep this state going with `timer_LR` reset to 0.