fix(client/interface): fix longer progess bars fails because of NUI and GetGameTimer() desync#27
fix(client/interface): fix longer progess bars fails because of NUI and GetGameTimer() desync#27xSL0W wants to merge 1 commit intoCommunityOx:mainfrom
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.