Forums Index >> Modding >> Packet Loss Script?
Page : <1> :
Simple and in a nutshell...
Just put this anywhere that gets executed...
function checkpacketloss()
{
%len = clientgroup.getCount();
for(%i=0;%i<%len;%i++)
{
%u = clientgroup.getObject(%i);
if(%u.getpacketloss() >= 200)
{
schedule(500,false,"MessageAll","",%u.namebase@" has been kicked for bad lag!", 4,3);
%u.delete("Sorry, you have lag...");
}
}
schedual(30000, false, "checkpacketloss");
}
checkpacketloss();
The master scripter is Art Crazyİ
Yeah thanks... :P
^ I should explain....
Every 30 seconds this will test all players for bad packet loss...
If you still experiance lag from someone
if(%u.getpacketloss() >= 200
)
change that 200 to a lower number...
If you have no lag but people are being kicked... Change the 200 to a higher number...
I just picked 200 out of thin air.
Woot!
Thanks guys, I will try give it a run later tonight.
Schedual(30000, false, "checkpacketloss");
I take it if I want the checks to happen every minute instead of every 30 seconds I change this number?
Yes... 1000 means one second so 60000 means one minute
Ok had it running last night. Actually threw it into my dash folder:
*** Mission loaded
Engine initialized...
Loading compiled script game/server/dash/main.cs.
Loading compiled script game/server/dash/prefs.cs.
Loading compiled script game/server/dash/ConsoleUtilities.cs.
Loading compiled script game/server/dash/GameConnection.cs.
Loading compiled script game/server/dash/Codes.cs.
Loading compiled script game/server/dash/UberBots.cs.
Compiling game/server/dash/pcktloss.cs...
Loading compiled script game/server/dash/pcktloss.cs.
Sending heartbeat to master server [IP:216.116.32.49:28002]
I had it set at 3. Got up to a full server and no one booted. There was even a time were I wasn't seeing my bullets so I should have been booted? Not sure it this check just looks at the specific moment to see if there was a packet loss, or if its even enabled in TT. Is it possible to have the check run for a duration of, say 5 seconds? I currently have it running in my server set to 1, to see if anything happens.
Last edited: Sunday, June 04, 2006 at 5:35:32 AM
I have:
If(%u.getpacketloss() >= 1)
And
Schedule(30000, false, "checkpacketloss");
Is still the same.
I had it set the packet loss set at 200 and Rob Zombie came in and it never booted him. So I knew it was set way to high.I changed the 200 to 3 last night and is still booted no one now its set to 1.
Does the packet checker just check for packet loss at the one moment or does it keep a running tally?
Last edited: Sunday, June 04, 2006 at 7:11:40 AM
What about a:
PacketDropped()
Check?
Is that feasable or am I barking up the wrong tree?
Last edited: Sunday, June 04, 2006 at 9:18:33 AM
I had no idea that there was a function getPacketLoss()! SO, it is an integer? How much packet loss a person is experiancing? Okay, I will keep that in mind.
I don't know if you guys want, but I could install this into my ping script, but make some changes... That way it could be a little more percise....
Just tell me if this would be something you guys would like...
function checkpacketloss()
{
%len = clientgroup.getCount();
for(%i=0;%i<%len;%i++)
{
%u = clientgroup.getObject(%i);
if(%u.getpacketloss() >= $maxLag)
CheckLoop(%u);
}
schedule(30000, false, "checkpacketloss");
}
checkpacketloss();
function CheckLoop(%client,%loopNum)
{
%loopNum++;
%ranInt = getRandom(7) - $maxLag;
if (%client.getPacketLoss() <= %ranInt)
return;
if (%loopNum < 25)
{
%client.delete("You had bad lag.");
BottomPrintAll(%client.nameBase SPC "was kicked for lag.",2,1);
return;
}
schedule(400,"CheckLoop",%client,%loopNum);
}
$maxLag = 200; // maximum lag amount
So basicaly what I did was make it so someone wasn't just kicked automaticaly, but they had to maintain their high lag for about 14 seconds. But, the lag number is exact... You'd be within about 7 integers of 200... That way, someone couldn't just get away with a packet loss of 199... You understand?
I could do some more cool stuff, just would install this into my ping script, and make it better..
Warfare, youre just to smart.... ;)
Last edited: Sunday, June 04, 2006 at 10:22:39 AM
Sweet!
Can't wait to try.
Thank you!
The number 200 was random... I do not know how the function calculates packet loss or what values it gives you
I only know that the number 0 is the packet loss for someone who is not losing any packets, like say, a hoster in their own server
Experiment with this :P
^ actually you just need to set up a dedicated server, and when people join.... Use the getpacketloss function on them in the console to see what good numbers are
Yes I think that 200 number may be a little high. Thats normaly the setting for max packets allowed by the server.
$pref::Net::PacketRateToServer = 32 (per second)
$pref::Net::PacketRateToClient = 10 (per second)
$pref::Net::PacketSize = 200 (bytes)
I am on dsl so I use:
$Pref::Net::PacketRateToClient = 24;
$Pref::Net::PacketRateToServer = 24;
$Pref::Net::PacketSize = 350;
So if someone with a perfect connection would be about 168bytes (24*the approximate 7 seconds). So I think I would start with a number at least under that.
Is it possible to to take the information from the getPacketLoss function and have it thrown into a file. That way I could just leave it running and then just average and see.
Openoffice ;)
Yes, don't need the names or anything else like that. Just the numbers.
Cool, will see what I can dig up
Hmm does that check run the packetloss check that CS wrote (with the loop) or does that just do the regular one second packet check? I believe I have mine currently set on 5. Still trying to look into how to check and see what numbers its getting, just have been busy going through the TGE tutorials.
You know PacketLoss is something really different from what we usually call as "lag", it is one cause, but rarely happens!
True packetloss is something else, not really latency. However, if you have enought players with packetloss it throws the server out of whack.
Ok turned the trace on:
% trace(1);
Console trace is on.
Entering (null)::checkpacketloss()
Leaving (null)::checkpacketloss - return 0
Received info request from a master server [IP:216.116.32.49:28002].
Entering (null)::checkpacketloss()
Leaving (null)::checkpacketloss - return 0
After I jump in the server:
Entering (null)::checkpacketloss()
Leaving (null)::checkpacketloss - return 1255
Different map:
Entering (null)::checkpacketloss()
Entering (null)::CheckLoop(1171)
Leaving (null)::CheckLoop - return 1171
Leaving (null)::checkpacketloss - return 1171
After a few people join:
Entering (null)::checkpacketloss()
Entering (null)::CheckLoop(6157)
Leaving (null)::CheckLoop - return 6157
Entering (null)::CheckLoop(6999)
Leaving (null)::CheckLoop - return 6999
Leaving (null)::checkpacketloss - return 6999
Entering (null)::checkpacketloss()
Entering (null)::CheckLoop(1171)
Leaving (null)::CheckLoop - return 1171
Entering (null)::CheckLoop(2292)
Leaving (null)::CheckLoop - return 2292
Entering (null)::CheckLoop(5990)
Leaving (null)::CheckLoop - return 5990
Entering (null)::CheckLoop(6157)
Leaving (null)::CheckLoop - return 6157
Leaving (null)::checkpacketloss - return 6157
I have taken the max lag number down to zero. Shouldn't that kick me out? Guess I need to get/find a little more clarification as to what this packeloss is really checking and adjust the number accordingly. Any ideas?
Last edited: Monday, June 12, 2006 at 10:09:30 PM
Don't really need a script for that. Just type ---> metrics(fps); in a console. That will let you know how many frames per second that individual computer is doing. Not sure if you could do it server side.
^^ Download the wingman script if you want to see your framerate.
Page : <1> :
Is it possible to have a script like the high ping script but one that measures packets loss for individual players on the server side? Is just possible to monitor/check packets loss in TT? Any info would be great.