[Help] Scatter causing lag

07/07/2014 21:26 littlechris95#1
I put my project to run on a dedicated server just for testing and called Some friends of mine, over the course of the tests I find that somehow when they went hunting with his archers, while they used the scatter in monsters, your ping was increased and reached a 18k.

What could be wrong?
07/08/2014 02:11 Aceking#2
Likely because your attack calculations for X amount of mobs at a time is slowing your server down alot.
07/08/2014 03:52 CptSky#3
Had a similar issue with COPS v6 because the magic handling was shit. You'll need to rework it. Try to find which part is slowing down the whole calculation.
07/08/2014 04:27 littlechris95#4
Quote:
Originally Posted by Aceking View Post
Likely because your attack calculations for X amount of mobs at a time is slowing your server down alot.
I confess I had a lot of mobs, but I reduced and even with a small amount ping increases.
07/08/2014 12:52 Aceking#5
Quote:
Originally Posted by littlechris95 View Post
I confess I had a lot of mobs, but I reduced and even with a small amount ping increases.
I had similar issues where any ranged attack (hercules, scatter etc) would increase the ping from 100 to about 1000.
Traced it back to the kill methods for mobs and realized it was extremely inefficient, after re-working it, ping didn't change.

So if you follow your code from attack to kill, you will eventually find the problem. But it is in there somewhere.
07/08/2014 17:27 littlechris95#6
Quote:
Originally Posted by Aceking View Post
I had similar issues where any ranged attack (hercules, scatter etc) would increase the ping from 100 to about 1000.
Traced it back to the kill methods for mobs and realized it was extremely inefficient, after re-working it, ping didn't change.

So if you follow your code from attack to kill, you will eventually find the problem. But it is in there somewhere.

What is the difference in the calculations, a Melee attack for a ranged attack? I have this doubt ... use the same calculations as used in Melee attacks to Ranged attacks.
07/08/2014 23:02 Aceking#7
Quote:
Originally Posted by littlechris95 View Post
What is the difference in the calculations, a Melee attack for a ranged attack? I have this doubt ... use the same calculations as used in Melee attacks to Ranged attacks.
The damage algorithm shouldn't be the problem, unless you have some ungodly calculation.
Im willing to bet the problem is in your kill method.

What you should do is test scatter where it doesn't kill a mob, and test where it does kill the mobs.
If the lag spikes only when you kill a mob, then the problem is inside your kill functions.
If it spikes regardless, then the problem is somewhere in the attack section.
Or it could be in both and you have double the problems.

One way to narrow it down would be to add some timing mechanism in several locations recording the time it takes to perform that function.
Stopwatches would likely work for this as you don't need nano seconds.

Place a bunch of stop watches and time different methods and output it the console or to your character.
See where the time is rather large, my guess is you will have 100+ ms intervals.

If your code is efficient, the entire process should be 0ms, or darn close depending on server load.
07/09/2014 07:22 littlechris95#8
Problem solved!

Thank you very much ;D

#Request Close