Difference between revisions of "User:Nightmareci"

From TetrisWiki
Jump to navigation Jump to search
Line 79: Line 79:
 
# If this is in-field play:
 
# If this is in-field play:
 
<!-- Begin In-Field -->
 
<!-- Begin In-Field -->
 +
<!-- Begin Pre-DAS -->
 +
## If left/right shift is read and does not match the previous frame's left/right:
 +
### das_counter = 0
 +
<!-- End Pre-DAS -->
 
<!-- Begin First Frame -->
 
<!-- Begin First Frame -->
 
## If this is the first frame of this piece:
 
## If this is the first frame of this piece:
Line 110: Line 114:
 
<!-- End Rotation -->
 
<!-- End Rotation -->
 
<!-- Begin Shift -->
 
<!-- Begin Shift -->
### If left/right shift is read:
+
### If left/right shift is read and das_counter == 0 or das_counter > 14:
#### If this input does not match the previous frame's:
+
#### Shift left/right 1 column
##### das_counter = 0
 
#### If das_counter == 0 or das_counter > 14:
 
##### Shift left/right 1 column
 
#### If das_counter <= 14:
 
##### Increment das_counter by 1
 
### Else:
 
#### das_counter = 0
 
 
<!-- End Shift -->
 
<!-- End Shift -->
 
<!-- Begin Soft Drop and Gravity -->
 
<!-- Begin Soft Drop and Gravity -->
Line 144: Line 141:
 
#### gravity_count %= 256
 
#### gravity_count %= 256
 
<!-- End Gravity -->
 
<!-- End Gravity -->
 +
<!-- Begin Post-DAS -->
 +
## If left/right shift is read and das_counter <= 14:
 +
### das_counter++
 +
<!-- End Post-DAS -->
 
<!-- End In-Field -->
 
<!-- End In-Field -->
 
# Else:
 
# Else:

Revision as of 08:19, 3 March 2009

Definitions

In this page, row numbering follows this convention:

  1. Vanish zone
  2. First visible row
  3. Second visible row
  4. ...
  5. Nineteenth visible row
  6. Twentieth visible row (last)

Row number 0 is the topmost row and successive rows are beneath it. In the listing above (which is TGM1's row configuration), there is a total of 21 usable rows.

Tetris The Grand Master

Some of the following information may not be consistent with other wiki pages; where this applies, simply ignore the information elsewhere in the wiki. Corrections to this information by others are only accepted if supported by examples. Information here is still work in progress.

Gravity

Directly from Tetris The Grand Master, here is the gravity curve:

Internal Gravity[1]
Level Interal Gravity
(1/256 G)
Level Internal Gravity
(1/256 G)
0 4 220 32
30 6 230 64
35 8 233 96
40 10 236 128
50 12 239 160
60 16 243 192
70 32 247 224
80 48 251 256 (1G)
90 64 300 512 (2G)
100 80 330 768 (3G)
120 96 360 1024 (4G)
140 112 400 1280 (5G)
160 128 420 1024 (4G)
170 144 450 768 (3G)
200 4 500 5120 (20G)

This is also based on a timings table in Tetris The Grand Master, but is modified to better fit observations I've made:

Delays
Level DAS
(frames)
Lock
(frames)
Lock flash
(frames)
Line clear
(frames)
ARE
(frames)
000 - 999 14 29 4 41 27

The different ordering is chosen such that it somewhat represents the order in which each delay happens, left being first, right being last, although DAS charging can occur during ARE.

In the following, "gravity_count" is the current Gravity Count; "gravity" is the current Gravity Speed, and is equal to one of the Internal Gravity entries in the above table; das_counter is the current count of DAS charge frames; lock_frames is the current number of lock delay frames. A % is used to represent a "remainder of division" operator (commonly known as "modulo", i.e. 13 % 5 == 3). All division has the fractional part truncated, as in ISO C (60/256 == 0, 252/256 == 0, 260/256 == 1).

When I say uninteractive, I mean that any input the player sends results in no observable behavioral changes with the game. ARE is technically an interactive period of the game, as you can charge DAS. IRS is not processed in ARE, but on the very first frame of piece display.

TGM1 only accepts 1 rotation input per frame; if multiple rotation inputs are pressed down on the same frame, then no rotation input is registered. The only way to send a rotation input with no empty frames between inputs is to alternate between separate rotation buttons, be it A/B or A/C.

At the start of a game, there is a single "READY, GO" sequence; it is a special case, in this description:

  1. Begin "READY, GO" sequence:
    1. 170 frames of uninteractive display until the first pieces' first frame TODO: Expand this after more observations (how long "READY" displays, etc.)
    2. das_counter = 0

After the "READY, GO" sequence, every frame the following is processed from top to bottom, until the game ends:

  1. If this is in-field play:
    1. If left/right shift is read and does not match the previous frame's left/right:
      1. das_counter = 0
    2. If this is the first frame of this piece:
      1. Set gravity to the correct value
      2. If gravity > 256:
        1. gravity_count = gravity % 256
      3. Else:
        1. gravity_count = 0
      4. lock_frames = 0
      5. Place the piece in row number 1
      6. If a single rotation input is pressed down this frame:
        1. Basic Rotation (Sega Rotation, essentially)
        2. If the piece is not intersecting the stack rotated:
          1. Play IRS sound
        3. Else:
          1. Switch back to initial spawn orientation
      7. If the piece is not intersecting the stack:
        1. While the piece is in a row number < (gravity % 256 + 1):
          1. If placing the piece 1 row down would cause stack intersection:
            1. Break out of this loop
          2. Else:
            1. Place the piece in the next row
      8. Else:
        1. Game over
    3. Else:
      1. If a single rotation input is pressed down this frame:
        1. TGM Rotation
      2. If left/right shift is read and das_counter == 0 or das_counter > 14:
        1. Shift left/right 1 column
      3. If soft drop is read:
        1. If gravity < 256:
          1. Attempt to drop one line
        2. If the piece has blocks beneath it now:
          1. Lock the piece, end in-field play
      4. Else:
        1. gravity_count += gravity
      5. If this piece was on a different line in the previous frame:
        1. lock = 0
      6. If there are blocks below this piece:
        1. If lock == 0:
          1. Play the Secchi 1 sound
        2. If lock < 29:
          1. lock++
        3. Else:
          1. Lock the piece, end in-field play
        4. gravity_count = gravity
      7. If gravity_count >= 256:
        1. Attempt to drop gravity_count / 256 lines
        2. gravity_count %= 256
    4. If left/right shift is read and das_counter <= 14:
      1. das_counter++
  2. Else:
  3. Render frame

VERY BIG TODO: Create a ton of examples showing specific points of behavior, i.e. interaction of gravity/soft drop.