ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.12k stars 2.18k forks source link

The PlaybackRate feature does not properly work in tweens and timers and can generate weird behaviour. #12543

Closed Davvex87 closed 1 year ago

Davvex87 commented 1 year ago

Describe your bug here.

Currently in PE v0.6.3, when playing a song at a higher or lower PlaybackRate (e.g., 1.5x), the song, chart, HUD, character animations, and miscellaneous animations adjust accordingly, which is an amazing detail that I truly appreciate. However, I've noticed that modcharts utilizing tweening are not affected by the adjusted rate, causing problems that can render modcharted songs unplayable with high or low PlaybackRates. The same issue applies to timers as well.

To resolve this, I suggest a simple yet effective solution: include the PlaybackRate multiplier in the duration of tweens and timers. This adjustment would need to be implemented consistently across all relevant code sections, such as the usage of the "runHaxeCode()" function in Lua.

Moreover, other elements like physics, delta/elapsed time, and various other features can break due to the lack of this modifier. To address these concerns, I propose utilizing a single line of code: FlxG.timeScale = PlaybackRate. This approach eliminates the need for complex variable multiplications and ensures greater stability and cohesiveness for the PlaybackRate feature.

I have not investigated much about FlxG.timeScale but from testing within Psych Engine itself it appears to do it's job just fine.

https://github.com/ShadowMario/FNF-PsychEngine/assets/102032123/5656f603-3470-4c2c-ba06-7b7994afc212

Command Prompt/Terminal logs (if existing)

No response

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows

Did you edit anything in this build? If so, mention or summarize your changes.

No, this is vanilla Psych Engine v0.6.3

DetectiveBaldi commented 1 year ago

or you could just divide the duration by the playbackrate instead of making an issue

TheLeerName commented 1 year ago

how to approve, ah yes its not a PR

Davvex87 commented 1 year ago

or you could just divide the duration by the playbackrate instead of making an issue

yea but many developers forget that variable even exists and I think no one would want to modify someone else's mod just to support the playbackRate modifier.

DetectiveBaldi commented 1 year ago

"yea but many developers forget that variable even exists" Because people can't check PlayState doesn't mean the engine needs to add support for playback rates on custom timers and tweens, it's something extremely easy to do and if a person can't figure out how then it's really on them