Skip to content

Commit

Permalink
[Core] Temporary Fix for Client-side GCD Prediction Issues
Browse files Browse the repository at this point in the history
* As the GCD is triggered on the client before anything is actually reported from the server, any function using GCDOffset can potentially flash a short duration incorrect prediction based on the mismatched client state
* Temporarily add a 0.125 second period at the start of the GCD where we do not apply the GCD to OffsetRemains
  • Loading branch information
EvanMichaels committed Dec 16, 2017
1 parent 97de32b commit 9f824f2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions AethysCore/Misc/ToSort.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,22 @@
if type( Offset ) == "number" then
ExpirationTime = ExpirationTime - Offset;
elseif type( Offset ) == "string" then
local CastRemains = Player:CastRemains();
-- Since the GCD is triggered on the client, add a brief grace period to avoid flickering predictions
-- TODO: This should probably be event-driven with CAST_ events controlling if the client-side GCD is ignored
-- For now, we just hardcode a period of 1/8th of a second which should work in most cases barring extreme lag
local GCDRemains = Player:GCDRemains();
if Player:GCD() - GCDRemains < 0.125 then
GCDRemains = 0;
end
if Offset == "GCDRemains" then
ExpirationTime = ExpirationTime - Player:GCDRemains();
ExpirationTime = ExpirationTime - GCDRemains;
elseif Offset == "CastRemains" then
ExpirationTime = ExpirationTime - Player:CastRemains();
ExpirationTime = ExpirationTime - CastRemains;
elseif Offset == "Auto" then
ExpirationTime = ExpirationTime - mathmax( Player:GCDRemains(), Player:CastRemains() );
ExpirationTime = ExpirationTime - mathmax( GCDRemains, CastRemains );
end
else
error( "Invalid Offset." );
Expand Down

0 comments on commit 9f824f2

Please sign in to comment.