-
-
Notifications
You must be signed in to change notification settings - Fork 83
fix(client/interface): fix longer progess bars fails because of NUI and GetGameTimer() desync #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…nd GetGameTimer() desync
|
@xSL0W Can you provide video repro pls? |
|
Just create a lib.progress for 300s and will 100% return false most of the time. |
|
Can confirm this issue exists. Started encountering it repeatedly for the first time today (granted I had not been using a version of ox_lib with the duration check until a couple of days ago). |
Found this yesterday too. A player with ~20FPS would not be able to complete the progressbar. What if we use |
|
I made a small testing code and using for i = 45, 50 do
if lib.progressBar({
duration = i * 10 * 1000,
label = 'Testing ' .. i .. ' with duration ' .. (i * 10) .. 's',
useWhileDead = false,
canCancel = true,
disable = {
car = true,
},
}) then
print('(OK) Iteration i = ' .. i .. ' with duration of ' .. (i * 10) .. 's SUCCEEDED')
else
print('(ERROR) Iteration i = ' .. i .. ' with duration of ' .. (i * 10) .. 's FAILED')
end
endAfter testing: |
I'll give it a test on my end shortly, I can reliably reproduce the performance issue I was having so I can get a good feel for how effective the solution is. |
|
Certainly seems to effectively address the issue, at least for me. With or without the use of GetNetworkTimeAccurate(). May be worth implementing. |
|
So your solution is providing a 20% buffer if I understand correctly ? It seems a bit exagerated, as on my tests I'm getting a difference of below 1%:
Don't know by how much this would vary on lower spec PCs, and I couldn't be bothered running more iterations. |
Steps to reproduce this bug:
I found this while testing my crafting system which uses a very long progressbar (300 seconds) and most of the time was failing. I initially though it was my crafting system but digging deeply this part was failing in oxlib:
I believe the issue is a time desync between NUI and GetGameTimer(), initially Linden/Luke gave a +100ms slight compensation which was only good for short time "errors", not for longer ones.
This might be a temporary solution only. A better one to compensate the error fully might be better.