Skip to content

Conversation

@Senlar
Copy link

@Senlar Senlar commented Nov 28, 2025

…based RAF loop

This PR fixes long-standing issues with the skillcheck mini-game animation speed being inconsistent across machines and after long play sessions. Some players reported extremely slow indicator movement, others extremely fast, and many noticed that the speed changed unpredictably the longer they stayed logged in.

The root cause was that the skillcheck relied on a useInterval tick (setInterval-like behavior) and assumed it fired every 1ms. In reality, browser timer clamping and throttling make interval timing highly unpredictable — especially in embedded CEF browsers like FiveM’s NUI.

This PR replaces tick-based animation with a time-based requestAnimationFrame loop using performance.now(), ensuring perfectly consistent animation timing across all hardware and browser states. I have used this method in other NUI based skillcheck scripts to address this same behavior.

I have tested this with the pre-defined difficult settings for skillcheck, easy, medium, and hard along with the tabled based settings. The speeds seem consistent with the old behavior when using this new method. User experience should be consistent with this updated code.

…based RAF loop

This PR fixes long-standing issues with the skillcheck mini-game animation speed being inconsistent across machines and after long play sessions. Some players reported extremely slow indicator movement, others extremely fast, and many noticed that the speed changed unpredictably the longer they stayed logged in.

The root cause was that the skillcheck relied on a useInterval tick (setInterval-like behavior) and assumed it fired every 1ms. In reality, browser timer clamping and throttling make interval timing highly unpredictable — especially in embedded CEF browsers like FiveM’s NUI.

This PR replaces tick-based animation with a time-based requestAnimationFrame loop using performance.now(), ensuring perfectly consistent animation timing across all hardware and browser states. I have used this method in other NUI based skillcheck scripts to address this same behavior.

Signed-off-by: Senlar <brandonrhue@gmail.com>
Copy link

@FjamZoo FjamZoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please fix the formatting so we are not merging un needed changes

Signed-off-by: Senlar <brandonrhue@gmail.com>
Signed-off-by: Senlar <brandonrhue@gmail.com>
@Senlar
Copy link
Author

Senlar commented Dec 8, 2025

Could you please fix the formatting so we are not merging un needed changes

I think I have done what you requested.

@Senlar Senlar requested a review from FjamZoo December 8, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants