Skip to content

refactor(es_extended/client/modules/scaleform): Make scaleforms show duration framerate independent#1599

Merged
Kenshiin13 merged 2 commits into
esx-framework:devfrom
fnbar0:dev
Jan 19, 2025
Merged

refactor(es_extended/client/modules/scaleform): Make scaleforms show duration framerate independent#1599
Kenshiin13 merged 2 commits into
esx-framework:devfrom
fnbar0:dev

Conversation

@fnbar0

@fnbar0 fnbar0 commented Jan 19, 2025

Copy link
Copy Markdown
Contributor

Description

  • This PR updates the scaleform display logic to ensure that the duration of messages is no longer dependent on the frame rate. The new implementation uses GetGameTimer() to calculate when the scaleform should stop showing.

Motivation

  • The previous implementation of the scaleform showing duration relied on frame-dependent timing, which caused inconsistent behavior on different machines or just different FPS. A 5 second scaleform would hide after ~5 seconds on 100FPS but after ~10 seconds on 50FPS. This change ensures that the showing duration is accurate and not dependent of client framerate.

Implementation Details

  • Replaced the frame-dependent loop (sec = sec - 0.01) with a time-based calculation using GetGameTimer().
  • The loop now checks the elapsed time in milliseconds instead of decrementing a counter every frame.

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@fnbar0 fnbar0 changed the title refactor(es_extended/client/modules/scaleform): Make scaleforms show duration frame independent refactor(es_extended/client/modules/scaleform): Make scaleforms show duration framerate independent Jan 19, 2025
@Kenshiin13 Kenshiin13 self-requested a review January 19, 2025 15:20
Comment thread [core]/es_extended/client/modules/scaleform.lua Outdated
Comment thread [core]/es_extended/client/modules/scaleform.lua Outdated
Comment thread [core]/es_extended/client/modules/scaleform.lua Outdated
Comment thread [core]/es_extended/client/modules/scaleform.lua Outdated

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

@Kenshiin13 Kenshiin13 merged commit 153212e into esx-framework:dev Jan 19, 2025
@fnbar0 fnbar0 deleted the dev branch January 19, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Next Update

Development

Successfully merging this pull request may close these issues.

2 participants