Bitburner

Bitburner

View Stats:
Energy9 Dec 17, 2021 @ 2:20pm
growPercent?
I either deeply misunderstand this function or it's broken.

Trying it with 30 threads on joesguns, if I do:

var prediction = ns.formulas.hacking.growPercent(server, 30,player,sourceServer.cpuCores);

It gives me a prediction of
1.03039797143375
.
Which would be great, except that when I actually run a 30 thread grow on joesguns, I end up with:

grow: Executing on 'joesguns' in 8.409 seconds (t=30). grow: Available money on 'joesguns' grown by 9.126653%. Gained 417.291 hacking exp (t=30).

So that's not even a teensy bit accurate.
< >
Showing 1-8 of 8 comments
rex8112 Dec 19, 2021 @ 4:26pm 
I'm trying to figure it out too. Don't even know if the percentage is relating to the available money or the max money
tclord Dec 20, 2021 @ 3:58pm 
Maybe only 9.12% was possible before it hit the max?
RealOfficialTurf Dec 25, 2021 @ 12:23am 
Weird.

I tried modifying the moneyAvailable in the server object to NaN and growPercent() doesn't return a NaN (which is wrong, since grow gain is dependent on the money available). I also tried modifying serverGrowth to NaN and the growPercent() returned NaN (which is correct).

So I guess it's broken?
Af&Fix Dec 25, 2021 @ 3:07am 
Was also super confused by function.
Edit. Okay, so, the number that you saw on grow percent shows a multiplier, which will apply to current money on server, when you execute a grow() with X amount of threads! You can calculate a log with that multiplier as a base (just run analyze function for 1 thread) on desired amount of money, that way you will get a thread prediction
Last edited by Af&Fix; Dec 25, 2021 @ 5:57am
duregard Dec 25, 2021 @ 3:41pm 
Originally posted by RealOfficialTurf:
Weird.

I tried modifying the moneyAvailable in the server object to NaN and growPercent() doesn't return a NaN (which is wrong, since grow gain is dependent on the money available). I also tried modifying serverGrowth to NaN and the growPercent() returned NaN (which is correct).

So I guess it's broken?
The growth percentage is not dependent on money available.

The method used by the formulas API is also used when calculating outcome of the growth method and growth command, so it should be correct.

You can find the source code for it here:
https://github.com/danielyxie/bitburner/blob/2a13db39c769c601956b4bcef5e2a2f40514bcbd/src/Server/formulas/grow.ts
Af&Fix Dec 25, 2021 @ 3:52pm 
Originally posted by duregard:
Originally posted by RealOfficialTurf:
Weird.

I tried modifying the moneyAvailable in the server object to NaN and growPercent() doesn't return a NaN (which is wrong, since grow gain is dependent on the money available). I also tried modifying serverGrowth to NaN and the growPercent() returned NaN (which is correct).

So I guess it's broken?
The growth percentage is not dependent on money available.

The method used by the formulas API is also used when calculating outcome of the growth method and growth command, so it should be correct.

You can find the source code for it here:
https://github.com/danielyxie/bitburner/blob/2a13db39c769c601956b4bcef5e2a2f40514bcbd/src/Server/formulas/grow.ts

Yes, the growth percentage is not dependent on money available. But how much you will gain after grow is obviously based on current money.
Last edited by Af&Fix; Dec 25, 2021 @ 3:52pm
MageKing17 Dec 25, 2021 @ 6:06pm 
Growing adds $+1/thread before multiplying, so if you want to calculate the actual amount of money you'll end up with, you need to calculate it something like this:
const endMoney = (server.moneyAvailable + threads) * ns.formulas.hacking.growPercent(server, threads, player, sourceServer.cpuCores);
And then you can divide that by server.moneyAvailable to get the "actual" growth rate (although make sure your divisor isn't zero; the game pretends the server started from $1 if it has 0 money for the sake of its own calculation).
RealOfficialTurf Dec 25, 2021 @ 8:57pm 
Originally posted by MageKing17:
Growing adds $+1/thread before multiplying
Oh, so growing actually adds $1 per thread before growing the money....

With the new prediction formula, the prediction now matches the result. Thank you!

Why didn't they tell us about this in the docs....
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Dec 17, 2021 @ 2:20pm
Posts: 8