Valhalla Legends Forums Archive | Battle.net Bot Development | Grok's FLood Protection

AuthorMessageTime
SillyPuddy
uhhh, How do u use Grok's Flood Protection in vl doc's. Ive tried using but it never seems to work.
July 15, 2004, 1:54 AM
PiaNKA
If you're talking about chat, then you've got a problem. My bot has an interesting way of dealing with ban floods. The queue as a base sends every 2500ms, and every other ban it +/- 750ms. Every 15 bans it pauses for 10 seconds. This has yet to drop and I've banned loads nonstop for 30 minutes. So I dunno...you might want to set the ms based on the queue count.
July 15, 2004, 4:15 AM
iago
I couldn't get Grok's to work, but this is my Java code (should be easy enough to port it):

[code] private long firstMessage = 0;
private long sentBytes = 0;
private long sentPackets = 0;
private long totalDelay = 0;

public long calculateDelay(long bytes)
{
sentBytes += bytes;
sentPackets++;

long requiredDelay = (sentBytes * perByte) + (sentPackets * perPacket);


if(firstMessage + requiredDelay + totalDelay < System.currentTimeMillis())
{
firstMessage = System.currentTimeMillis();
requiredDelay = 0;
sentBytes = bytes;
sentPackets = 1;
totalDelay = requiredDelay;
return 0;
}

totalDelay += requiredDelay;

long timeSinceFirst = System.currentTimeMillis() - firstMessage;

return requiredDelay - timeSinceFirst + totalDelay;
}
[/code]
July 15, 2004, 12:19 PM
DaRk-FeAnOr
Having a threaded queue sending messages in order is better than calculating a delay . :)
July 15, 2004, 1:39 PM
zorm
[quote author=DaRk-FeAnOr link=board=17;threadid=7709;start=0#msg70489 date=1089898748]
Having a threaded queue sending messages in order is better than calculating a delay . :)
[/quote]

I fail to see how that provides flood protection. Maybe if you'd explain more and provide an example?
July 15, 2004, 1:52 PM
TangoFour
If you send too many messages within a short timespan, you get disconnected for flooding, that's what this algorithm is designed to prevent.

This algorithm has nothing to do with protecting your bot from floodbots
July 15, 2004, 2:10 PM
iago
[quote author=TangoFour link=board=17;threadid=7709;start=0#msg70493 date=1089900637]
If you send too many messages within a short timespan, you get disconnected for flooding, that's what this algorithm is designed to prevent.

This algorithm has nothing to do with protecting your bot from floodbots
[/quote]

And I don't see what flood protection has to do with floodbots :/
July 15, 2004, 4:20 PM
hismajesty
[quote author=iago link=board=17;threadid=7709;start=0#msg70501 date=1089908432]
[quote author=TangoFour link=board=17;threadid=7709;start=0#msg70493 date=1089900637]
If you send too many messages within a short timespan, you get disconnected for flooding, that's what this algorithm is designed to prevent.

This algorithm has nothing to do with protecting your bot from floodbots
[/quote]

And I don't see what flood protection has to do with floodbots :/
[/quote]

I think he said that because Pianka was talking about his flood bot banning thing.
July 15, 2004, 4:35 PM
Tuberload
[quote author=DaRk-FeAnOr link=board=17;threadid=7709;start=0#msg70489 date=1089898748]
Having a threaded queue sending messages in order is better than calculating a delay . :)
[/quote]

Why would the queue need to be threaded unless you are running multiple bots from the same process? A priority queue data structure is all you need to store the data. Then you need an algorithm to calculate the time between sends (hence what iago posted). Run it all off of some sort of timer and you are set.
July 15, 2004, 7:16 PM
iago
[quote author=Tuberload link=board=17;threadid=7709;start=0#msg70541 date=1089918983]
[quote author=DaRk-FeAnOr link=board=17;threadid=7709;start=0#msg70489 date=1089898748]
Having a threaded queue sending messages in order is better than calculating a delay . :)
[/quote]

Why would the queue need to be threaded unless you are running multiple bots from the same process? A priority queue data structure is all you need to store the data. Then you need an algorithm to calculate the time between sends (hence what iago posted). Run it all off of some sort of timer and you are set.
[/quote]

Mine actually calculates the absolute time, not the delay. But I think the main problem with his queue is that it doesn't work. And he won't stop bugging me to help him fix it!
July 15, 2004, 8:13 PM
TheMinistered
Grok's version has an overflow problem. You will need to convert the signed long into an unsigned long (an unsigned long will not fit into a vb long, but rather a vb double)
July 17, 2004, 3:34 PM

Search