L2JMobius

Homunculus Server sends too much traffic than normal 10k to 120kb / sec?? too high

jhordanny · 12 · 5103

Offline jhordanny

  • Heir
  • **
    • Posts: 28
Hello there people, I am about to launch my H2 server but i discovered there is a big problem. The server sends or the client asks for too much data. Lets say i go to a farm place where there are many mobs, the traffict goes up to over 100kbs untill i kill all the mobs, 1-5 mobs puts me on 10kbs-15kbs. This problem can really mess things up, is there anyone outthere with the answer for this? thanks very much in advance.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
Try this.
Code: [Select]
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
index 3f737ad..6cc8890 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
@@ -439,6 +439,7 @@
 
  // prevent possible extra calls to this function (there is none?),
  // also don't send movetopawn packets too often
+ boolean sendPacket = true;
  if (_clientMoving && (_target == pawn))
  {
  if (_clientMovingToPawnOffset == offset)
@@ -447,6 +448,7 @@
  {
  return;
  }
+ sendPacket = false;
  }
  // minimum time to calculate new route is 2 seconds
  else if (_actor.isOnGeodataPath() && (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
@@ -485,7 +487,7 @@
  _actor.broadcastMoveToLocation();
  _clientMovingToPawnOffset = 0;
  }
- else
+ else if (sendPacket)
  {
  final WorldRegion region = _actor.getWorldRegion();
  if ((region != null) && region.isActive())


Offline jhordanny

  • Heir
  • **
    • Posts: 28
Thanks Mobius,

I applied the patch but it seems to have no effect, still boosting up a lot of bandwith. Lets say i go to Loc, and stand in the middle of any spot there, as soon as mobs start to agro, bandwidth goes up from 10kb/s to 20kb/s, and if i move a little bit with all the mobs on me, bandwidth hits 50-60k and goes back to 10-20 again when i stop moving. If i go to a different hunting ground that has many more mobs and repeat steps, it goes way over 120kbs. Standing by the mobs puts it on 6kbps down 3kup continuously until i move out of its reach. In town, the kbs are .1 to .3 kbs peaks, consider no one else is in server.
Hope this can help a little better.

Appreciate all the help !


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/ai/AbstractAI.java
===================================================================
--- java/org/l2jmobius/gameserver/ai/AbstractAI.java (revision 8661)
+++ java/org/l2jmobius/gameserver/ai/AbstractAI.java (working copy)
@@ -519,6 +519,12 @@
  */
  protected void moveTo(int x, int y, int z)
  {
+ // Check if actor is already at that location.
+ if ((_actor.getX() == x) && (_actor.getY() == y) && (_actor.getZ() == z))
+ {
+ return;
+ }
+
  // Check if actor can move
  if (!_actor.isMovementDisabled())
  {
@@ -528,9 +534,6 @@
 
  // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
  _actor.moveToLocation(x, y, z, 0);
-
- // Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
- _actor.broadcastMoveToLocation();
  }
  else
  {



Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
Have no idea where else to look.
Try removing some MoveToLocation broadcast until it does not happen.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
Comment from Bandnentans
Quote
No, that happened before that.
Mobs being inactive fixed whith gridalwayson, so that patch should fix it.
Regarding movement, now I have problems with pathfinding, server sends next movetolocation before client is finished moving on the prev route
must be something l2jserver geoengine :/
and yeah, that traffic should be because of that MoveToLocation packet being sent for every knowlost object every game tick(100ms if im correct) so with 50 knownlist objects moving, server will send 500 moveToLocation packets every second
Creature.java
method - updatePosition
remove broadcastMoveToLocation. that's the fix


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
Might as well try this.
Code: [Select]
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
index 3f737ad..21bf729 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java
@@ -519,6 +519,12 @@
  */
  protected void moveTo(int x, int y, int z)
  {
+ // Check if actor is already at that location.
+ if ((_actor.getX() == x) && (_actor.getY() == y) && (_actor.getZ() == z))
+ {
+ return;
+ }
+
  // Check if actor can move
  if (!_actor.isMovementDisabled())
  {
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 45c7d19..9bf2da3 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -3082,8 +3082,6 @@
  // Set the timer of last position update to now
  m._moveTimestamp = gameTicks;
 
- // Send a Server->Client packet MoveToLocation to the actor and all known PlayerInstance.
- broadcastMoveToLocation();
  if (distFraction > 1)
  {
  ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));


Offline jhordanny

  • Heir
  • **
    • Posts: 28
i added that patch, it gives me an error on line 1145 of the same file inventory.reduceArrowCount(crossbow ? EtcItemType.BOLT : EtcItemType.ARROW);


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
i added that patch, it gives me an error on line 1145 of the same file inventory.reduceArrowCount(crossbow ? EtcItemType.BOLT : EtcItemType.ARROW);

Patch updated.
It is not that hard to apply manually.


Offline jhordanny

  • Heir
  • **
    • Posts: 28
Alright is done!! sorry a took a while, had myself a headache with this one. This gave me a -10x traffic drop on the network and it feels alot better while playing. I still get some high peaks but only very short and not as high as before. Thanks very much Mobius.