azerothcore / azerothcore/mod-autobalance
Fix For Mobs Not Always Scaling Properly In Raids
- Dominant language
- C++
- Stars
- 160
- Forks
- 141
- PR merge metrics
- No merged PRs in 30d
Description
### Current Behaviour
I think this is a dupe of issue #172 but I wanted to make my own thread and post my theories on this bug.
The issue is cases where mobs are not scaled properly in an instance, despite all the settings being correct. I think the issue is limited to large instances, meaning only raids. I think it has to do with how mobs are loaded into memory, where in a dungeon maybe everything will load all at once bc it's relatively small, but in a raid the area is so large not every mob is loaded at once. I think it's the mobs loaded later who are failing to be scaled.
For a while, I would use a macro ``.ab setoffset 0`` and just click it whenever I found a mob not properly scaled, and it would work fine. But after this became annoying, I amended the autobalance mod to add a 1 minute map update.
In ``ABPlayerScript.cpp``:
```
void AutoBalance_PlayerScript::OnUpdate(Player* player, uint32 /*p_time*/)
{
// if it's been less than 60 seconds since last check, bail...
if (GetEpochTime().count() % 60 != 0) return;
Map* map = player->GetMap();
if (!map || !map->IsDungeon())
{
return;
}
// update the map's player stats
UpdateMapPlayerStats(map);
// schedule all creatures for an update
AutoBalanceMapInfo* mapABInfo = map->CustomData.GetDefault("AutoBalanceMapInfo");
mapABInfo->mapConfigTime = GetCurrentConfigTime();
}
```
So though I don't know why this bug exists, I can only speculate, this new onupdate method has resolved it. It just forces the map to check scaling on creatures every minute.
### Expected Behaviour
I've presented a proposed fix for this bug.
### Steps to reproduce the problem
I've experience scaling failures in large raids, such as AQ20 and AQ40.
### Extra Notes
_No response_
### AutoBalance Debug Commands
_No response_
### AC rev. hash/commit
NA
### Operating system
Ubuntu 24
### Custom changes or Modules
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing ABPlayerScript.cpp, especially AutoBalance_PlayerScript::OnUpdate and the related map-stat update flow. Reproduce the scaling failure in large raids such as AQ20 or AQ40, then verify that mobs loaded later are scaled consistently and that the proposed periodic update behavior resolves the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100