Skip to content

Bug Report: FlxG.timeScale set too high causes Conductor.songPosition to repeatedly snap back #1095

Description

@HEIHUAa

Version: intermal-merge git

[x] Windows

I have confirmed that audio‑time scaling with FlxG.timeScale is enabled, and I also know that Conductor.songPosition is bound to FlxG.sound.music.time.
This suggests that the actual audio playback may not be able to reach the intended speed multiplier. Is it possible to fix this?

Below is the log output when running at 50× speed with the game at 200 FPS (code: trace(Conductor.songPosition + " (" + (Conductor.songPosition - FlxG.sound.music.getActualTime()) + ")");):

[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 0.059999999939464 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 250.239999999758 (250.239999999758)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 108.893537415158 (0.0500000001920853)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 381.203537415083 (272.360000000117)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 217.737074830124 (0.0500000001920853)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 481.68207483 (263.995000000068)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 326.58061224509 (0.0500000001920853)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 560.530612244913 (234.000000000015)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 435.434149659803 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 681.009149659902 (245.635000000038)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 544.277687074769 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 799.587687074505 (255.369999999675)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 653.111224489624 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 933.971224489654 (280.909999999858)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 761.959761904828 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1011.59476190459 (249.689999999828)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 870.803299319794 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1110.23829932002 (239.490000000296)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 979.651836734633 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1229.98183673466 (250.38999999997)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1088.4953741496 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1337.44537414957 (249.009999999907)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1197.32891156445 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1457.76891156447 (260.489999999845)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1306.17744897966 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1556.36244897971 (250.240000000122)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1415.02098639462 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1664.77598639463 (249.81000000007)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1523.85952380972 (0.0500000001920853)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1774.47452380946 (250.664999999935)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1632.70806122419 (0.0549999997019768)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1871.43806122441 (238.784999999916)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1741.55159863952 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1993.63159863936 (252.134999999907)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1850.4051360546 (0.0650000001769513)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2099.86013605454 (249.52000000012)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 1959.24367346933 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2197.75867346952 (238.575000000128)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2068.08221088406 (0.0549999997019768)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2318.52221088422 (250.494999999864)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2176.98074829909 (0.109999999767751)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2427.1307482993 (250.25999999998)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2285.76428571411 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2545.71928571438 (260.005000000092)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2394.61282312932 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2644.36782312932 (249.81000000007)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2503.45136054405 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2753.16636054397 (249.764999999752)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2612.31489795923 (0.0700000000506407)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2873.26989795934 (261.025000000154)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2721.16343537407 (0.07499999992433)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2970.4384353742 (249.350000000049)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2829.98197278894 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3080.18197278898 (250.249999999869)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 2938.83551020402 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3187.83551020418 (249.0600000001)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3047.66904761888 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3286.49404761887 (238.874999999825)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3156.51258503384 (0.0499999998282874)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3406.93758503402 (250.475000000006)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3265.38612244878 (0.0799999997980194)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3514.36112244884 (249.054999999862)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3374.20965986425 (0.0600000003032619)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3634.82965986408 (260.680000000139)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3483.04819727898 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3733.96819727902 (250.975000000108)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3591.90173469369 (0.0649999998131534)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3841.26673469373 (249.429999999847)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3700.73527210891 (0.0550000000657747)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3950.7002721087 (250.019999999859)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3809.59880952373 (0.07499999992433)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4038.79880952386 (229.275000000052)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 3918.4673469388 (0.100000000020373)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4174.13234693866 (255.764999999883)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4027.27088435368 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4276.9308843539 (249.720000000161)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4136.12442176876 (0.0700000000506407)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4374.86442176872 (238.810000000012)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4244.95795918361 (0.059999999939464)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4494.92795918364 (250.02999999997)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4353.81149659869 (0.0700000000506407)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4602.39149659855 (248.649999999907)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4462.66003401353 (0.07499999992433)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4726.77503401348 (264.189999999871)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4571.49857142862 (0.0700000000506407)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4821.97357142863 (250.545000000056)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4680.34710884346 (0.07499999992433)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4929.16710884344 (248.894999999902)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4789.19064625843 (0.07499999992433)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 5038.92564625821 (249.809999999707)
[  13:51:09  |    TRACE    ] FunkinDebugTools.hx:46: 4898.01918367341 (0.059999999939464)

The main issue here is that operations like FlxTween and update loops run significantly faster than the song when time is scaled up, causing desynchronization. In order to keep events in sync and prevent them from skipping or breaking due to time jumps, I often rely on FlxG.timeScale to accelerate time, ensuring event compatibility and preventing crashes or skips. As a result, this actually has a considerable impact on my mod development.


By the way, this issue does not exist in the current main branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions