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

View File

@ -1,5 +1,20 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 7/9/2017 ==
Akkadius: 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
== 7/1/2017 == == 7/1/2017 ==
Akkadius: Resolve issues with NPC's hopping to the ceiling in small corridors Akkadius: Resolve issues with NPC's hopping to the ceiling in small corridors
Akkadius: Improved grounding issues with NPC's during combat Akkadius: Improved grounding issues with NPC's during combat

View File

@ -86,6 +86,7 @@ enum LogCategory {
Login_Server, Login_Server,
Client_Login, Client_Login,
Headless_Client, Headless_Client,
HP_Update,
MaxCategoryID /* Don't Remove this*/ MaxCategoryID /* Don't Remove this*/
}; };
@ -135,7 +136,9 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
"Packet :: Server -> Client (Dump)", "Packet :: Server -> Client (Dump)",
"Packet :: Client -> Server (Dump)", "Packet :: Client -> Server (Dump)",
"Login Server", "Login Server",
"Client Login" "Client Login",
"Headless Client",
"HP Update"
}; };
} }

View File

@ -137,7 +137,10 @@ EQEmu::skills::SkillType Mob::AttackAnimation(int Hand, const EQEmu::ItemInstanc
if (Hand == EQEmu::inventory::slotSecondary) // DW anim if (Hand == EQEmu::inventory::slotSecondary) // DW anim
type = animDualWield; type = animDualWield;
DoAnim(type, 0, false); if (attack_anim_timer.Check()) {
DoAnim(type, 0, false);
}
return skillinuse; return skillinuse;
} }
@ -3397,8 +3400,6 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
SetHP(GetHP() - damage); SetHP(GetHP() - damage);
if (IsClient() && RuleB(Character, MarqueeHPUpdates))
this->CastToClient()->SendHPUpdateMarquee();
if (HasDied()) { if (HasDied()) {
bool IsSaved = false; bool IsSaved = false;
@ -3549,8 +3550,11 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
if (zone->zonemap && zone->zonemap->CheckLoS(glm::vec3(m_Position), new_pos)) { // If we have LoS on the new loc it should be reachable. if (zone->zonemap && zone->zonemap->CheckLoS(glm::vec3(m_Position), new_pos)) { // If we have LoS on the new loc it should be reachable.
if (IsNPC()) { if (IsNPC()) {
// Is this adequate? // Is this adequate?
Teleport(new_pos); Teleport(new_pos);
SendPosUpdate(); if (position_update_melee_push_timer.Check()) {
SendPosUpdate();
}
} }
} }
else { else {

View File

@ -8745,7 +8745,7 @@ void Client::SendHPUpdateMarquee(){
return; return;
/* Health Update Marquee Display: Custom*/ /* Health Update Marquee Display: Custom*/
uint32 health_percentage = (uint32)(this->cur_hp * 100 / this->max_hp); int8 health_percentage = (int8)(this->cur_hp * 100 / this->max_hp);
if (health_percentage == 100) if (health_percentage == 100)
return; return;

View File

@ -114,7 +114,9 @@ Mob::Mob(const char* in_name,
mitigation_ac(0), mitigation_ac(0),
m_specialattacks(eSpecialAttacks::None), m_specialattacks(eSpecialAttacks::None),
fix_z_timer(300), 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; targeted = 0;
tar_ndx=0; tar_ndx=0;
@ -123,6 +125,8 @@ Mob::Mob(const char* in_name,
last_z = 0; last_z = 0;
last_hp = 100;
AI_Init(); AI_Init();
SetMoving(false); SetMoving(false);
moved=false; moved=false;
@ -1299,6 +1303,20 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
// sends hp update of this mob to people who might care // sends hp update of this mob to people who might care
void Mob::SendHPUpdate(bool skip_self) 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; EQApplicationPacket hp_app;
Group *group = nullptr; Group *group = nullptr;

View File

@ -1379,6 +1379,8 @@ protected:
Timer flee_timer; Timer flee_timer;
Timer fix_z_timer; Timer fix_z_timer;
Timer fix_z_timer_engaged; Timer fix_z_timer_engaged;
Timer attack_anim_timer;
Timer position_update_melee_push_timer;
bool pAIControlled; bool pAIControlled;
bool roamer; bool roamer;
@ -1387,6 +1389,8 @@ protected:
int wandertype; int wandertype;
int pausetype; int pausetype;
int8 last_hp;
int cur_wp; int cur_wp;
glm::vec4 m_CurrentWayPoint; glm::vec4 m_CurrentWayPoint;
int cur_wp_pause; int cur_wp_pause;