0

Bug when fast rewind (timescale <= -2 or interval < 0.1)

Lafsody@UrniqueStudio 2 weeks ago • updated 2 weeks ago 0

There are some cases that cause fast rewinding time make some strange behavior.

First: When playing for a long time and then fast rewind (timeScale <= -2) to the beginning, state of the game does not become the start state.

Second: When setting a recording interval below 0.1 (or some number that below update time) and then fast rewind, state of the game will be incorrect. (as someone already mentions in https://support.ludiq.io/communities/1/topics/1670-problem-with-rewinding-time)

I found that the cause of the two cases is the same.

To give more information about this case I will give some example (because my English skill is not so good)

Example:

  1. Play to time 30
  2. Rewind to time 0 with timeScale = -5
  3. The state of the game doesn't correct. It looks like the state of the game at time = 8, not time = 0 (the position, rotation and other is not at the start state, it's somewhere on the way)

As Will already mentions in reply in his post about something wrong with moving from snapshot to snapshot.

I can guarantee that he is correct.

The cause of this problem is when time rewind too fast or the interval is too frequent. It can be able to skip more than one snapshot per update but in the code, it only allows rewinding 1 snapshot per update.
That's why when fast rewinding, snapshots is rewinding slower than time. When time reaches 0, snapshot still not rewind to 0.

To solve this problem:In RecorderTimeline.cs at Rewind() function line 136 :

change

if (timeline.time <= earlierTime)

to

while (timeline.time <= earlierTime)

and that's it! 2 cases above solved.

But again, I don't know whether or not this will cause another bug.

In my opinion, it's not. LOL

Chronos Version:
2.4.14 (July 16, 2018)
Unity Version:
Any