Permalink
Browse files

Massive reductions in unnecessary network traffic especially during h…

…igh 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
  • Loading branch information...
Akkadius committed Jul 9, 2017
1 parent aae1d2f commit 127f51e7587b0d354f0f326f8661a640baf313e2
Showing with 51 additions and 7 deletions.
  1. +15 −0 changelog.txt
  2. +4 −1 common/eqemu_logsys.h
  3. +8 −4 zone/attack.cpp
  4. +1 −1 zone/client.cpp
  5. +19 −1 zone/mob.cpp
  6. +4 −0 zone/mob.h
View
@@ -1,5 +1,20 @@
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 ==
Akkadius: Resolve issues with NPC's hopping to the ceiling in small corridors
Akkadius: Improved grounding issues with NPC's during combat
View
@@ -86,6 +86,7 @@ enum LogCategory {
Login_Server,
Client_Login,
Headless_Client,
HP_Update,
MaxCategoryID /* Don't Remove this*/
};
@@ -135,7 +136,9 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
"Packet :: Server -> Client (Dump)",
"Packet :: Client -> Server (Dump)",
"Login Server",
"Client Login"
"Client Login",
"Headless Client",
"HP Update"
};
}
View
@@ -137,7 +137,10 @@ EQEmu::skills::SkillType Mob::AttackAnimation(int Hand, const EQEmu::ItemInstanc
if (Hand == EQEmu::inventory::slotSecondary) // DW anim
type = animDualWield;
DoAnim(type, 0, false);
if (attack_anim_timer.Check()) {
DoAnim(type, 0, false);
}
return skillinuse;
}
@@ -3397,8 +3400,6 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
SetHP(GetHP() - damage);
if (IsClient() && RuleB(Character, MarqueeHPUpdates))
this->CastToClient()->SendHPUpdateMarquee();
if (HasDied()) {
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 (IsNPC()) {
// Is this adequate?
Teleport(new_pos);
SendPosUpdate();
if (position_update_melee_push_timer.Check()) {
SendPosUpdate();
}
}
}
else {
View
@@ -8745,7 +8745,7 @@ void Client::SendHPUpdateMarquee(){
return;
/* 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)
return;
View
@@ -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;
View
@@ -1379,6 +1379,8 @@ class Mob : public Entity {
Timer flee_timer;
Timer fix_z_timer;
Timer fix_z_timer_engaged;
Timer attack_anim_timer;
Timer position_update_melee_push_timer;
bool pAIControlled;
bool roamer;
@@ -1387,6 +1389,8 @@ class Mob : public Entity {
int wandertype;
int pausetype;
int8 last_hp;
int cur_wp;
glm::vec4 m_CurrentWayPoint;
int cur_wp_pause;

0 comments on commit 127f51e

Please sign in to comment.