Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-260874

Display entity chained interpolation has inconsistent behavior

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 23w13a
    • 1.19.4 Release Candidate 1, 1.19.4
    • None
    • Confirmed
    • Commands, Entities
    • Low
    • Platform

      Chained interpolation animations appear to have inconsistent behaviors.

      This bug was partially fixed in 23w13a. The issue with Animation leaking is resolved, but the issue with Multiple animations from desync still happens. I have separated the second bug into MC-261600 so that this one can be treated separately. I have kept the original description and repros here for context.

      From my understanding, this is a result of two different bugs happening together that may affect a large amount of animations.

      Bug 1: Animation leaking

      Mid-animation interpolation is fundamentally broken, as it is prone to leaking and ghost-animating the previous animation instantaneously using the duration of the current animation, before starting the next animation, even if the previous animation is already finished.

      To go more in depth: The following animation may continue at a position partway along the previous animation, even if the previous animation finished and even if the previous animation should have been instant with 0 duration, indicating that it somehow assumed there was an animation when there was none, by applying the duration of the latest animation to the previous animation. Additionally, it may continue from where the previous animation currently is mid-animation, but from the wrong point in time, and hence not continuing from the proper location.

      Bug 2: Multiple animations from desync

      See separate bug: MC-261600
      The game can desync, for example, depending on how much the user pauses. This then becomes evident when a transform animation is applied, which can cause animations to behave in multiple different ways based on how desynced they are.

      Animations may appear to manifest in multiple ways with a single set of deterministic commands that are different from each other when desynced, when the expected behavior is a single animation.

      Pausing the game for various lengths of time may trigger this desync. See: desyncpause.mp4 and desyncpause2.mp4. This desync appears to be due to interpolation occasionally happening in the tick after it was set, resulting in different forms of the animation appearing for different desync timings. This may or may not be expected behavior by changes to how updates to transformations are handled in the release candidate.

      Videos have been attached to demonstrate the varying ways this issue manifests.

      This bug is different from MC-259926 as this bug deals with live interpolation changes that are visible without the user rejoining or reloading mid-animation.

      To Reproduce (0 interpolation duration on step 3)

      1. Place three impulse command blocks in a line
      2. summon minecraft:block_display ~ ~1 ~ {Tags:[test],block_state:{Name:"stone"},transformation:{translation:[0.0f,0.0f,0.0f],scale:[0.0f,0.0f,0.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},start_interpolation:0,interpolation_duration:0}
      3. execute as @e[tag=test] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,2.0f,0.0f]},start_interpolation:0,interpolation_duration:0}
      4. execute as @e[tag=test] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,0.0f,0.0f]},start_interpolation:0,interpolation_duration:40}
      5. Power these with a redstone block in order, with varying delay, such as between 0.2 seconds and 5 seconds
      6. Observe that there are inconsistencies with how the animation occurs. Even though the second command implies immediately transformation, the third command may start from a completely different location and scale instead of continuing smoothly from the second command
      7. It appears duration from the last transformation gets immediately re-applied on the second transformation, hence the longer you wait to trigger the last command, the higher up the last interpolation seems to start, however this can also be inconsistent.
      8. See video: desynctest5.mp4

      To Reproduce (non-zero interpolation on step 3)

      1. Place three impulse command blocks in a line
      2. summon minecraft:block_display ~ ~1 ~ {Tags:[test],block_state:{Name:"stone"},transformation:{translation:[0.0f,0.0f,0.0f],scale:[0.0f,0.0f,0.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},start_interpolation:0,interpolation_duration:0}
      3. execute as @e[tag=test] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,2.0f,0.0f]},start_interpolation:0,interpolation_duration:10}
      4. execute as @e[tag=test] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,0.0f,0.0f]},start_interpolation:0,interpolation_duration:40}
      5. Power these with a redstone block in order, with varying delay, such as between 0.2 seconds and 5 seconds
      6. Observe that there are still inconsistencies with how the animation and mid-animation interpolation that was introduced in 1.19.4-pre4 occurs.

      To Reproduce (constant 20hz demonstration)

      1. Create a void superflat world
      2. /scoreboard objectives add test dummy
      3. Place these 5 commands in order in a command block chain starting with a repeating command block
        execute positioned 0 -58 0 run summon minecraft:block_display ~ ~ ~ {Tags:[bob],block_state:{Name:"stone"},transformation:{translation:[0.0f,0.0f,0.0f],scale:[0.0f,0.0f,0.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},start_interpolation:0,interpolation_duration:0}
        scoreboard players add @e[tag=bob] test 1
        execute as @e[tag=bob,scores={test=2}] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,2.0f,0.0f]},start_interpolation:0,interpolation_duration:0}
        execute as @e[tag=bob,scores={test=20}] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,0.0f,0.0f]},start_interpolation:0,interpolation_duration:40}
        kill @e[tag=bob,type=minecraft:block_display,scores={test=50..}]
        
      4. Notice that there are three different animations occurring when we should only be expecting one (the final animation)
      5. Pause the game for different lengths of time to observe the choice between the three animations may change, making evident there is some sort of desync happening as well
      6. This datapack can also be used to test the commands above: display_test.zip
      7. See video: desynctest3.mp4

      To Reproduce (20hz desync demonstration)

      1. Create a void superflat world
      2. /scoreboard objectives add test dummy
      3. Place these 5 commands in order in a command block chain starting with a repeating command block
        summon minecraft:block_display ~ ~1 ~ {Tags:[bob,joe],block_state:{Name:"stone"}}
        execute as @e[tag=joe] run data merge entity @s {transformation:{scale:[0.1f,0.1f,0.1f],translation:[0.0f,2.0f,0.0f]},start_interpolation:0,interpolation_duration:40}
        tag @e remove joe
        scoreboard players add @e[tag=bob] test 1
        kill @e[tag=bob,type=minecraft:block_display,scores={test=40..}]
        
      4. Notice that the animation occasionally appears to animate from default transformation instead of staying at the second transformation
      5. This appears to demonstrate the desync, where the data merge'd transformation is applying on the following tick instead of the summon tick
      6. Pause the game for different lengths of time to observe that the desync'd animation may or may not appear for different lengths of time.
      7. This may or may not be expected behavior by changes to how updates to transformations are handled in the release candidate
      8. See videos: desynctest.mp4, desynctest2.mp4

      Additional analysis

      For this video demonstrated in the third repro example: desynctest3.mp4

      Command Breakdown:

      1. in Tick 1 summon display with default values and scale 0
      2. in Tick 2 set the initial transformation of scale 0.1, translation 0,2,0 with 0 interpolation start/duration
      3. in Tick 20 set the first animation to scale 0.1, translation 0,0,0 with duration 40

      Result: animation is happening in three different places

      Expected animation: no scale change, single animation from 0,2,0 to 0,0,0

      The three animations in the video:

      1. stone expands from 0 to 0.1 scale at 0,0,0
      2. stone expands from 0.05 to 0.1 scale while going from 0,1,0 to 0,0,0
      3. stone stays 0.1 scale while going from 0,2,0 to 0,0,0 (expected)

      Animation analysis:

      1. This animation is occurring because it took the values in Tick 1 from SUMMON, then interpolated directly with Tick 20, skipping the values set in Tick 2
      2. This animation is occurring because it took the values in Tick 1 from SUMMON, then immediately applied the transformation in Tick 2. When it reaches Tick 20, it took the duration of 40 ticks, and pre-applied it onto the animation from Tick 2. The game then proceeded to immediately re-animate this made up animation for 18 ticks, (the duration between Tick 2 and Tick 20) between the transforms of Tick 1 and Tick 2, but got cut off afterwards (hence why the animation starts at half scale and half translation). We never see this ghost pre-animation visually as it happens in an instant. The game then started from wherever this position was, and started animating the animation in Tick 20 for the remaining duration.
      3. This is the proper animation

        1. desyncpause.mp4
          8.88 MB
        2. desyncpause2.mp4
          5.15 MB
        3. desyncpause3 (epilepsy warning).mp4
          7.96 MB
        4. desynctest.mp4
          9.56 MB
        5. desynctest11.mp4
          9.61 MB
        6. desynctest2.mp4
          1.22 MB
        7. desynctest3.mp4
          558 kB
        8. desynctest4.mp4
          722 kB
        9. desynctest5.mp4
          6.91 MB
        10. desynctest6.mp4
          1.13 MB
        11. desynctest7.mp4
          957 kB
        12. display_test.zip
          1 kB

            Unassigned Unassigned
            onnowhere Onnowhere
            Votes:
            16 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: