Massive reductions in unnecessary network traffic especially during high spam combat fights

- HP Updates now only send to others when HP percentage changes (0-100%)
		- HP Updates were sending excessively even during idle zones when HP wasn't changing at all
	- Attack animations now only send once per second versus up to a hundred times a second per Mob/Client
	- 17,000 OP_ClientUpdate packets per second have been observed in combat scenarios, some of the major culprits have been
		throttled without affecting what the client should see
	- Before and After packet differences under similar load/tests (Packets per second)
		- 7,000 - 8,000 	OP_Animation pps	After: 600-800 pps
		- 13,0000 - 17,000 	OP_MobHealth pps	After: 1-10 pps
		- 15,0000 - 20,000 	OP_ClientUpdate pps	After: 500-1,000 pps
	- Packet reports from a 46 client test here:
		https://gist.github.com/Akkadius/28b7ad2fdd82bdd15ea737c68f404346
	- Servers who use Marquee HP updates will also recieve far less packet spam as they will only be sent when HP changes
This commit is contained in:
Akkadius
2017-07-09 02:51:01 -05:00
parent aae1d2f049
commit 127f51e758
6 changed files with 51 additions and 7 deletions
+19 -1
View File
@@ -114,7 +114,9 @@ Mob::Mob(const char* in_name,
mitigation_ac(0),
m_specialattacks(eSpecialAttacks::None),
fix_z_timer(300),
fix_z_timer_engaged(100)
fix_z_timer_engaged(100),
attack_anim_timer(1000),
position_update_melee_push_timer(1000)
{
targeted = 0;
tar_ndx=0;
@@ -123,6 +125,8 @@ Mob::Mob(const char* in_name,
last_z = 0;
last_hp = 100;
AI_Init();
SetMoving(false);
moved=false;
@@ -1299,6 +1303,20 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
// sends hp update of this mob to people who might care
void Mob::SendHPUpdate(bool skip_self)
{
int8 current_hp = (max_hp == 0 ? 0 : static_cast<int>(cur_hp * 100 / max_hp));
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: SendHPUpdate %s HP is %i last %i", this->GetCleanName(), current_hp, last_hp);
if (current_hp == last_hp) {
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: Same HP - skipping update");
ResetHPUpdateTimer();
return;
}
else {
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: HP Changed - Send update");
last_hp = current_hp;
}
EQApplicationPacket hp_app;
Group *group = nullptr;