chrisrabe / bitburner-automation

Automation scripts I use for my Bitburner gameplay videos.
125 stars 40 forks source link

launch-fleet code error (not cracking as expected) #1

Closed ghost closed 2 years ago

ghost commented 2 years ago

I'm having a little issue with the launch fleet script

it seems to find servers and upload the virus correctly but for some reason it never runs the cracks on the server and nukes it for root access

my work around at the moment is to simply go crack the server my self but I will be looking into the launch fleet script vs the auto-deploy script to try and figure out why it's not executing that section of the script

chrisrabe commented 2 years ago

Heya, thanks for raising this.

In every episode folder, make sure that you update all the scripts that are there. All the episode folders contain all the files that I've changed when making the video. There's a few places that I think I forgot to cover in my videos (one of them is forgetting to mention changes in the utils file). I have a theory that your launch fleets script isn't nuking the server properly because it may be missing the getRootAccess function from the utils folder.

Some tips for debugging (because I had to do this myself when creating the launch fleets script)

  1. If there's something wrong with your controllable servers, check the getShips function.
  2. If there's something wrong with how your targets are prioritised, check the getPotentialTargets function
  3. If there's something wrong with how your "ships" are being allocated, check either the getRequirements function (for delays, strategies or thread allocation) or the createFleets function (for ship grouping and resource allocation).

Expect some side effects / quirks after using the launch-fleets script:

  1. Since the script quickly picks up available resources within the network as a whole, it will spin up thousands of execution threads within the game. Expect it to load the game much slower than before. How Bitburner works internally is that for every execution that you spin up, I believe it creates a new JS worker when you go online. A pop up message may show up asking you to reset but ignore it. If it doesn't spin up after 1 - 2 hours, feel free to reset (generally takes around 2-3 minutes or longer depending on how long you left your game for).

  2. If you're using the launch-fleets script when the total ram of your controllable servers > total ram the target servers need, you'll find that the controllable servers will only be partially used. Don't worry too much about this because the HGW actions will slowly get longer as you progress.

Let me know if this helps :)

ghost commented 2 years ago

seems the canHack function was reworked from checking the reqPorts & ramAvail to pHack & sHack that is the only thing I can find that is different but I am re watching the video you made about it to try and understand what the old Auto-deploy did with this function vs what the deployfleet is doing with the function.

Thank you for showing me where to look that helped a lot in identifying a function that changed

chrisrabe commented 2 years ago

Ah yes. The "canHack" in auto-deploy (in the first video) and the "canHack" in launch-fleets (in the later video) aren't the same (confusing, I know).

In auto-deploy, I believe the "canHack" function returns true if we are able to gain root access and support the ram requirements of the virus script. This function determines whether we can "control" the server. I think it was renamed to "canPenetrate" when I was refactoring things for launch fleets.

The new "canHack" function when launch-fleets was created is checking the hacking requirements for a server. I think this is used when retrieving targets from the top of my head. This level (sHack) is the level that the server requires before you can run "hack" or "backdoor" commands on it. If you run "hack" on servers when you haven't met their required hacking level, the command will throw an error.

In auto-deploy, if you target a server that has requires a higher level of hacking skills, I think the script throws an error. The reason why we check this in launch-fleets is because our targets are now dynamic (decided by the script). We want to make sure that it doesn't chuck errors to us when it's doing its thing automatically.

Hope this helps :)