GameServer
GameServer copied to clipboard
Handle buffs using priority queue
Remove timers and use proper tick system to handle the buffs using priority queue of duration and order. This will assure efficient & correct handling of buffs.
Resolved via #954
@microsoftv It wasn't resolved, as buffs don't use priority queue yet.
What do you mean by priority queue then? As far as I can see I handle buffs by duration and order. Oldest buff has the lowest index.
@microsoftv https://en.wikipedia.org/wiki/Priority_queue The running times are much better with this data structure (no iteration)
Remove timers and use proper tick system to handle the buffs using priority queue of duration and order. This will assure efficient & correct handling of buffs.
@danil179 Should we realy use Buff.Duration
for that or rather implement a Buff.Priority
which defaults to Buff.Duration
? This way we could overwrite the priority easily if needed.
@superewald I think that there are cases when 2 buffs start in the same time and then we want priority. So it is good to have a field Buff.Priority
. Currently, let's just copy the duration, and later we will add the another 2nd number (so it will be like vector2 with specific comparison) that decides these cases.