Bitburner Documentation

repository·dev·Indexed 23 days ago

https://github.com/bitburner-official/bitburner-src

Documentation for Bitburner, a cyberpunk-themed incremental game centered around hacking and programming. This resource includes technical references for the Netscript (NS) API, guides for contributing new themes and achievements, and details on internal game mechanics such as ActiveFragments and Duplicate Sleeves. It also provides instructions for using developer tools like pretty-save.js, fetch-changelog, and Docker Compose for deployment.

Tokens
284.7K
Snippets
1.2K
Records
2.5K
Agent score
81%

What's inside Bitburner

  1. Overview of Corporation gameplay

    dev

    Corporation is a highly profitable but complex feature in Bitburner. It involves multiple intertwined mechanisms that require careful management to avoid crippling your corporation's progress. For new players, it is recommended to focus on the core foundational sections before moving into advanced optimization.

    Recommended learning path for beginners:

    1. Basic gameplay and terms
    2. FAQ
    3. Industry - Supply chain
    4. General advice
  2. What is Bonus Time and how does it work

    dev

    Bonus Time is a mechanic that accumulates while the game is closed or the browser tab is inactive. For specific game mechanics that support it, Bonus Time significantly increases the rate of associated activities or tasks.

    For example, in IPvGO, a move that normally takes 1 second might only take 200ms if a 5x Bonus Time effect is active. The specific impact of Bonus Time depends on the individual mechanic being used.

  3. Overview of the Product Industry

    dev

    The product industry is a high-profit sector in the late game, allowing for significantly higher prices than the material industry.

    Key Concepts

    • Development vs. Production: Products must be developed before they can be produced. While multiple products can be in the development queue, only one can be developed at a time.
    • Product Limits: Divisions have a default limit of 3 products. While research upgrades can increase this, it is often more efficient to discontinue old products to make room for new ones, as new products are almost always superior.
    • Effective Rating: A product's effective rating depends on its base rating and the quality of its input materials. Maintaining a support division that produces high-quality materials is critical.
    • Optimization: For optimal results in round 3+, implement a custom Market-TA2 script to manage optimal selling prices.
    • Growth Loop: Upgrading the Office and employee stats increases employee production, which leads to higher CreationJobFactors and RP, resulting in better products and higher profits, which in turn funds more upgrades.
  4. Overview of Infiltration mechanics

    dev

    Infiltration allows you to enter a Company's facility to steal classified secrets, which can be sold for money or Faction Reputation.

    How to Infiltrate

    1. Open the World menu.
    2. Visit a Company.
    3. Select the option 'Infiltrate [Company Name]'.

    Key Metrics

    • Difficulty: Determined by your combat and charisma stats. Higher stats reduce difficulty. If difficulty is "Impossible" (100 in UI; 3.5 in NS API), infiltration is blocked. Difficulty increases as you progress through higher clearance levels.
    • Max clearance level: The number of challenges required to earn the reward.
    • Starting security level: Affects both the difficulty of challenges and the value of rewards.

    Failure and Health

    Failing a challenge deals damage based on the location's starting security level. If your HP reaches 0, you are hospitalized and the infiltration ends immediately.

  5. Identifying and Referencing Scripts

    dev

    To target specific scripts with commands or functions, you can use two identification methods:

    1. PID (Process IDentifier): A unique number returned by ns.run(), ns.exec(), etc., and visible in the output of ns.ps(). This is the most reliable way to target a specific running instance.
    2. Filename, Hostname, and Arguments: You can identify a script by its name and the exact arguments used. Note that arguments must be an exact match (both order and type). If multiple scripts match, functions typically return an arbitrary one (usually the oldest).

    Referencing Files: When using functions to reference files (e.g., ns.run() or ns.rm()), you must use the full absolute file path. A full path must begin with a forward slash (/) if the file is not in the root directory.

    ns.run("/scripts/hacking/helpers.myHelperScripts.js");
    ns.rm("/logs/myHackingLogs.txt");
    ns.rm("thisIsAFileInTheRootDirectory.txt");
  6. Manage Dividends and Retained Earnings

    dev

    Dividends are payments to shareholders, while Retained Earnings are added back to the corporation's funds. Increasing the DividendRate increases player money but decreases corporation valuation.

    Dividend Calculation

    Dividends are negatively affected by the TributeModifier (which depends on CorporationSoftcap).

    $$TotalDividends = DividendRate \times (Revenue - Expenses) \times 10$$ $$Dividend = \left(OwnedShares \times \frac{TotalDividends}{TotalShares}\right)^{1 - TributeModifier}$$

    Tribute Modifier

    • Base Formula: $TributeModifier = 1.15 - CorporationSoftcap$.
    • Reductions:
      • ShadyAccounting reduces the modifier by 0.05.
      • GovernmentPartnership reduces the modifier by 0.1.

    Retained Earnings

    $$RetainedEarning = (1 - DividendRate) \times (Revenue - Expenses) \times 10$$

  7. Manage Synchronization and Sleeve Shock

    dev

    Sleeves have two primary status metrics that affect experience gain:

    Synchronization

    A value between 1 and 100 that scales experience earned.

    • How to increase: Assign sleeves to the Synchronize task.

    Sleeve Shock

    A value between 0 and 100 representing trauma from a new body. High shock reduces experience gain.

    • How to decrease: Shock decreases slowly over time, or faster if you assign the sleeve to the Shock Recovery task.

    Experience Calculation Formula

    Let X be the recovery ratio (100 - shock) / 100 and Y be the synchronization ratio synchronization / 100.

    • Sleeve's own gain: If a task normally gives A experience, the sleeve gains A * X.
    • Original consciousness gain: Earns A * X * Y.
    • Other sleeves' gain: A receiving sleeve with recovery ratio Z earns A * X * Y * Z.
  8. Detect warehouse congestion using production heuristics

    dev

    Warehouse congestion often occurs when input material purchases do not account for free space or existing stock, leading to a full warehouse that cannot accept new output units, thus halting production.

    Heuristic Detection Method

    You can detect congestion by monitoring the productionAmount of output materials or products:

    1. Create a map WarehouseCongestionData with keys formatted as ${divisionName}|${city}. The value is a counter of suspected congestion events.
    2. In each cycle, check material.productionAmount and product.productionAmount for the output:
      • If productionAmount == 0: Increment the counter for that ${divisionName}|${city} entry.
      • If productionAmount > 0: Reset the counter for that entry to 0.
    3. If the counter value is greater than 5, the warehouse is considered congested.

    Note: A threshold of 5 is used to reduce false positives caused by the initial startup of a Smart Supply script where production might naturally be 0.