Conversation
…en y meter away from following target.
Resolved file location conflicts after directory restructuring: - src/strategy/generic/ -> src/Ai/Base/Strategy/ - RelaxedFollowStrategy.cpp and .h moved to new location Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request introduces a "relaxed follow" strategy for playerbots that reduces computational overhead by simplifying bot following behavior. Instead of continuously maintaining precise formation positions and angles, bots using this strategy only move when they exceed the maximum formation distance, and they move toward the master while maintaining their current relative angle.
Changes:
- Added a new configurable distance parameter
RelaxedFollowDistancefor the relaxed follow behavior - Implemented a new
RelaxedFollowStrategythat can be enabled via bot commands - Modified the
FollowAction::Executemethod to support relaxed following logic when the strategy is active
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PlayerbotAIConfig.h | Added relaxedFollowDistance field declaration |
| src/PlayerbotAIConfig.cpp | Initialized relaxedFollowDistance from configuration with default value of 1.0 |
| src/Ai/Base/StrategyContext.h | Registered the new "relaxed follow" strategy in the strategy context |
| src/Ai/Base/Strategy/RelaxedFollowStrategy.h | Defined the RelaxedFollowStrategy class header |
| src/Ai/Base/Strategy/RelaxedFollowStrategy.cpp | Implemented the RelaxedFollowStrategy (minimal implementation, strategy acts as a flag) |
| src/Ai/Base/Actions/FollowActions.cpp | Added conditional logic to use simplified distance-based following when relaxed follow strategy is active |
| conf/playerbots.conf.dist | Added configuration option with documentation for RelaxedFollowDistance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| // Calculate position at relaxedFollowDistance from master | ||
| // Move towards master but stop at configured distance | ||
| float keepDistance = sPlayerbotAIConfig->relaxedFollowDistance; |
There was a problem hiding this comment.
The relaxed follow logic could enter an infinite loop if relaxedFollowDistance is greater than or equal to maxDistance. When the bot is too far (distance > maxDistance), it moves to keepDistance from the master. If keepDistance >= maxDistance, the bot will still be outside the acceptable range after moving, causing it to immediately trigger movement again. Consider adding validation either in the configuration loading (PlayerbotAIConfig::Initialize) or here to ensure relaxedFollowDistance is always less than the formation's max distance.
| { | |
| // Calculate position at relaxedFollowDistance from master | |
| // Move towards master but stop at configured distance | |
| float keepDistance = sPlayerbotAIConfig->relaxedFollowDistance; | |
| { | |
| // Validate formation max distance before using it | |
| if (maxDistance <= 0.0f) | |
| return false; | |
| // Calculate position at relaxedFollowDistance from master | |
| // Move towards master but stop at configured distance | |
| float keepDistance = sPlayerbotAIConfig->relaxedFollowDistance; | |
| // Ensure relaxed follow distance does not exceed formation max distance | |
| if (keepDistance >= maxDistance) | |
| keepDistance = maxDistance * 0.9f; |
| # Distance to maintain when using "relaxed follow" strategy | ||
| # Bots move to this distance from master when they get too far |
There was a problem hiding this comment.
The configuration comment could be more descriptive to help users understand the relationship between RelaxedFollowDistance and FollowDistance. Consider clarifying that RelaxedFollowDistance should be less than FollowDistance, and explaining that this is the target distance bots will move to when they exceed the maximum formation distance. For example: "Distance to maintain when using 'relaxed follow' strategy. Bots move to this distance from master when they exceed the formation's max distance. Should be less than AiPlayerbot.FollowDistance to avoid constant re-positioning."
| # Distance to maintain when using "relaxed follow" strategy | |
| # Bots move to this distance from master when they get too far | |
| # Distance to maintain when using "relaxed follow" strategy. | |
| # Bots move to this distance from master when they exceed the formation's max distance. | |
| # Should be less than AiPlayerbot.FollowDistance to avoid constant re-positioning. |
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.