Engine optimization for better performance and mem usage (#1462)

* Optimize loot

* World channel talk

* General improvement

* Engine rebuild for performance and memory usage

* Fix crash with AutoDoQuest = 0
This commit is contained in:
Yunfan Li
2025-07-25 18:11:03 +08:00
committed by GitHub
parent 4a00c954ed
commit feda619066
36 changed files with 831 additions and 237 deletions

View File

@@ -19,10 +19,19 @@
class PlayerbotAI;
typedef Strategy* (*StrategyCreator)(PlayerbotAI* botAI);
typedef Action* (*ActionCreator)(PlayerbotAI* botAI);
typedef Trigger* (*TriggerCreator)(PlayerbotAI* botAI);
typedef UntypedValue* (*ValueCreator)(PlayerbotAI* botAI);
class AiObjectContext : public PlayerbotAIAware
{
public:
AiObjectContext(PlayerbotAI* botAI);
AiObjectContext(PlayerbotAI* botAI,
SharedNamedObjectContextList<Strategy>& sharedStrategyContext = sharedStrategyContexts,
SharedNamedObjectContextList<Action>& sharedActionContext = sharedActionContexts,
SharedNamedObjectContextList<Trigger>& sharedTriggerContext = sharedTriggerContexts,
SharedNamedObjectContextList<UntypedValue>& sharedValueContext = sharedValueContexts);
virtual ~AiObjectContext() {}
virtual Strategy* GetStrategy(std::string const name);
@@ -56,20 +65,30 @@ public:
std::set<std::string> GetSupportedActions();
std::string const FormatValues();
virtual void Update();
virtual void Reset();
virtual void AddShared(NamedObjectContext<UntypedValue>* sharedValues);
std::vector<std::string> Save();
void Load(std::vector<std::string> data);
std::vector<std::string> performanceStack;
static void BuildAllSharedContexts();
static void BuildSharedContexts();
static void BuildSharedStrategyContexts(SharedNamedObjectContextList<Strategy>& strategyContexts);
static void BuildSharedActionContexts(SharedNamedObjectContextList<Action>& actionContexts);
static void BuildSharedTriggerContexts(SharedNamedObjectContextList<Trigger>& triggerContexts);
static void BuildSharedValueContexts(SharedNamedObjectContextList<UntypedValue>& valueContexts);
protected:
NamedObjectContextList<Strategy> strategyContexts;
NamedObjectContextList<Action> actionContexts;
NamedObjectContextList<Trigger> triggerContexts;
NamedObjectContextList<UntypedValue> valueContexts;
private:
static SharedNamedObjectContextList<Strategy> sharedStrategyContexts;
static SharedNamedObjectContextList<Action> sharedActionContexts;
static SharedNamedObjectContextList<Trigger> sharedTriggerContexts;
static SharedNamedObjectContextList<UntypedValue> sharedValueContexts;
};
#endif