Closed
Conversation
* fix: Changed PlayerbotsMgr to be a true Meyer's singleton passed by reference. * fix: Migrated PlayerbotAIConfig to a clean singleton pattern instead of a pointer. * fix: Migrated RandomItemMgr to a clean singleton pattern. * fix: Migrated SharedValueContext to a clean singleton pattern. * fix: Migrated PlayerbotCommandServer to a clean singleton instead of using a pointer. * fix: Migrated PerfMonitor to a clean singleton instead of using a pointer. * fix: Migrated FlightMasterCache to a clean singleton instead of using a pointer. * fix: Migrated PlayerbotDungeonRepository to a clean singleton instead of using a pointer. * fix: Migrated PlayerbotRepository to a clean singleton without using a pointer. * fix: Migrated PlayerbotSpellRepository to a clean singleton instead of using a pointer. * fix: Migrated GuildTaskMgr to a clean singleton instead of using a pointer. * fix: Migrated PlayerbotGuildMgr to a clean singleton instead of using a pointer. * fix: Migrated PlayerbotTextMgr to a clean singletong instead of using a pointer. * fix: Migrated TravelMgr to a clean singleton instead of using a pointer. * fix: Migrated TravelNodeMap to a clean singleton instead of a pointer and removed unused, misleading public constructor on the same class. * fix: Migrated PlayerbotWorldThreadProcessor to a clean singleton instead of using a pointer. * fix: Migrated ServerFacade to a clean singleton instead of a pointer. * chore: Removed unnecessary const from move constructor/operator. (cherry picked from commit 330fb79)
There was a problem hiding this comment.
Pull request overview
This PR refactors the singleton pattern across the playerbot system, converting from pointer-based to reference-based accessors. The changes modernize the codebase by returning references instead of pointers from instance() methods, updating all usage sites from -> to . syntax, removing global macro accessors in some cases, and adding proper singleton safeguards (deleted copy/move constructors/operators).
Changes:
- Converted singleton
instance()methods from returning pointers (Type*) to returning references (Type&) - Updated all singleton usage from pointer syntax (
sInstance->method()) to reference syntax (sInstance.method()) - Added deleted copy/move constructors and assignment operators to singleton classes
- Moved constructors and destructors to private sections with proper initialization
- Removed some global macro definitions and unnecessary includes
Reviewed changes
Copilot reviewed 202 out of 202 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServerFacade.h/cpp | Converted singleton to return reference, updated all usages |
| PlayerbotAIConfig.h/cpp | Singleton conversion with safeguards, removed unnecessary includes |
| Various Manager headers | Converted singletons (TravelMgr, RandomItemMgr, PlayerbotsMgr, etc.) to reference-based |
| Repository classes | Updated PlayerbotRepository, PlayerbotSpellRepository, etc. to reference pattern |
| Action/Trigger/Value files | Updated hundreds of usage sites from -> to . syntax |
| WorldThreadProcessor | Moved constructor inline, converted to reference-based singleton |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Describe what this change does and why it is needed...
Design Philosophy
We prioritize stability, performance, and predictability over behavioral realism.
Complex player-mimicking logic is intentionally limited due to its negative impact on scalability, maintainability, and
long-term robustness.
Excessive processing overhead can lead to server hiccups, increased CPU usage, and degraded performance for all
participants. Because every action and
decision tree is executed per bot and per trigger, even small increases in logic complexity can scale poorly and
negatively affect both players and
world (random) bots. Bots are not expected to behave perfectly, and perfect simulation of human decision-making is not a
project goal. Increased behavioral
realism often introduces disproportionate cost, reduced predictability, and significantly higher maintenance overhead.
Every additional branch of logic increases long-term responsibility. All decision paths must be tested, validated, and
maintained continuously as the system evolves.
If advanced or AI-intensive behavior is introduced, the default configuration must remain the lightweight decision
model. More complex behavior should only be
available as an explicit opt-in option, clearly documented as having a measurable performance cost.
Principles:
Stability before intelligence
A stable system is always preferred over a smarter one.
Performance is a shared resource
Any increase in bot cost affects all players and all bots.
Simple logic scales better than smart logic
Predictable behavior under load is more valuable than perfect decisions.
Complexity must justify itself
If a feature cannot clearly explain its cost, it should not exist.
Defaults must be cheap
Expensive behavior must always be optional and clearly communicated.
Bots should look reasonable, not perfect
The goal is believable behavior, not human simulation.
Before submitting, confirm that this change aligns with those principles.
Feature Evaluation
Please answer the following:
How to Test the Changes
Complexity & Impact
Does this change add new decision branches?
Does this change increase per-bot or per-tick processing?
Could this logic scale poorly under load?
Defaults & Configuration
If this introduces more advanced or AI-heavy logic:
AI Assistance
If yes, please specify:
AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor.
Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest
about what they do and do not understand.
Final Checklist
Notes for Reviewers
Anything that significantly improves realism at the cost of stability or performance should be carefully discussed
before merging.