-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for ns.hack(), ns.weaken() and ns.grow() #1742
Comments
A simpler and more on-brand change might be to include an example call to The actual formula for hack, grow, and weaken includes multiple spoilers that the player does not discover until they are out of the midgame and know The Truth, and it would be hard to communicate said formula while being cagey about those aspects. The code is completely open, though, so players can absolutely look up those formulae and re-implement it in their script or whatnot if they wanted. Looking through the source code is encouraged in this game! |
I agree with ficocelliguy. In most cases, I'm all for adding more documentation. Nonetheless, in this case, knowing the specific formulas is not as beneficial as you think:
[1] [2] [3]
|
In addition to what catlover said, I will add a comment about this:
The answer is "it's complicated." I know this stuff really well, and I still get parts of it wrong sometimes. Each of the functions (hack(), weaken() and grow()) has subtle differences between them, some that matter a lot, some that don't, and some that matter only in edge cases. I could write pages on these subtleties (and other people have), and in the end I (as a player) would not trust what anyone wrote about the matter (not even me) - I would go to the source. It is the only way to be sure for details as complicated as this. This is both the benefit and curse of being an open-source game: We can say that the source is the ultimate answer, but it's a response that should be used sparingly. |
I agree that it's bad practice for a user to re-invent the wheel and reimplement these formulae themselves. The reason I think they should be documented is because knowing whether thing X scales linearly, exponentially, logarithmically etc with thing Y is important information which fundamentally changes what the best way to allocate resources is, so players need to know that information. I didn't want to upgrade cores in my playthrough because I couldn't find out whether their effects are linear, exponential or logarithmic and so didn't know how to account for them in my system, and I also really wanted to confirm with threads that it was all linear but couldn't find the documentation saying this.
I can see why this is a problem for spoilers, but at least for why I wanted to know the formulae it's not an issue. If endgame data is multipliers put on top of the base results, I think it would be fine to provide the formula without these as a formula for BASE hacking XP, money, weakening, etc... If it's far more complicated, maybe including formulae is not really possible.
Yes, this is the main reason I think this should be documented. When someone has to reverse-engineer something to find a piece of information a user would commonly want to know, I think that means the documentation has failed. I don't think having to dig through the source code is a fun challenge we should be making the player do. |
It looks like that is already mentioned in the documentation, for the places I'm skimming, but if you find places where it is not that would be useful to add.
That's an explicit part of the game design in a number of mechanics, including casino rng and all of the SF -1 achievements. [It's also a highly applicable real-world skill]. That being said, it's not required for any of the main game mechanics. It's probably faster to make some quick test scripts that e.g. check what grow does with different numbers of threads than it is to dig through the source. |
I also want to add that much more than a coding exercise, this is still a game, if you wanted to 'solve' it then just look for scripts other people wrote and copy-pasta the best of them. A lot of the fun is working with the hidden unknown subtleties of the system and its methods, creating something simple, reaching a limit or desiring to improve, and iterating on the solution. The discovery and hypothesizing of arcane 3rd party libs is usually the most soul-sucking part of programming because its a hindrance to doing your job, here it's part of the immersion. What does
Is just not as fun 😄 |
If multipliers is the only unknown, you can solve for it. |
I'm referring to the NS API documentation, which is here: https://github.com/bitburner-official/bitburner-src/blob/stable/markdown/bitburner.ns.md
The documentation for ns.hack(), ns.weaken() and ns.grow() should include formulae for outcomes. I don't like that the documentation might only mention that "your hacking level and server security and some inherent factor of the server" play a role. It makes it difficult to anticipate problems with a hacking design you're thinking of which forces you to guess or tediously try to reverse engineer the formula yourself, and when things go wrong you don't have enough information to figure out why. It should also be clear in these formulae when each of these factors are checked (when the promise resolves, or when the function is called?)
Whilst getters such as getHackTime, getWeakenTime and getGrowTime exist, how these values are calculated is also something you need to know to design a good hacking system. You'll be asking questions like "what's the optimal way to grow a server to max money?" and without the formulae, you're going to have a hard time figuring that out because you can't easily figure out if two scripts with 50 threads each will be better than one with 100 threads. You can also be misled into thinking the getters factor in some inherent server factor.
For ns.hack(), changes needed are:
For ns.weaken(), changes needed are:
For ns.grow(), changes needed are:
The text was updated successfully, but these errors were encountered: