Skip to content

Replace AIMaster m_lEventQueue with a priority queue#1537

Open
Liareth wants to merge 4 commits intonwnxee:masterfrom
Arelith-Server:liareth/event-queue-upstream
Open

Replace AIMaster m_lEventQueue with a priority queue#1537
Liareth wants to merge 4 commits intonwnxee:masterfrom
Arelith-Server:liareth/event-queue-upstream

Conversation

@Liareth
Copy link
Copy Markdown
Member

@Liareth Liareth commented Aug 14, 2022

This is a big optimization if your module has a lot of queued events (many areas, many delaycommands, lots of fighting, lots of effects, etc). Previously events that were not immediate would be added to the linked list in AddEventAbsoluteTimeViaTail which would iterate backwards over every calendar entry until it found a place to insert.

Side effect: Events with the same time of day are now executed in an undefined order. E.g:

DelayCommand(0.0f, First());
DelayCommand(0.0f, Second());

Who knows which one will happen first? I certainly don't. But if you don't care about that, and your server is big and full of events, this could be a valuable optimization for you.

Copy link
Copy Markdown
Member

@Daztek Daztek left a comment

Choose a reason for hiding this comment

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

Just a bunch of minor things, also don't forget to update CHANGELOG.md!

Comment thread Plugins/Optimizations/EventMasterPriorityQueue.cpp Outdated
Comment thread Plugins/Optimizations/EventMasterPriorityQueue.cpp Outdated
@Cjreek
Copy link
Copy Markdown
Contributor

Cjreek commented Aug 22, 2025

Any reason this was never merged?

@pF-arQon
Copy link
Copy Markdown

pF-arQon commented Sep 4, 2025

Any reason this was never merged?

Yeah: I got RL'd, then forgot about it. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants