ryanheise
03-07-2009, 01:46 PM
While trying to implement DRS in the tessellate engine (http://www.tetrisconcept.net/forum/viewtopic.php?f=1&t=1290), I began to notice some edge cases that were not documented in the wiki. After discussing this with Zaphod and Zircean, Zircean has given us some new observations. For example, the special technique to perform an instantaneous 180 rotation by pressing and holding A then pressing B (where A hasn't enough room to rotate) only works once, and all keys must be released before it will work again. Another observation is that after pressing and holding A (where A hasn't enough room to rotate) and then shifting the piece sideways, DTET will try to still execute the A rotation as soon as the tetromino has moved into a space where it can execute the rotatation.
These edge cases seem to complicate things, but I have found what I think is quite a simple model that seems to match observations, and I'd like to run it by the community.
STATES
There are two rotation buttons. "A" rotates left, and "B" rotates right.
We can identify three states for each rotation button and transitions between these states:
http://www.ryanheise.com/tetris/dtet.png
If any rotation happens, this will cause "all" rotation buttons that are currently in the "pressed and waiting" state to move into the "pressed and processed" state.
ALGORITHM
For each frame:
Case 1: A is pressed and waiting, and B is released (Or B & A resp.)
- then attempt to rotate left with left kick bias
Case 2: A is pressed and waiting, and B is pressed and processed (Or B & A resp.)
- then attempt to rotate right with left kick bias
Case 3: A and B are both pressed and waiting
- then attempt to double rotate with left kick bias
My implementation of this model can be tested here (http://hi-games.net/tessellate-t,lt,O,_5F2f,s_2$$bfK_k,2daa_2ApZ/?no_record=1).
Edit: IRS uses the same rotation as above, so wall kicks apply, and the same key states are used.
These edge cases seem to complicate things, but I have found what I think is quite a simple model that seems to match observations, and I'd like to run it by the community.
STATES
There are two rotation buttons. "A" rotates left, and "B" rotates right.
We can identify three states for each rotation button and transitions between these states:
http://www.ryanheise.com/tetris/dtet.png
If any rotation happens, this will cause "all" rotation buttons that are currently in the "pressed and waiting" state to move into the "pressed and processed" state.
ALGORITHM
For each frame:
Case 1: A is pressed and waiting, and B is released (Or B & A resp.)
- then attempt to rotate left with left kick bias
Case 2: A is pressed and waiting, and B is pressed and processed (Or B & A resp.)
- then attempt to rotate right with left kick bias
Case 3: A and B are both pressed and waiting
- then attempt to double rotate with left kick bias
My implementation of this model can be tested here (http://hi-games.net/tessellate-t,lt,O,_5F2f,s_2$$bfK_k,2daa_2ApZ/?no_record=1).
Edit: IRS uses the same rotation as above, so wall kicks apply, and the same key states are used.