Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2016-03-08 22:05:10

darkblades
Member
From: New MLG City/Weed Town
Joined: 2015-03-21
Posts: 122

[help] message handler lag

sometimes in my bot game,  it doesnt register "m",'b","say" etc and sometimes don't work at all and starts being delayed by XXXXms. How to deal with this.


Sample Text.

Doritos/Mountain Dew eater.
420 No scoping 69 scrubs per day
Always smoke weed everyday.

Known for: #getrekt Bot (possible revive with new stuff?)

Offline

#2 2016-03-08 23:51:44

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: [help] message handler lag

Can you show us the error? And maybe the code you used?


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#3 2016-03-09 00:50:50

darkblades
Member
From: New MLG City/Weed Town
Joined: 2015-03-21
Posts: 122

Re: [help] message handler lag

this happens. i have alot of code in case m and case b so i have to compress it to this a pseudo code

case "m":
  -Gets users response from pressing <- -> /|\ \|/
    -for each loop to check if user is near the person within a range
      -for each loop to check if the block is not between the user and the person
       -decrease "variable" by X
    -player pressed \|/
       -check bid
         -set "itemFound" to block id

case "b":
     -set array of block x y block id to 0
     -remove all block properties
     -sets block timers such as lifespan to 0


Sample Text.

Doritos/Mountain Dew eater.
420 No scoping 69 scrubs per day
Always smoke weed everyday.

Known for: #getrekt Bot (possible revive with new stuff?)

Offline

#4 2016-03-09 05:35:13

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [help] message handler lag

Well, thanks, but I'm guessing your pseudocode will not help.

Offline

#5 2016-03-10 17:15:41, last edited by Tomahawk (2016-03-10 17:25:37)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,847

Re: [help] message handler lag

darkblades wrote:

and starts being delayed by XXXXms

It looks like you're doing quite a lot of processing in "m". If you're dealing with the packets slower than they're arriving, you'll get a buildup of messages and therefore lag. If you build up enough lag, the bot will also disconnect (see this post).

To decrease the lag, you have to make the code quicker/shorter, or find a different way to do it.

God help anyone who recommends threading/multithreading. That's not the problem here.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#6 2016-03-12 09:32:41

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

Re: [help] message handler lag

Tomahawk wrote:

God help anyone who recommends threading/multithreading.

Well it stops messages building up.


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

#7 2016-03-12 14:05:54

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,847

Re: [help] message handler lag

Koya wrote:

Well it stops messages building up.

It's not parallel processing, so there won't be any real decrease in the time taken to process a packet. You won't get buildup of messages in PlayerIO's internal buffer; you'll slowly increase the number of active threads instead, which might be worse. It'll still lag.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#8 2016-03-12 18:33:43

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [help] message handler lag

Tomahawk wrote:
Koya wrote:

Well it stops messages building up.

It's not parallel processing, so there won't be any real decrease in the time taken to process a packet. You won't get buildup of messages in PlayerIO's internal buffer; you'll slowly increase the number of active threads instead, which might be worse. It'll still lag.

The processing of the message is what's taking long.
Putting that process in a seperate thread will effectively shorten that delay (as you only have to make a thread instead of do the entire process).
Now the downside is that you're still processing one message when the next one comes in and starts processing simultaneously.
So in this case I indeed wouldn't recommend multithreading. But I'm far too inexperienced to really make a solid standing here.

Offline

den31071457804023588054

Board footer

Powered by FluxBB

[ Started around 1732428922.3514 - Generated in 0.086 seconds, 12 queries executed - Memory usage: 1.5 MiB (Peak: 1.65 MiB) ]