Masuzu / ZooeyBot

Fully automated slime blasting, event and quest farming bot for GBF
https://gbtools.azurewebsites.net/ZooeyBot/en/Home
67 stars 42 forks source link

Memory Leak, variable 'turn' out of whack #235

Closed Sundaerae closed 7 years ago

Sundaerae commented 7 years ago
  1. If zooeybot doesn't reload page for whatever reason (skill skip, last battle skip, etc), the memory used by grandblue tab bloated each 2nd, up to 3GB or more, making the game more lag, the zooeybot will fail because of timeout. (this doesn't happen if I left the tab active without zooeybot on, so the problem isn't from the game itself)

  2. If zooeybot reload the page to skip a skill, the lua variable turn also increases by 1. The workaround is setting the timeout to 5000ms or so, making the zooeybot never skip skill. for example: I set Zooey to use Thunder on turn 5, then Jeanne to use Incision on turn >5 because of long animation, zooeybot will reload on Thunder, but then it will make Jeanne use Incision while the in-game turn is still 5.

Masuzu commented 7 years ago

Hi,

Please append :WithWaitTime after skills whose cast time is long to avoid reloading the page during the skill animation instead of reloading after the attack button is pressed, as shown here for instance: https://github.com/Masuzu/ZooeyBot/blob/master/Scripts/dark_gw_ex.lua You can also increase the value of the parameter DelayAfterUsingAbility so that the skill animation finishes before another ability is queued.

About the first issue, is the memory usage going from 2 to 3gb after a few battles? Each time Zooey clicks on the clear network history in the devtools window, which happens every 7 battles or so, the memory usage will go back to the initial value.

Sundaerae commented 7 years ago

The memory increased every second while the bot is on, but the memory used is released once zooeybot reload the page. So the memory problem happens on the long battle, especially if I disable the reload on last battle. My team is off element, so killing xeno sagitarius takes longer than, say, Xolotl. I only realize this after you told me to disable reload on last battle on the other issue (crashing when using chargediamond variable + gravity + delay). The xeno sagitarius battle becomes so laggy after reaching 3GB, up to the point browser nearly hanged on me until I reload the page, clearing the dev panel, or closing the browser altogether and open it again.

Masuzu commented 7 years ago

Ah about the memory usage increase, it is due to the Chrome network request history which keeps accumulating previous requests until the page is refreshed. Sadly I won't do anything about this. Lesson learnt in any case. A workaround if you do not wish to refresh the page on the last stage would be to do something like:

if battle == 3 and turn % 5 == 0 then
  Refresh()
end

This will make Zooey refresh the page every 5 turns on the 3rd battle stage.