Regarding Grid Searches #2157
Replies: 4 comments
-
|
Thanks for the investigation. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah there are a ton of core functions that could be used directly. I don't think Playerbots has any function that is limited to a creature search, and there are several in the core. I think the best general function for a creature grid search is GetCreatureListWithEntryInGrid(), which has overrides for a single entry or multiple entries. There is also GetCreaturesWithEntryInRange(), but I'm not sure why it exists as it appears to be the exact same in function. To get a single creature directly, there is FindNearestCreature(), but that one doesn't work for trigger NPCs because it has a check for the creature being in the same phase as the searcher. There are various other searches for GOs, dead creatures, etc. And of course, it's not hard at all for Playerbots to make its own search functions based on the filters and searchers in the Core. |
Beta Was this translation helpful? Give feedback.
-
|
I asked Claude to search core functions for searching and here is what I got. AzerothCore Entity Search FunctionsTemplated Searcher Classes — GridNotifiers.hGeneric World Object Searchers
GameObject Searchers
Unit / Creature Searchers
Player Searchers
Checker / Predicate Classes — GridNotifiers.hHostile Unit Checks
Friendly Unit Checks
HP / Healing Target Checks
Generic Unit / AOE Checks
Creature Assist Checks
Player Checks
Dead Unit Checks
GameObject / Node Checks
Utility Checks
WorldObject Convenience Functions — Object.h
Cell / Grid Visit Functions — CellImpl.h
Map GUID-Based Lookup — Map.h
ObjectAccessor Global Lookups — ObjectAccessor.h
How They Compose// Typical pattern:
Cell::Visit(cell_coord, Searcher(result, Checker(source, range)), radius);High-level helpers like |
Beta Was this translation helpful? Give feedback.
-
|
Claude identified opportunities for replacement. (Note Im not endorsing any of these, just lazily applying the search capabilities of LLM to this topic.) Replacement Opportunities1.
|
| Playerbot Value | Issue | Core Replacement |
|---|---|---|
NearestCorpsesValue |
Custom dead-unit checker | AnyDeadUnitObjectInRangeCheck (GridNotifiers.h:~605) |
NearestGameObjects |
Custom GO checker | GameObjectInRangeCheck, NearestGameObjectFishingHole |
"nearest hostile npcs" (list) |
Flat list + manual sort | NearestHostileUnitCheck + UnitLastSearcher |
"nearest adds" |
Broad scan + AcceptUnit filter | AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck |
"party member without aura" |
Manual group walk | FriendlyMissingBuffInRange + UnitListSearcher |
"party member to heal" |
Manual group walk + HP compare | MostHPMissingGroupInRange + UnitSearcher |
"party member to resurrect" |
Manual group walk | AnyDeadUnitSpellTargetInRangeCheck + UnitSearcher |
"possible rpg targets" |
Broad scan + NPC flag filter | NearestCreatureEntryWithLiveStateInObjectRangeCheck |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been looking into how playerbots does grid searches as it seems like an area of the code where there is poor optimization and poor usage of the existing functions (with me certainly being guilty of it).
I decided to set up five triggers in a boss strategy (Black Temple because it was just what I was working on at the time), with each running a different grid search for an NPC that was not going to be found. All searches were within a 100-yard radius. I just let the bots sit there for a while with pmon, and below are the results for percentage of the update loop (absolute percentage is not important since that is dependent on all sorts of other context; the focus should be on the relative percent):
Case 1: "nearest npcs": 9.313%
Case 2: "possible targets": 2.203%
Case 3: "possible targets no los": 1.371%
Case 4: Acore::UnitListSearcher (I think basically like "possible targets no los" but bypassing AiObjectContext): 1.148%
Case 5: Acore::CreatureListSearcher (this excludes players, notably, and is probably the best way to do a grid search the vast majority of the time in boss strategies, yet there is nothing like it built into Playerbots): 0.959%
Tl;dr:
Beta Was this translation helpful? Give feedback.
All reactions