smooth "display ahead" animations for pieces under DAS

Thread in 'Discussion' started by herc, 9 Apr 2009.

  1. most implementations of smooth movements for the tetris piece under actual control simply do the following:

    the actual position of the piece drawn is a linear interpolation between the old position and the new position using some predefined speed value.

    this is a bad method for people who play fast: it causes a visual lag. your piece is displayed at an intermediate position while the piece is internally - in game logic - already at the new position. if you would TAP fast enogh, at low "smooth movement speeds" the piece would seem to crawl to the new position. of course, you could increase that speed value, or you could finally just switch it off, as all of the highspeed gamers do ( / there is no such anim at all in tgm series).

    nontheless, i think a right done smooth movement could help players in placing a piece. of course it makes sense only for autoshift speeds < 60 fps aka 1G.

    proposal for "display ahead" smooth movements:

    suppose you have pressed the "left" key and continue holding it down.
    1. move it instantly one unit left.

    2. now the autoshift delay is active. suppose it is 500 ms. linearly interpolate the position of the piece between the current position and the next position where it will be after the 500 ms are over. interpolate of course with a delta-time of 500ms. if you let go the key before 500 ms are over, simply let the piece rapidly snap back to the old position.

    3. autorepeat: do exactly as in 2. but now with the autorepeat delay time of lets say 250 ms.

    a variation could be to display the smooth moving interpolated piece position with a more ghosty, transparent version of the piece and draw the current position solid. or vice versa.


    i have no idea how this idea will feel and work when implemented, but at least it occurs to me that it must be better than other smooth movement methods.
    anyone has the energy to implement it ?
     
  2. jujube

    jujube Unregistered

    it sounds like an interesting idea. it might be distracting at first, but it would look cool and could be helpful to some people.
     
  3. tepples

    tepples Lockjaw developer

    herc's idea sounds sort of like what Klax for NES does. The playfield is five "tracks" wide, just like in Guitar Hero and Rock Band (whose graphics some reviewers immediately compared to those of Klax). If the player lets go of the gamepad before the paddle has moved half a track width, it snaps back to the center of the track.

    But I'd imagine that herc's idea, implemented exactly as described, could look really jumpy in practice as every tap-tap results in repeated lurching forward and retreating.

    What Luminesweeper for GBA does is a low-pass filter. At each frame, the X position of the sprite is updated 1/4 of the way toward the actual X position of the piece, with Q16 fixed-point accuracy. So it starts moving quickly when you shift the piece by one cell, and it still moves fast during DAS, "far left", or "far right". But then that game has a delay of six rows (e.g. at 0.1G the delay is 6/0.1 = 60 frames) after entry and before the piece starts to fall, and it's overall slower paced than Death.
     
  4. @tepples: i jus played klax - and you are right - doing that predictive interpolation would cause jitter / jumps with rapid tapping.
    but if one would only start that interpolation after the autoshift delay is over, it would work nicely.

    also, one could round up: if the active piece is lets say at position 3.7 in the smooth anim and the user releases the key, snap to pos 4.0 . if it is at 3.3, snap back to 3.0

    maybe this would work satisfying. i found that klax nes is quite nicely playable, besides that stutter whit fast tapping.
     
  5. As it happens I was actually implementing soft drop animations for the next iteration of L2Stack so I went ahead and made a test release with soft sideways movement. Notice that this is only visible in Sprint mode where you can change the Das Gravity. Also, the piece Shadow does not shift so it feels a bit discontinuous when you are building near the top of the stack.

    download here

    Edit: Gravit = G * 256
     
  6. @quad: fantastic !
    i think those nes-klax-alike smooth movements work great for tetris, too. thanks for implementing it and making a proof of concept.

    how did you exactly implemented it ? is it rounded to the closest integer position, or is it floor(..) or is it snapped back to the actual key repeat count position ?
     
  7. I keep a counter called dasbuf which I increment each frame with the gravity (dasbuf += dasgravity). Then I do one movement for every integer multiple of 256 in dasbuf. The das buffer is used to draw the piece at the correct position (x + direction * dasbuf / 256). There is no roundoff to the closest position, I just reset the das buffer when the player releases the movement key.

    The exact implementation is this:
    Code:
     if (PollKey(KEY_LEFT) && das == 0) {
      direction = -1;
      dasbuf += GetWait(WAIT_DASG);// Auto shift gravity
    
      while (dasbuf >= 256) {
       if (!current_brick->MoveLeft(well->GetVirtualWell())) {// Attempt to move piece
        dasbuf = 0;// Can't move any more
        break;
       } else {
        dasbuf -= 256;// Move successful
        sys.Sound().PlaySound("data/shift.wav");
       }
      }
     } else if (PollKey(KEY_RIGHT) && das == 0) {
      direction = 1;
      dasbuf += GetWait(WAIT_DASG);
    
      while (dasbuf >= 256) {
       if (!current_brick->MoveRight(well->GetVirtualWell())) {
        dasbuf = 0;
        break;
       } else {
        dasbuf -= 256;
        sys.Sound().PlaySound("data/shift.wav");
       }
      }
     }
    Code:
    void Game::OnKeyUp(System &sys, gamekey_t gamekey)
    {
     SetKey(gamekey, false);
    
     switch (gamekey) {
     case KEY_LEFT:
     case KEY_RIGHT:
      ResetDas();// sets dasbuf to 0 and das to the correct Auto Shift Delay
      break;
     }
    }
    I could make the piece "snap" to the closest position by modifying it a little bit but I think it would also be interesting to see what happens if the ghost piece moves along with the actual piece as well.
     
  8. the difficult question is, if smooth movement just look cool, or if they in fact would help beginners with piece placement.

    this is a typical psychological question. its all about prediction, timing, sensomotoric loops etc.

    who knows ? maybe its easier for the brain to grasp the timing of step like movements in a grid world with fixed positions where the piece has to get to rest, anyway, rather than forcing smooth movements onto a spatial discrete world.

    but my observation is: in tetris ds touch, it helps alot if pieces can be dragged smoothly with the pen. imagine, how bad it would feel if you would drag, and the piece would suddenly jump to the new cell after the threshold of dx = 0.5 is reached.

    if i remember it right, in tds touch the piece snaps to the rounded position.
     
  9. I've updated the proof of concept so that it moves the ghost piece smoothly too and rounds of the position of the tetromino. I think this feature is a little frustrating to play with but maybe that's just because I'm used to 1G DAS.

     
  10. @quad: testing your latest release, i found a DAS grav of 32 suitable for beginners / casual gamers. now, if you could make a config switch to make smooth anim optional, we could compare to step-like smooth movements and test, what works better for beginners - maybe using some measure like average score over 10 runs...
     
  11. Done. The option can be found in the Config menu (called "Smooth Moves"). The options fall off the page a little now but it's just for testing.
     
  12. thank you, quad. i tested smooth versus step like movements.

    its hard (for me) to believe: i personally think, that smooth movements do NOT help.

    i found it more easy to place a piece exactly where i want ( i tried placing different pieces 1 unit away from the left or right wall) without smooth movements. the reason might be, that the piece stays visually much longer in the target cell without smooth movements and you thus have more time to release the key to stop further movements. the idea that with smooth movements you can more easily predict where the piece will be in some milliseconds and that you therefore can mentally plan to release the key at the appropriate timing does not seem to work better ( at least for me - i might be biased because of playing mostly tetris games without smooth anim (tetris party) )

    but i still think that smooth rotations help. i especially know this from 3d tetris ( blockout ), where you can rotate around all axes. in blockout original and blockout II, you can choose the rotation speed of the block. i found for me personally, that i am not able to control the rotations of the piece if the rotation is instantaneous. for rotations, i am absolutely shure, that (for beginners) smooth rotations help the "mental rotation" process, even for 2d tetris.
     
  13. Even if there is a difference between smooth and discreet sideways movement I don't think it's a good idea to try and time your placements with the auto shift. I think I prefer an instant auto shift which after the DAS delay puts the piece all the way to the left or right - this way I always know where the piece will end up.

    Smooth rotations might very well be a good guide for beginners but I don't think that smooth auto shift will help at all. I've played blockout and I actually like the smooth rotation a lot but I don't see any way I could easily use something similar in my game and the pro players will inevitably want to play without it.
     
  14. tepples

    tepples Lockjaw developer

    Players are already used to discrete shifting behavior from Windows, Mac OS X, GNOME, KDE, and pretty much every other desktop environment. Case in point: the movement of an insertion point shaped like a vertical I-piece in text areas like the one I'm typing this comment into.

    But smooth rotation animations can be done wrong. In Tetris & Dr. Mario, for example, spin an O piece rapidly and it'll flicker with a significantly smaller O piece positioned slightly down and to the right:
    [​IMG]
     
  15. good point, thepples ! computer cursor movements are discrete, and this since the first occurence of a cursor at all. but suppose a person whe never touched a computer. do a psychology experiment with him - i am not so sure what would increase his / her performance - smooth or discrete movements.

    @quad: of course, every even slightly more advanced tetris gamer uses tap'ping and instant / 1G left / right DAS. but the whole thread was about beginners / casual tetris gamers and what might help them in playing the game.

    still i think that there might be some (psychological) reason why discrete movements are better in a discrete spatial world. anyone studying this ?

    all in all - sad - because smooth movements and rotations look much cooler [​IMG]
     

Share This Page